Exemple #1
0
        public void JacobiDnComplexArgTest()
        {
            var z = new[]
            {
                new Complex(0.0115779438837883, 0.00215513498962569),
                new Complex(0.0251305156397967, -0.0159972042786677),
                new Complex(2.12623597863526, 0.480192562215063),
                new Complex(-1.8128943757431, 0.175402508876567),
                new Complex(0.974889810203627, 0.317370944403016),
            };

            var m = new[]
            {
                .82872474670,
                .95465479750,
                .41588039490,
                .79913716820,
                .22263345920,
            };

            var ans = new[] {
                "0.9999463821545492-0.0000206762130171 i",
                "0.9998206008771541+0.0003836693444763 i",
                "0.7479880904783000+0.0534965402190790 i",
                "0.4777309286723279+0.0277602955990134 i",
                "0.9203769973939489-0.0354146592336434 i",
            };

            for (int i = 0; i < z.Length; i++)
            {
                var dn = Jacobi.dn(z[i], m[i]);
                var ex = Parse(ans[i]);
                Assert.IsTrue(Complex.Abs(dn - ex) < 1e-15);
                var f = Jacobi.dnComplex(m[i]);
                dn = f(z[i]);
                Assert.IsTrue(Complex.Abs(dn - ex) < 1e-15);
            }
        }