static void Main(string[] args) { Console.WriteLine("Vector<Complex1>"); Vector <Complex1> v1 = Vector <Complex1> .FromValues(new Complex1(1, 1), new Complex1(-2, 3)); Vector <Complex1> v2 = Vector <Complex1> .FromValues(new Complex1(0, 2), new Complex1(-3, 1)); Complex1 coef = new Complex1(2, -1); Console.WriteLine($"v1 = {v1}"); Console.WriteLine($"v2 = {v2}"); Console.WriteLine($"coef = {coef}"); Console.WriteLine($"v1 + v2 = {v1 + v2}"); Console.WriteLine($"v1 - v2 = {v1 - v2}"); Console.WriteLine($"v1 * coef = {v1 * coef}"); Console.WriteLine($"(v1, v2) = {v1.ScalarMultiply(v2)}"); Console.WriteLine($"|v1| = {v1.Abs()}"); //TestComplex1(); //TestVector(); //TestVectorComplex1(); }
static void TestComplex1() { Console.WriteLine("Complex1"); Complex1 val1 = new Complex1(-1, 1); Complex1 val2 = new Complex1(3, 2); Console.WriteLine($"val1 = {val1}"); Console.WriteLine($"val2 = {val2}"); Console.WriteLine($"val1 Magnitude = {val1.Magnitude}"); Console.WriteLine($"val1 Phase = {val1.Phase}"); Console.WriteLine($"val1 + val2 = {val1 + val2}"); Console.WriteLine($"val1 - val2 = {val1 - val2}"); Console.WriteLine($"val1 * val2 = {val1 * val2}"); Console.WriteLine($"val1 / val2 = {val1 / val2}"); Console.WriteLine(); }
static void TestVectorComplex1() { Console.WriteLine("Vector<Complex1>"); Vector <Complex1> vec1 = Vector <Complex1> .FromValues(new Complex1(1, 1), new Complex1(-2, 3), new Complex1(6, 0)); Vector <Complex1> vec2 = Vector <Complex1> .FromValues(new Complex1(0, 2), new Complex1(-3, 1), new Complex1(2, 2)); Complex1 coef = new Complex1(2, -1); Console.WriteLine($"vec1 = {vec1}"); Console.WriteLine($"vec2 = {vec2}"); Console.WriteLine($"coef = {coef}"); Console.WriteLine($"vec1 + vec2 = {vec1 + vec2}"); Console.WriteLine($"vec1 - vec2 = {vec1 - vec2}"); Console.WriteLine($"vec1 * coef = {vec1 * coef}"); //Console.WriteLine($"vec1 + vec2 = {Vector<Complex1>.Add(vec1, vec2)}"); Console.WriteLine($"(vec1, vec2) = {vec1.ScalarMultiply(vec2)}"); Console.WriteLine(); }