MutliVariable symbolic finite differences

42 views
Skip to first unread message

Mathias Louboutin

unread,
Mar 16, 2016, 12:20:08 PM3/16/16
to sympy
Hi

I am working on PDE's and I am trying to get the symbolic expression for multivariabe finite differences

mainly I wan the expression for d/dx(d/dy f), however

d2pdxdy=as_finite_diff(p(x,y,z,t).diff(x,y),[x,x-h,y,y+h])

doesn't work, nor any possible combination. Is this just not implemented or am I doing it wrong.

cheers

mathias

Aaron Meurer

unread,
Mar 16, 2016, 5:09:53 PM3/16/16
to sy...@googlegroups.com
What is the answer that you would expect to get?

Aaron Meurer
> --
> 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+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/72063849-9fa3-471f-87e4-e5a3b8717255%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Message has been deleted

Mathias Louboutin

unread,
Mar 17, 2016, 7:07:37 AM3/17/16
to sympy
In this example case it would give 

.25 * ( p(x,y+h,z,t) - p(x,y,z,t) + p(x-h,y,z,t) - p(x-y,y+h,z,t) ) /h^2

But more generally I would want to be able to take the result of as_finite_diff as a new expression I can differentiate :

a = as_finite_diff ( f(.....).diff(x) )

b= as_finite_diff( a.diff(y) )

....... And so on

Aaron Meurer

unread,
Mar 18, 2016, 1:10:54 PM3/18/16
to sy...@googlegroups.com
As far as I can tell, the function only supports finite differences of
one variable at a time. My guess is that it wouldn't be too hard to
extend it to do what you want, though.

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/1dafdef7-9a13-4219-a3dc-1c98c45b6c7f%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages