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
On Monday, 7 April 2014 19:04:38 UTC+2, pr...@goodok.ru wrote:
On 07.04.2014 19:34, Björn Dahlgren wrote:
After reading Aaron's recommendation about looking for unanswered sympy
questions at stackoverflow I stumbled upon:
http://stackoverflow.com/questions/18701290/derivatives-discretization-with-sympy
I implemented a solution for this and it is available as a WIP PR over
here:
https://github.com/sympy/sympy/pull/7382
I would love to hear your feedback on this.
Hi,
From the stackoverflow question here is your example:
> Here is an example:
>>> from sympy import symbols, Function
>>> x, h = symbols('x h')
>>> f = Function('f')
>>> print(f(x).diff(x).as_finite_diff())
-f(-h + x)/(2*h) + f(h + x)/(2*h)
Is it means that you use "h" symbol from the global namespace?
--
Alexey Gudchenko
Best regards
/Björn
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/5342E51B.50909%40goodok.ru.
For more options, visit https://groups.google.com/d/optout.