On 07.04.2014 21:25, Björn Dahlgren wrote:
> h is Symbol('h') (and given how sympy cache works - yes it is global).
> I was unsure whether I should use this or force the user to pass at least
> one parameter.
> Maybe I should let it default to 1 instead of Symbol('h')? I'm starting to
> lean towards that
> the more I think of it..
>
I think one of those both variants (obligatory parameter or just 1) more
eligible then usage of global "h". And since finite differences concerns
the discretization theme then "1" is sufficient, I think. And "1"
convenient then obligatory parameter.
Also please add more examples (may be place tests from
"test_function.py" to the test_finite_diff.py files as it is created)
such as:
Second derivatives: f(x).diff(x, x)
Multivariables: f(x, y).diff(x, y)
And examples a few variants of schemes:
f(x).diff(x) ~ f(x+h)-f(x-h))/(2*h)
or
f(x).diff(x) ~ (f(x-2h) - 27f(x-h) + 27f(x+h) - f(x+2h))/24
Some of them to the doc string of "as_finite_diff" method.
--
Alexey Gudchenko