tr29124_test icon indicating copy to clipboard operation
tr29124_test copied to clipboard

Add sinh(tanh(x)) and other similar functions.

Open emsr opened this issue 6 years ago • 7 comments

Work on double exp integrals and recent fast math work in gcc indicates that sinh(tanh(x)), cosh(tanh(x)), sinh(atanh(x)), and cosh(atanh(x)). I'm not interested in optimizing but in accuracy.

emsr avatar Dec 02 '18 16:12 emsr

Hi, do you have a pointer on what is needed for the hyperbolic functions? Are you interested in reliable series for e.g. sinh(tanh(x)) ?

CaptainSifff avatar Jun 21 '19 13:06 CaptainSifff

On 6/21/19 9:01 AM, CaptainSifff wrote:

Hi, do you have a pointer on what is needed for the hyperbolic functions? Are you interested in reliable series for e.g. sinh(tanh(x)) ?

??? You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/emsr/tr29124_test/issues/165?email_source=notifications&email_token=AAOYYX2WABPWRBVAZE4KJQLP3TGKLA5CNFSM4GHV4E4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYIMWSY#issuecomment-504417099, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOYYX6J7PUPOLUZ77B3CNLP3TGKLANCNFSM4GHV4E4A.

Yes, I would like a good series for sinh(tanh(x)).

Maybe for sinh(a*tanh(x)) since these are used in double exponential quadrature rules (exp a = pi/2).

Thanks!

emsr avatar Jun 24 '19 20:06 emsr

And directly evaluating that function is not fast enough? or lacks precision for certain values since some overflow/underflow occurs?

CaptainSifff avatar Jun 24 '19 23:06 CaptainSifff

Hi Ed, I've got something to play for you... We consider the functions C(x) = Cosh(a Tanh(x)) and S(x) = Sinh(a Tanh(x)) and consider the behaviour for large x. Denoting real infinity as "inf" We find C(inf) = Cosh(a) and S(inf) = Sinh(a) I think I can show that the large-x behaviour is given by C(x) ~ C(inf) * F(a,x) and S(x) ~ S(inf) * F(a,x) with the same function F(a,x). Now we have F(a,x) = y(a,x) * K_1(y(a,x)) with y(a,x) = 2 * a * exp(-x) and K_1 denoting the modified Bessel function of the second kind (http://mathworld.wolfram.com/ModifiedBesselFunctionoftheSecondKind.html) Since y(a,x) becomes exponentially small for large x we can use any Series around x=0 for K_1. To give an approximation to first order that only relies on elementary functions we have: F(a,x) ~ 1 + a^2 * exp(-2x) * (-1+2 \gamma + 2* ln(a) -x) + ... Here \gamma is the Euler-Mascheroni constant(https://en.wikipedia.org/wiki/Euler%E2%80%93Mascheroni_constant) I get good agreement in Mathematica between C(x) evaluated in Mathematica for a=1 and x>20. If you have questions or my notation is unclear, just ask!

CaptainSifff avatar Aug 19 '19 16:08 CaptainSifff

Forget what I have previously written... I found a "minor" bug in my calculation that makes everything far simpler.... To begin again: We consider the functions C(x) = Cosh(a Tanh(x)) and S(x) = Sinh(a Tanh(x)) and consider the behaviour for large x. Denoting real infinity as "inf" We find C(inf) = Cosh(a) and S(inf) = Sinh(a) I think I can show that the large-x behaviour is given by C(x) ~ C(inf) * F(a,x) and S(x) ~ S(inf) * F(a,x) with the same function F(a,x). Now we have F(a,x) = Cosh(2 * a * exp(-2 * x)) Since exp(-2 * x) becomes exponentially small for large x we can use any Series around x=0 for Cosh(x). To give an approximation to second order in exp(-2x) that only relies on elementary functions we have: F(a,x) ~ 1 + 2 * a^2 * exp(-4x) (more terms could be obtained from the Taylor series of cosh(x) but they are probably not required...) I get good agreement in Mathematica of C(x) evaluated in Mathematica for a=1 and x>20. If you have questions or my notation is unclear, just ask!

CaptainSifff avatar Aug 19 '19 17:08 CaptainSifff

Very nice. I'm going to play with this myself. I'm not sure what I'd call these ;-) but we'll think of something.

emsr avatar Aug 20 '19 04:08 emsr

the most unimaginative I could come up with is: C_a(x) := cosh(a * tanh(x)) S_a(x) := sinh( a * tanh(x))

CaptainSifff avatar Aug 20 '19 12:08 CaptainSifff