Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix calculus
  • Loading branch information
skirpichev committed Dec 15, 2015
1 parent b55d4c7 commit 3ee38d7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sympy/calculus/finite_diff.py
Expand Up @@ -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'
Expand All @@ -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
=======
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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
Expand All @@ -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
=======
Expand Down

0 comments on commit 3ee38d7

Please sign in to comment.