From 99a1300976825fff1379f39c7acc0ad74586a078 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 17 Nov 2012 20:33:45 -0500 Subject: [PATCH] Add a few tests for the shifted Legendre polynomials. --- mjo/orthogonal_polynomials.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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') -- 2.44.2