exp method

  1. @override
Cartesian exp()
override

Compute the exponential function of this complex number.

Implements the formula:

exp(a + bi) = exp(a)cos(b) + exp(a)sin(b)i

where the (real) functions on the right-hand side are math.exp, math.cos, and math.sin.

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:

exp(1 ± INFINITY i) = NaN + NaN i
exp(INFINITY + i) = INFINITY + INFINITY i
exp(-INFINITY + i) = 0 + 0i
exp(±INFINITY ± INFINITY i) = NaN + NaN i

Implementation

@override
Cartesian exp() {
  if (isNaN) return Complex.nan;

  final expReal = math.exp(real);
  return Complex.polar(expReal, imaginary) as Cartesian;
}