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
165
votes
6 answers

How do you do natural logs (e.g. "ln()") with numpy in Python?

Using numpy, how can I do the following: ln(x) Is it equivalent to: np.log(x) I apologise for such a seemingly trivial question, but my understanding of the difference between log and ln is that ln is logspace e?
user1220022
  • 11,167
  • 19
  • 41
  • 57
35
votes
2 answers

ln (Natural Log) in Python

In this assignment I have completed all the problems except this one. I have to create a python script to solve an equation (screenshot). Unfortunately, in my research all over the internet I cannot figure out how in the world to either convert ln…
Michael Watts
  • 385
  • 1
  • 4
  • 8
18
votes
3 answers

R: Using equation with natural logarithm in nls

Good day, I am struggling with R and natural logarithm (ln). Firstly, I cannot find a ln(x) function in R. I have noticed that log(x) is the same as ln(x) (when using ln(x) with a calculator). In R: log(5) = 1.609438 And with a calculator: ln(5)…
wernerfeuer
  • 525
  • 2
  • 7
  • 17
11
votes
2 answers

Logarithm with SSE, or switch to FPU?

I'm doing some statistics calculations. I need them to be fast, so I rewrote most of it to use SSE. I'm pretty much new to it, so I was wondering what the right approach here is: To my knowledge, there is no log2 or ln function in SSE, at least not…
user1128760
7
votes
3 answers

Matlab: Solving a logarithmic equation

I have the following equation that I want to solve with respect to a: x = (a-b-c+d)/log((a-b)/(c-d)) where x, b, c, and d are known. I used Wolfram Alpha to solve the equation, and the result is: a = b-x*W(-((c-d)*exp(d/x-c/x))/x) where W is the…
ROLF
  • 284
  • 2
  • 14
6
votes
1 answer

Does scipy logsumexp() deal with the underflow challenge?

Does the scipy's logsumexp() implementation include the hack that prevents underflow by subtracting the maximum found value in the array from each element? The one explained here below, where m = maxval:
user961627
  • 12,379
  • 42
  • 136
  • 210
5
votes
1 answer

Understanding numpy.random.lognormal

I'm translating Matlab code (written by someone else) to Python. In one section of the Matlab code, a variable X_new is set to a value drawn from a log-normal distribution as follows: % log normal distribution X_new = exp(normrnd(log(X_old),…
abcd
  • 10,215
  • 15
  • 51
  • 85
4
votes
2 answers

Why is one of my functions running so much slower?

I'm writing an implementation of a couple of methods to find the natural logs of numbers using GMP in C. I have two functions, both of which work, but one of which runs a lot slower than the other. The issue is that it is the one that I expected to…
user163911
  • 169
  • 1
  • 4
  • 13
4
votes
1 answer

How to calculate log(sum of terms) from its component log-terms

(1) The simple version of the problem: How to calculate log(P1+P2+...+Pn), given log(P1), log(P2), ..., log(Pn), without taking the exp of any terms to get the original Pi. I don't want to get the original Pi because they are super small and may…
wen
  • 1,875
  • 4
  • 26
  • 43
4
votes
3 answers

Python 2.5.4: how to find sum of logarithm values

I've been learning Python 2.5.4 and I have the following problem to solve: "Write a program that computes the sum of the logarithms of all the primes from 2 to some number n, and print out the sum of the logs of the primes, the number n, and the…
devonjones
  • 75
  • 2
  • 6
4
votes
1 answer

Logarithm computing without math.h

I'm trying to compute ln(x) by Taylor series. Here is my code: #define N 10 float ln(float x){ int i; float result; float xt; float xtpow; int sign; if(x > 0 && x <= 1){ xt = x - 1.0; sign = -1; …
Ilya Boltnev
  • 1,031
  • 3
  • 13
  • 27
3
votes
1 answer

Issue with implementation of natural logarithm (ln) and exponentiation

I try to follow the topic "Efficient implementation of natural logarithm (ln) and exponentiation" to be able to implement a log function without math.h. The described algorithm works well for values between 1 and 2 (normalized values). However, if…
3
votes
2 answers

What the 'set logscale' does in gnuplot?

My question is more about math then the actual code. When use the command set logscale on gnuplot 5.0 what is happening ? It should represents the logarithmic values values of the x and y points. But it doesn not seems to work properly. For…
Andrea Angeletti
  • 271
  • 4
  • 12
3
votes
1 answer

Calculate values in logarithmic scale

I want to redraw this Body Weight scale in bitmap editor pixel by pixel. As I understood this is a logarithmic scale, but what is the logarithm - binary or decimal? How to calculate distance between lines in pixels. Maybe it's better to count from 1…
khex
  • 2,778
  • 6
  • 32
  • 56
3
votes
1 answer

Is there a function in java to find the antilog?

I wanted to know if there is a function in java to find the antilogs or I would have to implement it myself? If so, how do I implement it?
Piyush Ranjan
  • 329
  • 1
  • 4
  • 9
1
2 3 4 5 6