]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/orthogonal_polynomials.py: fix doctests.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 18 Feb 2019 14:00:45 +0000 (09:00 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 18 Feb 2019 14:00:45 +0000 (09:00 -0500)
mjo/orthogonal_polynomials.py

index 589aa80b63def36bc6503fbbea7dc18ab1f7c104..7544f65c048c72662ff72c40bbcb1197a98382a7 100644 (file)
@@ -1,7 +1,7 @@
 from sage.all import *
 
 def legendre_p(n, x, a = -1, b = 1):
-    """
+    r"""
     Returns the ``n``th Legendre polynomial of the first kind over the
     interval [a, b] with respect to ``x``.
 
@@ -72,15 +72,12 @@ def legendre_p(n, x, a = -1, b = 1):
         sage: a = -pi
         sage: b = pi
         sage: def inner_product(v1, v2):
-        ...       return integrate(v1*v2, x, a, b)
-        ...
+        ....:     return integrate(v1*v2, x, a, b)
         sage: def norm(v):
-        ...       return sqrt(inner_product(v,v))
-        ...
+        ....:     return sqrt(inner_product(v,v))
         sage: def project(basis, v):
-        ...       return sum( inner_product(v, b)*b/norm(b)**2
-        ...                   for b in basis)
-        ...
+        ....:     return sum( inner_product(v, b)*b/norm(b)**2
+        ....:                 for b in basis)
         sage: f = sin(x)
         sage: legendre_basis = [ legendre_p(k, x, a, b) for k in xrange(4) ]
         sage: proj = project(legendre_basis, f)