Ejemplo n.º 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);
     }
 }
Ejemplo n.º 2
0
        public void JacobiArccnComplexArgTest()
        {
            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[]
            {
                .8287247467,
                .9546547975,
                .4158803949,
                .7991371682,
                .2226334592,
            };

            var ans = new[] {
                "0.9999353004739177-0.0000249497100713 i",
                "0.9998120824513089+0.0004018967006233 i",
                "-0.2620696287961345-0.3671429875904256 i",
                "0.2003469806496059+0.0828329851756354 i",
                "0.6050679400137476-0.2419659452739375 i",
            };

            for (int i = 0; i < z.Length; i++)
            {
                var cn    = Parse(ans[i]);
                var arccn = Jacobi.arccn(cn, m[i]);
                var ex    = z[i];
                Assert.IsTrue(Complex.Abs(arccn - ex) < 1e-13);
                var f  = Jacobi.arccnComplex(m[i]);
                var a2 = f(cn);
                Assert.AreEqual(arccn, a2);
            }
        }