Hunsberger, Peter wrote:

Berin Loritsch <[EMAIL PROTECTED]> asks:

Speaking of accademic, anyone have a Java implementation of tanh(x)? The java.lang.Math class only has tan(x) or atan(x), but no hyperbolic function.

Can't recall the details off the top of my head, but I believe you just
need the natural log function to calculate it. I have it buried in a
Fortran program somewhere at home...

Here is a definition I found after googling:


http://mathworld.wolfram.com/HyperbolicTangent.html

I *think* that translates to:


public double tanh( double z ) { return (Math.exp(2 * z) - 1) / (Math.exp(2 * z) + 1); }



--

"They that give up essential liberty to obtain a little temporary safety
 deserve neither liberty nor safety."
                - Benjamin Franklin



Reply via email to