# Numerically stable forms

1. Aug 22, 2004

### Kalimaa23

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...

Last edited: Aug 22, 2004
2. Aug 22, 2004

### pervect

Staff Emeritus

3. Aug 22, 2004

### Kalimaa23

Yes, a Taylor expansion does seem obvious; but alas, the'yre asking analytical forms...

4. Aug 23, 2004

### arildno

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}$$

Last edited: Aug 23, 2004
5. Aug 23, 2004

### Kalimaa23

Thanks! This is just what I needed!