From: Michael Orlitzky Date: Sun, 18 Nov 2012 01:33:45 +0000 (-0500) Subject: Add a few tests for the shifted Legendre polynomials. X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=99a1300976825fff1379f39c7acc0ad74586a078;p=sage.d.git Add a few tests for the shifted Legendre polynomials. --- diff --git a/mjo/orthogonal_polynomials.py b/mjo/orthogonal_polynomials.py index 3f6b227..edea32b 100644 --- a/mjo/orthogonal_polynomials.py +++ b/mjo/orthogonal_polynomials.py @@ -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')