# Math.log1p=ln(x+1) instead of ln(x)

• 01-01-2011, 01:14 PM
imorio
Math.log1p=ln(x+1) instead of ln(x)
Simple question out of curiosity, why does Math.log1p return ln(x+1) instead of just ln(x)?
• 01-01-2011, 01:28 PM
JosAH
Quote:

Originally Posted by imorio
Simple question out of curiosity, why does Math.log1p return ln(x+1) instead of just ln(x)?

ln(1+x) is mathematically quite a fundamental function (as is ln(x) which is another function/method in the Math class). The first derivative of ln(1+x) w.r.t. x is 1-x+x^2-x^3+x^4 ... and is a nice tool to construct other fundamental series with.

kind regards,

Jos
• 01-01-2011, 01:46 PM
imorio
Ah ok, nice. I didn't see ln(x) was also in there. Thanks for the explanation.
• 01-01-2011, 01:51 PM
JosAH
Quote:

Originally Posted by imorio
Ah ok, nice. I didn't see ln(x) was also in there. Thanks for the explanation.

You're welcome of course; a small correction: the first derivative is 1/(1+x). The Taylor expansion (at 0) is the series I mentioned.

kind regards,

Jos