complexCos function

Complex complexCos(
  1. Complex a
)

Compute the cosine of this complex number.

Implements the formula:

cos(a + bi) = cos(a)cosh(b) - sin(a)sinh(b)i

Examples

var c1 = Complex(real: 3.0, imaginary: 4.0);

print(c1.cos());

/* output:
Complex(real: -27.034945603074224, imaginary: -3.8511533348117775)
*/

Implementation

Complex complexCos(Complex a) {
  return Complex(
      real: math.cos(a.real) * fmath.cosh(a.imaginary),
      imaginary: -math.sin(a.real) * fmath.sinh(a.imaginary));
}