Skip to main content
Filter by
Sorted by
Tagged with
3 votes
2 answers
234 views

I am trying to solve a problem posed in this question which asks that a program be written that calculates logarithms of numbers without including <math.h>. I wrote the following program: #...
uran42's user avatar
  • 469
-4 votes
1 answer
101 views

I have a dataset in R that I've already plotted and fitted a logarithmic model to. I'd like to add an additional line on the graph comparing the logarithmic model to a different log equation that I ...
fishing4wall3y3's user avatar
0 votes
1 answer
113 views

I am following some online code to add major yticks to a bar chart. However, I'm finding that the major yticks and the ylim changes for no reason, even though I don't add new major yticks: import ...
user2153235's user avatar
  • 1,285
3 votes
2 answers
130 views

When I plot a density using geom_spatraster, there's a particularly prominent peak that's 'bright' in the visualization. This spike skews the color scale, compressing the representation of other data ...
KeepDigging's user avatar
0 votes
2 answers
156 views

I have 2 approximations for both functions, however the log2(x) takes in an FP number, and outputs a fixed point number; and the 2^x takes in an integer, and outputs a floating point number. the ...
auzifriend's user avatar
2 votes
1 answer
72 views

So this question is based on a biochemical experiment. For those who know a bit about biochemistry it is an enzyme kinetics experiment. I have a dilution series of an activator (a or x) and am ...
Kastroph's user avatar
0 votes
1 answer
34 views

When plotting data, vertical line gets incorrectly transformed by matplotlib. With linear x axis, my curve and the vertical line pointing to a specific location on the curve match perfectly. After ...
Dr. Hillier Dániel's user avatar
0 votes
2 answers
91 views

I will show you my problem with the help of this code: from math import log print(log(1000000, 10)) The result is: 5.999999999999999 I perfectly know that the problem occurs because computers use ...
ArseniyRybasov's user avatar
2 votes
2 answers
189 views

Here is a function to approximate log10(x+1) for (x+1) < ~1.2: a = 1.097 b = 0.085 c = 2.31 ans = 1 / (a - b*x + c/x) It should look like that: It works by adjusting harmonic mean to match log10,...
luaenjoyer's user avatar
1 vote
1 answer
93 views

I am trying to write a function that returns an array that has in the first section linearly increasing elements and in the second section ever increasing distances between the elements. As inputs, I ...
snjosees's user avatar
0 votes
0 answers
99 views

I am trying to plot data (.csv) per municipality (.shp) on a map from Scandinavia using contourf. This data has a big range in values (see list all the way at the bottom), for which I use a log-scale ...
Elsri's user avatar
  • 61
1 vote
2 answers
205 views

I am trying to plot a histogram using ggplot2, in which the counts can span a very large range. So, I decided to try to transform the y axis to log10 scale. This is working well, except for values of ...
Laura's user avatar
  • 11
1 vote
1 answer
51 views

I am wanting to make a bar plot, with error bars representing standard deviations and an overlay of a scatter plot to show individual data points. The data is microbial count data and there are 2 ...
Emma Chareyre's user avatar
0 votes
1 answer
161 views

How can I map linear data points to logarithmic data points? This is different from Map a linear scale to a logarithmic one with both scales having variable min/max and Convert Linear scale to ...
FromTheStackAndBack's user avatar
1 vote
0 answers
82 views

I'm trying to use plotly violin plot for a logarithmic data set with positive values only. when I use the regular violin aka: fig= go.Figure() fig.add_trace(go.Violin(x=last_value, line_color=color, ...
Tomer Gigi's user avatar
0 votes
0 answers
391 views

I am working on a boxplot in Python using Seaborn and Matplotlib where the Y-axis is set to a symmetrical logarithmic scale. I'm attempting to place major ticks at specific intervals using a custom ...
ex1led's user avatar
  • 479
-1 votes
3 answers
242 views

What is O(logn) + O(2log(n/2)) + O(4log(n/4)) ... + O(nlog1) ? I think it is O(nlogn) . Please clarify if I am correct or not. The recurrence relation I am trying to solve here is T(n)=2T(n/2)+ log(n),...
Tanish Agarwal's user avatar
0 votes
0 answers
46 views

