private static void Complexity() { Complex result = Complex.I ^ (Complex.I + 3); Complex x = ComplexMath.Exponential(1, System.Math.PI / 3); Console.WriteLine(x); Console.WriteLine(result); Console.WriteLine(1 * (System.Math.Sin(System.Math.PI / 3) * Complex.I + System.Math.Cos(System.Math.PI / 3))); Console.Write("Input here: "); if (Complex.TryParse(Console.ReadLine(), out var c)) { Console.WriteLine(); for (int i = 0; i < 10; i++) { Console.WriteLine(c ^ i); } } }
/// <summary> /// Exponentiation of a real with a complex number /// </summary> /// <param name="b"></param> /// <param name="exp"></param> /// <returns></returns> public static Complex operator ^(double b, Complex exp) { return(ComplexMath.Exponential(System.Math.Pow(b, exp.Real), exp.Imaginary * System.Math.Log(b))); }
/// <summary> /// Exponentiation of a complex with a real number /// </summary> /// <param name="b"></param> /// <param name="exp"></param> /// <returns></returns> public static Complex operator ^(Complex b, double exp) { return(ComplexMath.Exponential(System.Math.Pow(b.Modulus, exp), b.Argument * exp)); }