Пример #1
0
        public void EllipticFMatchesComplexTest()
        {
            var rand = new Random("EllipticFMatchesComplexTest".GetHashCode());

            for (int i = 0; i < 100; i++)
            {
                var m   = rand.NextDouble();
                var efm = Elliptic.FComplex(m);
                var z   = RandomZ(rand);
                var f1  = Elliptic.F(z, m);
                var f2  = efm(z);
                Assert.AreEqual(f1, f2);
            }
        }
Пример #2
0
        public void EllipticFComplexTest()
        {
            var e = Elliptic.FComplex(0.333);

            var z = new[] {
                new Complex(-0.670791254938757, -0.0938159212065481),
                new Complex(0.528053930350357, -1.07956370130938),
                new Complex(-0.557287707188084, -1.00272777341254),
                new Complex(0.320745728918526, 0.287620039090474),
                new Complex(-0.420904792797892, 0.642254696882941),
                new Complex(0.109863468987495, -0.47809418429494),
                new Complex(-0.272688296113657, 0.197822903078282),
                new Complex(10.9863468987495, -0.47809418429494),
                new Complex(-27.2688296113657, 0.197822903078282),
            };

            var expected = new[] {
                new Complex(-0.68620842267039771730, -0.10047616775855015460),
                new Complex(0.42868733998557565682, -1.05995343584072013101),
                new Complex(-0.46942504702869457356, -1.00008738595868835155),
                new Complex(0.31819382130927205251, 0.29124965412479359813),
                new Complex(-0.39580478305810881056, 0.64709397408138872245),
                new Complex(0.10569294199103250250, -0.47295612599211204389),
                new Complex(-0.27204914758137346116, 0.19984298803088524405),
                new Complex(12.12391310952531579389, -0.5977215792388405620),
                new Complex(-30.1535374477487750443, 0.22663693321479046126),
            };

            for (int i = 0; i < expected.Length; i++)
            {
                Complex f;
                f = e(z[i]);
                var err = (f - expected[i]).Magnitude;
                Assert.IsTrue(err < 1e-14);
            }
        }