From: Michael Orlitzky Date: Thu, 1 Nov 2018 19:10:20 +0000 (-0400) Subject: mjo/interpolation.py: allow tests to run with PYTHONPATH=".". X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=442ca575b029c244e7307b502b63d11611dc205b;p=sage.d.git mjo/interpolation.py: allow tests to run with PYTHONPATH=".". --- diff --git a/mjo/interpolation.py b/mjo/interpolation.py index 4be95e2..dc06107 100644 --- a/mjo/interpolation.py +++ b/mjo/interpolation.py @@ -44,6 +44,10 @@ def lagrange_coefficient(k, x, xs): A symbolic expression of one variable. + SETUP:: + + sage: from mjo.interpolation import lagrange_coefficient + TESTS:: sage: xs = [ -pi/2, -pi/6, 0, pi/6, pi/2 ] @@ -75,6 +79,10 @@ def lagrange_polynomial(x, xs, ys): A symbolic expression (polynomial) interpolating each (xs[k], ys[k]). + SETUP:: + + sage: from mjo.interpolation import lagrange_polynomial + TESTS:: sage: xs = [ -pi/2, -pi/6, 0, pi/6, pi/2 ] @@ -111,6 +119,10 @@ def lagrange_interpolate(f, x, xs): A polynomial in ``x`` which interpolates ``f`` at ``xs``. + SETUP:: + + sage: from mjo.interpolation import lagrange_interpolate + EXAMPLES: We're exact on polynomials of degree `n` if we use `n+1` points:: @@ -135,7 +147,11 @@ def divided_difference_coefficients(xs): Assuming some function `f`, compute the coefficients of the divided difference f[xs[0], ..., xs[n]]. - TESTS: + SETUP:: + + sage: from mjo.interpolation import divided_difference_coefficients + + TESTS:: sage: divided_difference_coefficients([0]) [1] @@ -166,6 +182,10 @@ def divided_difference(xs, ys): The (possibly symbolic) divided difference function. + SETUP:: + + sage: from mjo.interpolation import divided_difference + TESTS:: sage: xs = [0] @@ -215,7 +235,11 @@ def newton_polynomial(x, xs, ys): A symbolic expression. - TESTS: + SETUP:: + + sage: from mjo.interpolation import lagrange_polynomial, newton_polynomial + + TESTS:: sage: xs = [ -pi/2, -pi/6, 0, pi/6, pi/2 ] sage: ys = map(sin, xs) @@ -304,7 +328,11 @@ def hermite_interpolant(x, xs, ys, y_primes): A symbolic expression. - TESTS: + SETUP:: + + sage: from mjo.interpolation import hermite_interpolant + + TESTS:: sage: xs = [ 0, pi/6, pi/2 ] sage: ys = map(sin, xs)