Post Reply 
HP 35S: Hyperbolics Bug?
07-24-2015, 11:27 AM
Post: #3
RE: HP 35S: Hyperbolics Bug?
It would be surprising. The hyperbolics don't have the same nasty cases as the circular trigonometric functions. There are still concerns but they aren't so insidious as with the circular functions.

The näive formula for \( cosh(x) = \frac{e^x + e^{-x}}{2} \) is stable across the entire domain.

The näive formula for \( sinh(x) = \frac{e^x - e^{-x}}{2} \) isn't. It encounters cancellation issues as x -> 0. This would be the place I'd go hunting for accuracy loss both for sinh and tanh. The 34S uses \( sinh(x) = \frac{(e^x - 1)(e^x + 1)}{2 e^x}, |x| < \frac{1}{2} \) which is stable so long as the accurate builtin function for \( e^x - 1 \) is used. Outside of this domain, the näive formula works fine.

Tanh can be expressed as \( \frac{sinh}{cosh} \), however the 34S uses the alternative \( tanh(x) = \frac{e^{2x}-1}{e^{2x}+1} = \frac{e^{2x}-1}{e^{2x}-1 + 2} \) which is more stable but does risk overflow for large x.

For the inverse hyperbolic functions, \( cosh^{-1}(x) = log \left( x + \sqrt{x^2+1} \right) \) is straightforward again. Arcsinh and arctanh require some care for x near zero. They can be stably calculated with the use of the \( ln1p(x) = ln(1 + x) \) function:
\[
\\sinh^{-1}(x) = ln1p \left( x \left(1 + \frac{x}{\sqrt{x^2+1}+1} \right) \right)\\
\\tanh^{-1}(x) = \frac{ln1p \left( \frac{2x}{1-x} \right)}{2}
\]

Assuming I got all of the formulas correct Smile

- Pauli
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP 35S: Hyperbolics Bug? - Gerald H - 07-24-2015, 10:45 AM
RE: HP 35S: Hyperbolics Bug? - Marcio - 07-24-2015, 11:14 AM
RE: HP 35S: Hyperbolics Bug? - Paul Dale - 07-24-2015 11:27 AM
RE: HP 35S: Hyperbolics Bug? - Marcio - 07-24-2015, 12:14 PM
RE: HP 35S: Hyperbolics Bug? - Marcio - 07-24-2015, 01:33 PM
RE: HP 35S: Hyperbolics Bug? - Marcio - 07-24-2015, 04:49 PM
RE: HP 35S: Hyperbolics Bug? - Marcio - 07-25-2015, 04:22 AM



User(s) browsing this thread: 2 Guest(s)