New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hyperbolic trig functions #968

Open
rtavenner opened this Issue Jul 15, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@rtavenner

rtavenner commented Jul 15, 2018

Suggestion: Provide hyperbolic trig functions (sinh, cosh, tanh, asinh, acosh, atanh) in Basics.
All of these are already javascript functions (Math.cosh, Math.sinh, etc.), so this should be easy to implement.

Current workaround:

cosh : Float -> Float
cosh x = (e^x + e^ -x) / 2
sinh : Float -> Float
sinh x = (e^x - e^ -x) / 2
tanh x : Float -> Float
tanh x = sinh x / cosh x
asinh : Float -> Float
asinh x = logBase e (x + sqrt (1 + x^2))
acosh : Float -> Float
acosh x = logBase e (x + sqrt (x^2 - 1))
atanh : Float -> Float
atanh x = (logBase e ((1 + x) / (1 - x))) / 2

(I got these formulas from Wolfram Mathworld.)

I use these functions a lot! In my own code, I have manually defined cosh and sinh 5 times, acosh 3 times, and asinh twice.

Note: This suggestion probably belongs in the meta-issue "Math and Numbers" (#721).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment