/// <summary> /// Raise this <c>Complex</c> to the given value. /// </summary> /// <param name="complex">The <see cref="Complex"/> number to perfom this operation on.</param> /// <param name="exponent"> /// The exponent. /// </param> /// <returns> /// The complex number raised to the given exponent. /// </returns> public static Complex Power(this Complex complex, Complex exponent) { if (complex.IsZero()) { if (exponent.IsZero()) { return(Complex.One); } if (exponent.Real > 0.0) { return(Complex.Zero); } if (exponent.Real < 0) { if (exponent.Imaginary == 0.0) { return(new Complex(double.PositiveInfinity, 0.0)); } return(new Complex(double.PositiveInfinity, double.PositiveInfinity)); } return(double.NaN); } return((exponent * complex.NaturalLogarithm()).Exponential()); }