int starting ; int ending ; float x; do { starting = get_int (" Starting population of llamas? "); } while (starting < 12); do { ending = get_int (" Ending population of llamas? &...
Dylan wee's user avatar
1 vote
1 answer
124 views

this dataset is great! However I am stuck… there seems to be a logarithmic relationship between number of Votes (x axis) and Approval Index(y axis), but I tried using both scipy.curve_fit as well as ...
Chirag Mohnani's user avatar
1 vote
1 answer
107 views

I'm trying to customize major and minor tick labels on a log y axis where all labels are in %g format. When the minor 2s and 5s are labeled, and both major and minor grid lines are showing and the ...
a11's user avatar
  • 3,476
0 votes
1 answer
24 views

I want to bin as efficiently as possible numbers of a Pandas dataframe column into the degree in a logarithm scale. By logarithm scale, I mean the way to display numbers over a power(unit, degree) ...
Maxime Oriol's user avatar
0 votes
2 answers
634 views

I'm trying to create a smooth function to represent some data I am working with. Trouble is the data is pretty noisy, and simply using the least squares method to create a polynomial line of best fit ...
SSC Fan's user avatar
  • 145
1 vote
1 answer
239 views

While rewriting an old Matlab code to NumPy, I noticed differences in logarithmic calculation. In NumPy, I use np.log, Matlab uses log function. b = [1 1 2 3 5 1 1]; p = b ./ sum(b); sprintf('log(%....
Martin Benes's user avatar
2 votes
1 answer
104 views

I have this image: HI00008918.png I want to apply a logarithmic function (f(x) = (1/a)*log(x + 1), where a = 0.01) on the image... So this is the code: import numpy as np import matplotlib.pyplot as ...
Gustavo Henrique's user avatar
1 vote
2 answers
110 views

Two points: df.x <- c(0.0014, 0.0027) df.y <- c(17.38, 22.49) I want to know y at x==0.002. Linear interpolation gives 19.74. A linear plot shows the intersection: plot(df.x, df.y, type="b&...
akr's user avatar
  • 21
-2 votes
2 answers
286 views

Imagine we are tasked with using an idealized scientific calculator which has the following properties: no direct support for bitwise operations, or for base conversions (eg cannot simply "...
HappMacDonald's user avatar
0 votes
0 answers
378 views

How do I use excel formulas to calculate a log equation I can use to project figures? Here are the following data points: Datapoints for LN I have been using =LINEST(Y,X,1,1) for C and 1,2 for B with ...
Callum Lam's user avatar
0 votes
2 answers
150 views

I am plotting my data (x,y) and want to show the x-axis in logscale. Because there are some negative values in x, the log10 can not be computed for all. This results in nans which are simply omitted ...
swagner's user avatar
  • 51
0 votes
0 answers
42 views

I don't know if this is the right place (at most they will close the post). Anyway, I am trying to implement the Matrix Rotation Count Algorithm explained in this paper (in particular pages 11-12). In ...
SimoPape's user avatar
0 votes
1 answer
186 views

Issue is with semilogy, not with twinx. From next code import numpy as np import matplotlib.pyplot as plt def plot_me(x): fig, ax1 = plt.subplots() ax1.semilogy(x, color="blue") ...
Xopi García's user avatar
2 votes
1 answer
796 views

Similarly, value rounded down to power of two and finding the rightmost set bit is equivalent to log base 2 rounded down to integer. Is that correct? I thought that that would work, for any number ...
Zebrafish's user avatar
  • 16.5k
1 vote
2 answers
397 views

In python's matplotlib, how can I make the logarithm x-axis ticks as the attached picture shows (i.e., major ticks with labels at every 0.5 spacing from 1 to 4.5; minor ticks without labels at every 0....
Leo's user avatar
  • 37
3 votes
1 answer
727 views

I am aware I can use log2 from cmath in C++, but I wanted to implement an efficient way for learning purposes. I have seen a bunch of questions that are relevant, but none of them gives a fast ...
Ξένη Γήινος's user avatar
0 votes
2 answers
2k views

I am trying to find the logarithm of a number to base 3 using python. Here is the problem : https://leetcode.com/problems/power-of-three/description/ I am using this code: import math math.log(k,3) ...
Talha Tayyab's user avatar
  • 30.8k
2 votes
2 answers
491 views

Earlier on, random imputation of left-censored data to follow the assumed distribution has been explained here in Stack Overflow. Than can be easily achieved with the censlm package. But what if I ...
vlangen's user avatar
  • 522
1 vote
1 answer
860 views

I am trying to plot an xy-graph whose x-axis is logarithmic. I did that using this command: import matplotlib as plt plt.plot(X,Y) plt.xscale('log') The x-axis is logarithmic, but only values which ...
khashayar's user avatar
1 vote
2 answers
277 views

I have a function of the following table. input: e output: 1 << e 0 1 1 2 ... ... 31 -2147483648 static int value(int exponent) { return 1 << exponent; } Now, how can I get the ...
Jin Kwon's user avatar
  • 22.4k
1 vote
1 answer
46 views

Hey everyone I am trying to show the intersection of a geom_line on a logarithmic x axis. However, I always miss the geom line. Here's what I do: library(data.table) library(ggplot2) x <- c(0.1, 0....
gernophil's user avatar
  • 647
0 votes
0 answers
241 views

Im having some issues creating a heatmap using plt.imshow() with specific axes that I want to display in a logarithmic scale. I tried different methods, but the image doesn't seem to work when i try ...
IC_S's user avatar
  • 1
0 votes
1 answer
256 views

I'm trying to convert the values of a data table to its log(a)+1 (base 2) into a transformed data table in R. But the first two columns of the data tables are not numbers so I need to exclude them ...
Feynman's user avatar
  • 13
3 votes
1 answer
1k views

For a game that I'm working on - need the ability to run million of "exp" calls on vectors. Basically void vector_exp(const double *x, const double *result, int n) { for (int i=0 ; i<...
dash-o's user avatar
  • 14.7k
0 votes
1 answer
86 views

I am looking for a way to score model fits of x,y data on a scale from 0 to 1, depending on which model the data best fit. If data fit a linear model best, the score would come out close to 1. Log ...
Emma's user avatar
  • 1
0 votes
1 answer
194 views

I'm plotting points on a log-log scatterplot with matplotlib. The x coordinate of these points rises twice as fast (exponentially speaking) than the y coordinate, which means that the x axis is twice ...
Mew's user avatar
  • 415
-2 votes
1 answer
149 views

Consider this program to determine if a given number is a power of 2. class Solution{ // Function to check if given number n is a power of two. public static boolean isPowerofTwo(long n){ ...
Ananya's user avatar
  • 1
1 vote
0 answers
39 views

I am a beginner, I try to plot the absolute square of a function that contain logarithm first I had an error saying: Only size-1 arrays can be converted to Python scalars. Then I tried to fix it by ...
Sophie Er's user avatar
0 votes
1 answer
741 views

Please tell me how you can change log(e) to 1. And in general is there a way in sympy to get a float-type answer? For example, instead of log(2), get 0.69314718056 from math import * from sympy import ...
python_prog's user avatar
0 votes
1 answer
323 views

I am plotting a dataset in R, and have set the y-axis to a log-scale. My data splits into to trends which I have modelled, and added as trendlines to the chart. When using the simple lines() command, ...
James.H's user avatar
  • 25
23 votes
3 answers
14k views

If you were reading news about developments in graphics in the 1990s, you might have followed Jim Blinn's column in IEEE Computer Graphics & Applications, "Jim Blinn's corner." In the ...
Adam Hyland's user avatar
  • 1,077
1 vote
0 answers
391 views

I need to plot antenna radiation pattern. For this i need a logarithmic polar plot. The Problem is, that matplotlib doesn't support the log polar plot properly. The data for the radiation pattern is ...
Thomasstrapag's user avatar
0 votes
1 answer
785 views

How can I set the scale of a log-scaled axis in matplotlib to show values less than base^1 and space them evenly? Example: I have a scale that looks like this: But I want a scale that looks like this:...
confusedandsad's user avatar

1
2 3 4 5
21