Results 1 to 4 of 4
  1. #1
    imorio is offline Senior Member
    Join Date
    Aug 2010
    Posts
    127
    Rep Power
    0

    Default 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)?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,773
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by imorio View Post
    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
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    imorio is offline Senior Member
    Join Date
    Aug 2010
    Posts
    127
    Rep Power
    0

    Default

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

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,773
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by imorio View Post
    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
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Create Math.sin without math.sin
    By vudoo in forum New To Java
    Replies: 11
    Last Post: 12-07-2010, 07:23 AM
  2. Math in java
    By blug in forum New To Java
    Replies: 2
    Last Post: 11-22-2010, 03:21 PM
  3. Help with java math
    By gabrielfirestorm in forum New To Java
    Replies: 6
    Last Post: 10-25-2010, 02:54 PM
  4. Anyone good at math?
    By iWonder in forum Forum Lobby
    Replies: 12
    Last Post: 01-11-2009, 05:12 PM
  5. need help with math for a new program
    By gotenks05 in forum New To Java
    Replies: 13
    Last Post: 09-26-2008, 08:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •