示例#1
0
        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);
                }
            }
        }
示例#2
0
 /// <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)));
 }
示例#3
0
 /// <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));
 }