示例#1
0
 public void JacobiArcDoubleTest()
 {
     for (int i = 0; i < jacobiData.Length; i += 5)
     {
         var z   = jacobiData[i];
         var m   = jacobiData[i + 1];
         var cn  = jacobiData[i + 2];
         var sn  = jacobiData[i + 3];
         var arc = Jacobi.arccn(cn, m);
         Assert.IsTrue(Math.Abs(arc - Math.Abs(z)) < 1e-14);
         arc = Jacobi.arcsn(sn, m);
         Assert.IsTrue(Math.Abs(arc - z) < 1e-14);
         var f = Jacobi.arccnDouble(m);
         arc = f(cn);
         Assert.IsTrue(Math.Abs(arc - Math.Abs(z)) < 1e-14);
         f   = Jacobi.arcsnDouble(m);
         arc = f(sn);
         Assert.IsTrue(Math.Abs(arc - z) < 1e-14);
     }
 }
示例#2
0
        public void JacobiArcsnComplexArgTest()
        {
            var z = new[]
            {
                new Complex(0.0115779438837883, 0.00215513498962569),
                new Complex(0.0251305156397967, -0.0159972042786677),
                new Complex(1.4511560737138, -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    = Parse(ans[i]);
                var arcsn = Jacobi.arcsn(sn, m[i]);
                var ex    = z[i];
                Assert.IsTrue(Complex.Abs(arcsn - ex) < 1e-14);
                var f  = Jacobi.arcsnComplex(m[i]);
                var a2 = f(sn);
                Assert.AreEqual(arcsn, a2);
            }
        }