sin method

Complex sin()

Sine

Compute the sine of this complex number.

Implements the formula:

sin(a + bi) = sin(a)cosh(b) - cos(a)sinh(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:

sin(1 ± INFINITY i) = 1 ± INFINITY i
sin(±INFINITY + i) = NaN + NaN i
sin(±INFINITY ± INFINITY i) = NaN + NaN i

Implementation

Complex sin() {
  if (isNaN) {
    return Complex.nan;
  }
  final _real = math.sin(real) * fastmath.cosh(imaginary);
  final _imag = math.cos(real) * fastmath.sinh(imaginary);
  return Cartesian(_real, _imag);
}