Questions tagged [natural-logarithm]

Use this tag for questions related to Natural logarithm which is logarithm to the base `e`. The natural logarithm is generally written as `ln x` or `ln(x)`.

Natural logarithm is logarithm to the base e, where e is approximately equal to 2.718281828 (though, like π, it's a transcendental number). The natural logarithm is generally written as ln x or ln(x).

87 questions
2
votes
1 answer

Natural Logarithm algebra in numpy

I have the following equation: import numpy as np d = (x - y) / np.log((x - z) / (y - z)) Where I am trying to find x Is this possible in numpy or other python libraries? In this case, could you please provide sample code of how to do it with…
HerrSober
  • 91
  • 1
  • 6
2
votes
1 answer

Proper usage of logarithmic notations in scientific papers

Recently I was told that scientific papers in English use - log_e while French papers use - ln to denote natural logarithms. The two notations mean the same but I was told that using the notation ln for natural logarithms in English scientific…
TheBatmanWhoLaughs
  • 328
  • 2
  • 3
  • 13
2
votes
1 answer

How to code logs / Dealing with NaN's

I am trying to make a method that finds an approximation of the natural log of a variable using a Taylor Series. I am aware of the Math.log(a) method and do not wish to use it here. The problem is that for numbers greater than 2 the result returned…
2
votes
1 answer

Log scale mathplotlib in Python?

I'm trying to fit a lognormal curve and I'm not sure how to change the y (and x axis) to log scale? I tried using logspace instead of linspace but I got an error OverflowError: cannot convert float infinity to integer I tried: x =…
O.rka
  • 29,847
  • 68
  • 194
  • 309
2
votes
2 answers

python logarithm incorrectly calculated very small complex numbers

I need to use python to calculate the logarithms of objects of the form log( 1 - n0 - n1*1j) where n0 and n1 are very small numbers ~ 1.0e-27 and 1j is the the imaginary number. Using cmath.log gives the wrong answer print cmath.log( 1.0 - 1e-27 -…
2
votes
2 answers

Making sense of numeric literals in log operation in libm

Looking at the implementation of log operation in libm, there are some numeric literals that I have problem understanding. Download the code from here Part of the code is shown below. I would like to know the meaning of 0x95f64, 0x6147a and…
1
vote
2 answers

How can I get log value of a negative value?

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 exponent from a value? I tried the following code…
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184
1
vote
0 answers

Do you know the base of amcharts logarithmic scale?

I am porting a chart form Dundas to amCharts. This charts uses a logarithmic scale base on the natural log. It does not seem you can change the base of the scale in amcharts like you can in Dundas. Does anyone know what the base of the logarithmic…
1
vote
1 answer

How can I speed up my approximate natural log function?

I have implemented an approximate natural log function based on a Padé Approximation of a truncated Taylor Series. The accuracy is acceptable (±0.000025) but despite several rounds of optimizations, its exec time is still about 2.5x that of the…
Paul Chernoch
  • 5,275
  • 3
  • 52
  • 73
1
vote
1 answer

int() function in awk changes the argument even if this is integer already

I don't understand the following two results in awk $ awk 'BEGIN { print (log(.01)/log(10)) print int(log(.01)/log(10)) }' -2 -1 Version: $ awk --version GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.1.2)
Enlico
  • 23,259
  • 6
  • 48
  • 102
1
vote
1 answer

Continued fraction natural logarithm(number of iterations needed to calculate right logarithm)

I have problem with my continued fraction algorithm for natural logarithm. I need to calculate natural logarithm for example ln(0.31) with accuracy on 1e-6 in 6 iterations, my algorithm will do it in 8. This is my…
Marklar
  • 21
  • 1
  • 8
1
vote
1 answer

delta value while calculating logarithm

I am using a formula to calculate a parameter, the formula involves taking logarithm of a value which can be zero at times. To handle such case, I read in literature the technique to put some delta value as follows: ln(delta + A) Here, the paramter…
kunal18
  • 1,935
  • 5
  • 33
  • 58
1
vote
0 answers

Algorithm to compute a real logarithm of a real matrix?

I would like an algorithm to find the real logarithm of a real matrix. The existence theorem found here is: A real matrix has a real logarithm if and only if it is invertible and each Jordan block belonging to a negative eigenvalue occurs an even…
Matta
  • 145
  • 6
1
vote
2 answers

Calculating log(sum of exp(terms) ) when "terms" are very small

I would like to compute log( exp(A1) + exp(A2) ). The formula below log(exp(A1) + exp(A2) ) = log[exp(A1)(1 + exp(A2)/exp(A1))] = A1 + log(1+exp(A2-A1)) is useful when A1 and A2 are large and numerically exp(A1)=Inf (or exp(A2)=Inf). (this…
FairyOnIce
  • 2,526
  • 7
  • 27
  • 48
1
vote
4 answers

DecimalFormat the answer?

Please forgive my ignorance, I'm a beginner. Can anyone tell me why I am getting my error code in the if/else statement below? I think my result for the ln multiplication is is not exactly the same as the standard multiplication (there is a…
Joe Austin
  • 557
  • 7
  • 24