What are some numerically stable forms of common mathematical expressions?

In summary, they are discussing an assignment that involves finding numerically stable forms of expressions and one person is asking for suggestions. The expressions given are e^{x}-e, sinh(x)-tanh(x), and log(x+\sqrt{x^2+1}). Another person suggests using Taylor series expansions and also provides an analytical form for sinh(x)-tanh(x). The first person thanks them for the helpful suggestion.
  • #1
Kalimaa23
279
0
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:
Physics news on Phys.org
  • #2
Dimitri Terryn said:
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

did you try a Taylor series expansion, or is that not what's being asked for?
 
  • #3
Yes, a Taylor expansion does seem obvious; but alas, the'yre asking analytical forms...
 
  • #4
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:
  • #5
Thanks! This is just what I needed!
 

FAQ: What are some numerically stable forms of common mathematical expressions?

What are numerically stable forms?

Numerically stable forms are mathematical expressions or algorithms that are designed to minimize the effects of rounding errors and other numerical inaccuracies. They are especially important in scientific computing, where precise and accurate calculations are crucial.

Why are numerically stable forms important?

Numerically stable forms are important because they help to ensure that the results of numerical calculations are as accurate as possible. Without them, rounding errors and other numerical inaccuracies can accumulate and significantly impact the results of calculations, leading to incorrect conclusions and potentially unreliable scientific findings.

How do you determine if a form is numerically stable?

There are several ways to determine if a form is numerically stable. One way is to analyze the form's sensitivity to small changes in the input values. Another way is to compare the results of the form with the results of a more precise (but potentially slower) numerical method. Additionally, some forms have known numerical stability properties that can be verified mathematically.

Can any form be made numerically stable?

No, not all forms can be made numerically stable. Some forms are inherently unstable due to the nature of the mathematical operations involved. However, for many unstable forms, there are techniques and modifications that can be applied to improve their numerical stability.

Are there any downsides to using numerically stable forms?

While numerically stable forms are generally preferred for their accuracy, they may come at the cost of increased computational complexity and runtime. In some cases, using a numerically stable form may not be necessary or practical, especially if the margin of error is not critical for the particular application.

Back
Top