public void TestMethod1()
        {
            double w = 1.0;
            var    c = PolesMasMemoized(w);
            //c.Show();

            double dist = Vectors.Union2(new Vectors(0.0), c).MinDist;
            double eps = dist /*poles.MinDist*/ * 0.4, eps2 = 0.5 * eps;

            // CVectors[] m = new CVectors[c.Deg];
            for (int i = 0; i < c.Deg; i++)
            {
                // m[i] =new CVectors( PRMSN(c[i], 1.0));
                double   d = c[i] - eps;
                CVectors m = new CVectors(PRMSN(d, w));
                Console.WriteLine($"{d} {m}");

                d = c[i] + eps;
                m = new CVectors(PRMSN(d, w));
                Console.WriteLine($"{d} {m}");
            }

            using (StreamWriter f = new StreamWriter("vert.txt"))
            {
                f.WriteLine("w Reux Imux Reuy Imuy Reuz Imuz");

                var ws = Functions.SeqWMemoized(абКонсоль.wbeg, абКонсоль.wend, абКонсоль.wcount);
                for (int i = 0; i < ws.Length; i++)
                {
                    var tmp = KsumRes2(200, 0, ws[i]);
                    f.WriteLine($"{ws[i]} {tmp[0].Re} {tmp[0].Im} {tmp[1].Re} {tmp[1].Im} {tmp[2].Re} {tmp[2].Im}".Replace(',', '.'));
                }
            }
        }
        public void FastAddTest()
        {
            CVectors a = new CVectors(new double[] { 1, 2, 3, 4 });
            CVectors b = new CVectors(new double[] { 4, 3, 2, 1 });
            CVectors c = new CVectors(new double[] { 0, 0, 0, 1 });
            CVectors d = new CVectors(new double[] { -1, -2, -3, -4 });

            a.Show();
            a.FastAdd(b); a.Show();
            a.FastAdd(c); a.Show();
            a.FastAdd(d); a.Show();
        }
Example #3
0
        public static void CVectorExamples()
        {
            var v1 = new Vectors(1, 2, 3, 4, 5);
            var v2 = new Vectors(0, 3, 4, 3, -5);

            var c = new CVectors(R: v1, I: v2);

            c.Show();           // (1    2 + 3i   3 + 4i   4 + 3i   5 - 5i)
            c.Re.Show();        // (       1       2       3       4       5       )
            c.Normalize.Show(); // (0,1414213562373095    0,282842712474619 + 0,42426406871192845i   0,42426406871192845 + 0,565685424949238i   0,565685424949238 + 0,42426406871192845i   0,7071067811865475 - 0,7071067811865475i)
            c.Conjugate.Show(); // (1    2 - 3i   3 - 4i   4 - 3i   5 + 5i)

            var b = new CVectors(new Complex[] { new Complex(1, 2), new Complex(4, 5), new Complex(4.4, 0), new Complex(), new Complex(4.5) });

            (c / 5 + b * (0.2 - Complex.I)).Show(); // (2,4000000000000004 - 0,6i   6,2 - 2,4i   1,48 - 3,6000000000000005i   0,8 + 0,6i   1,9 - 5,5i)
        }