cosh method
Hyperbolic cosine
Compute the hyperbolic cosine of this complex number.
Implements the formula:
cosh(a + bi) = cosh(a)cos(b) + sinh(a)sin(b)i
where the (real) functions on the right-hand side are math.sin, math.cos, fastmath.cosh and fastmath.sinh.
Returns nan
if either real or imaginary part of the
input argument is NaN
.
Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.
Examples:
cosh(1 ± INFINITY i) = NaN + NaN i
cosh(±INFINITY + i) = INFINITY ± INFINITY i
cosh±INFINITY ± INFINITY i) = NaN + NaN i
Implementation
Complex cosh() {
if (isNaN) {
return Complex.nan;
}
final _real = fastmath.cosh(real) * math.cos(imaginary);
final _imag = fastmath.sinh(real) * math.sin(imaginary);
return Cartesian(_real, _imag);
}