pow method

Complex pow(
  1. num x
)

Calculates the power having a complex number as base and a real value as exponent. The expression is in the form (a + bi)x.

Implementation

Complex pow(num x) {
  final logRe = x * math.log(abs());
  final logIm = x * phase();

  final modAns = math.exp(logRe);

  return Complex(modAns * math.cos(logIm), modAns * math.sin(logIm));
}