Ejemplo n.º 1
0
        public void JacobiSnComplexArgTest()
        {
            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.011577520035845973+0.002154873907338315 i",
                "0.02513162775967239-0.01598866500104887 i",
                "1.0366906460437097-0.0928117050540744 i",
                "-0.9833652385779392+0.0168760678403997 i",
                "0.8497782949947773+0.1722870976144199 i",
            };

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