You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
I believe that adding these to Basics would be a breaking change. In the unlikely event that code like import Something exposing (cosh) is out there, it would be cause an "ambiguous name" error.
Idea to create a Math module could be relevant, so linked for reference. #1088
What functionality would adding these break? Wouldn't this be a semver minor update, since you are just adding a feature? While adding this feature could potentially make other libraries slightly less useful or cause conflicts/import errors, those errors aren't really your concern because the benefits of adding this outweigh the slight negatives in the short term.
This was a surprise. I had completely forgotten I had posted this issue!
I believe that adding these to Basics would be a breaking change. In the unlikely event that code like import Something exposing (cosh) is out there, it would be cause an "ambiguous name" error.
Huh. That didn't occur to me. And it's not even as unlikely as you suggest — that actually appears in my own code.
(The module that exposed cosh was one I had written myself, to work around the fact that these functions weren't builtin.)
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:
(I got these formulas from Wolfram Mathworld.)
I use these functions a lot! In my own code, I have manually defined
cosh
andsinh
5 times,acosh
3 times, andasinh
twice.Note: This suggestion probably belongs in the meta-issue "Math and Numbers" (#721).
The text was updated successfully, but these errors were encountered: