log method

Complex log()

Formula: ln(z) = ln(|z|) + i*arg(z). Throws ArgumentError if the modulus is zero.

Implementation

// Calculates the complex natural logarithm (ln(z)).
///
/// Formula: ln(z) = ln(|z|) + i*arg(z).
/// Throws [ArgumentError] if the modulus is zero.

Complex log() {
  if (_modulus == 0.0) {
    throw ArgumentError('Logarithm of zero is undefined.');
  }
  // log(r*e^(i*theta)) = log(r) + i*theta
  return Complex(math.log(_modulus), _theta1);
}