public void JacobiAmComplexTest() { var data = new[] { 1, 0, .7, 0.90554608446342, 0, .5, 0, .8, 0.48427327785248, 0, .5, .5, .5, 0.51828196329292, 0.47708333882708, 0, .5, .4, 0, 0.50881372387993, .7, -.7, .2, 0.71761686290329, -0.67315349672164, }; for (int i = 0; i < data.Length; i += 5) { var z = new Complex(data[i], data[i + 1]); var m = data[i + 2]; var ex = new Complex(data[i + 3], data[i + 4]); var am = Jacobi.am(z, m); var amf = Jacobi.amComplex(m); var am2 = amf(z); Assert.AreEqual(am, am2); var err = Complex.Abs(am - ex) / Complex.Abs(ex); Assert.IsTrue(err < 1e-14); } }