]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
Add a few tests for the shifted Legendre polynomials.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 18 Nov 2012 01:33:45 +0000 (20:33 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 18 Nov 2012 01:33:45 +0000 (20:33 -0500)
mjo/orthogonal_polynomials.py

index 3f6b227fb5b660f41de61f10ad2f2edb9542f1e8..edea32bf7a0788b7574f3dd9c7f7298e395fff1b 100644 (file)
@@ -66,6 +66,21 @@ def legendre_p(n, x, a = -1, b = 1):
         sage: integrate(Pj*Pk, x, a, b) # abs tol 1e-12
         0
 
+    The first few polynomials shifted to [0,1] are known to be::
+
+        sage: p0 = 1
+        sage: p1 = 2*x - 1
+        sage: p2 = 6*x^2 - 6*x + 1
+        sage: p3 = 20*x^3 - 30*x^2 + 12*x - 1
+        sage: bool(legendre_p(0, x, 0, 1) == p0)
+        True
+        sage: bool(legendre_p(1, x, 0, 1) == p1)
+        True
+        sage: bool(legendre_p(2, x, 0, 1) == p2)
+        True
+        sage: bool(legendre_p(3, x, 0, 1) == p3)
+        True
+
     """
     if not n in ZZ:
         raise TypeError('n must be a natural number')