PDA

View Full Version : Numerically stable forms


Dimitri Terryn
Aug22-04, 06:12 AM
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.


e^{x}-e


This has large rounding errors if x is close to 1


sinh (x) - tanh (x)


Large errors for x close to 0


log(x+\sqrt{x^2+1})


No idea...

pervect
Aug22-04, 04:33 PM
[QUOTE=Dimitri Terryn]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.


e^{x}-e


This has large rounding errors if x is close to 1

did you try a Taylor series expansion, or is that not what's being asked for?

Dimitri Terryn
Aug22-04, 11:38 PM
Yes, a Taylor expansion does seem obvious; but alas, the'yre asking analytical forms...

arildno
Aug23-04, 05:02 AM
2.:
sinh(x)-tanh(x)=sinh(x)(\frac{cosh(x)-1}{cosh(x)})=2tanh(x)sinh^{2}(\frac{x}{2})

Use a similar trick for 1, by noting sinh(y)=\frac{e^{y}-e^{-y}}{2}

Dimitri Terryn
Aug23-04, 01:38 PM
Thanks! This is just what I needed!