/// <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 > 0d) { return(Complex.Zero); } if (exponent.Real < 0d) { return(exponent.Imaginary == 0d ? new Complex(double.PositiveInfinity, 0d) : new Complex(double.PositiveInfinity, double.PositiveInfinity)); } return(new Complex(double.NaN, double.NaN)); } return(Complex.Pow(complex, exponent)); }
/// <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()); }
/// <summary> /// Trigonometric Arc Cotangent of this <c>Complex</c> number. /// </summary> /// <param name="value"> /// The complex value. /// </param> /// <returns> /// The arc cotangent of a complex number. /// </returns> public static Complex InverseCotangent(this Complex value) { if (value.IsZero()) { return(Math.PI / 2.0); } var inv = Complex.ImaginaryOne / value; return((Complex.ImaginaryOne * 0.5) * ((1.0 - inv).NaturalLogarithm() - (1.0 + inv).NaturalLogarithm())); }
/// <summary> /// Trigonometric principal Arc Cotangent of this <c>Complex</c> number. /// </summary> /// <param name="value">The complex value.</param> /// <returns>The arc cotangent of a complex number.</returns> public static Complex Acot(this Complex value) { if (value.IsZero()) { return(Constants.PiOver2); } var inv = Complex.ImaginaryOne / value; return((Complex.ImaginaryOne * 0.5) * ((1.0 - inv).Ln() - (1.0 + inv).Ln())); }