Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Numerically stable forms

  1. Aug 22, 2004 #1
    Hi.

    I have an assignment lying around, in which I have to find numerically stable forms of some expressions. A few still elude me, so I was wondering if someone might have a suggestion.

    [tex]
    e^{x}-e
    [/tex]

    This has large rounding errors if x is close to 1

    [tex]
    sinh (x) - tanh (x)
    [/tex]

    Large errors for x close to 0

    [tex]
    log(x+\sqrt{x^2+1})
    [/tex]

    No idea...
     
    Last edited: Aug 22, 2004
  2. jcsd
  3. Aug 22, 2004 #2

    pervect

    User Avatar
    Staff Emeritus
    Science Advisor

     
  4. Aug 22, 2004 #3
    Yes, a Taylor expansion does seem obvious; but alas, the'yre asking analytical forms...
     
  5. Aug 23, 2004 #4

    arildno

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    2.:
    [tex]sinh(x)-tanh(x)=sinh(x)(\frac{cosh(x)-1}{cosh(x)})=2tanh(x)sinh^{2}(\frac{x}{2})[/tex]

    Use a similar trick for 1, by noting [tex]sinh(y)=\frac{e^{y}-e^{-y}}{2}[/tex]
     
    Last edited: Aug 23, 2004
  6. Aug 23, 2004 #5
    Thanks! This is just what I needed!
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook