From 3ee38d704c37f64859c7702390389183a0867b73 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Tue, 15 Dec 2015 04:42:31 +0300 Subject: [PATCH] fix calculus --- sympy/calculus/finite_diff.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sympy/calculus/finite_diff.py b/sympy/calculus/finite_diff.py index 0ebdd8f8a8..ff2d76f6f5 100644 --- a/sympy/calculus/finite_diff.py +++ b/sympy/calculus/finite_diff.py @@ -21,7 +21,7 @@ from sympy.core.compatibility import iterable, range -def finite_diff_weights(order, x_list, x0=S(0)): +def finite_diff_weights(order, x_list, x0=Integer(0)): """ Calculates the finite difference weights for an arbitrarily spaced one-dimensional grid (x_list) for derivatives at 'x0' @@ -42,7 +42,7 @@ def finite_diff_weights(order, x_list, x0=S(0)): nearest to farest from x0; see examples below. x0: Number or Symbol Root or value of the independent variable for which the finite - difference weights should be generated. Defaults to S(0). + difference weights should be generated. Defaults to Integer(0). Returns ======= @@ -86,7 +86,9 @@ def finite_diff_weights(order, x_list, x0=S(0)): >>> from sympy import Integer >>> from sympy.calculus import finite_diff_weights - >>> res = finite_diff_weights(1, [S(0), S(1), -S(1), S(2), -S(2)], 0)[1] + >>> res = finite_diff_weights(1, [Integer(0), Integer(1), + ... -Integer(1), Integer(2), + ... -Integer(2)], 0)[1] >>> res [[0, 0, 0, 0, 0], [-1, 1, 0, 0, 0], @@ -195,7 +197,7 @@ def finite_diff_weights(order, x_list, x0=S(0)): return delta -def apply_finite_diff(order, x_list, y_list, x0=S(0)): +def apply_finite_diff(order, x_list, y_list, x0=Integer(0)): """ Calculates the finite difference approximation of the derivative of requested order at x0 from points @@ -213,7 +215,7 @@ def apply_finite_diff(order, x_list, y_list, x0=S(0)): variable in x_list. x0: Number or Symbol At what value of the independent variable the derivative should be - evaluated. Defaults to S(0). + evaluated. Defaults to Integer(0). Returns =======