pow method

Complex pow(
  1. int n
)

Raise the complex number to the integer power n.

Use De Moivre's formula: (re^(itheta))^n = r^n * e^(intheta).

Implementation

Complex pow(int n) {
  if (n == 0) return one;
  final double rPow = math.pow(_modulus, n).toDouble();
  final double angle = n * _theta1;
  return Complex.polar(rPow, angle);
}