On Mon, Aug 25, 2008 at 5:56 AM, Jason Merrill <[EMAIL PROTECTED]> wrote: > > On Aug 25, 7:46 am, "Ondrej Certik" <[EMAIL PROTECTED]> wrote: >> On Mon, Aug 25, 2008 at 12:55 AM, Jason Merrill <[EMAIL PROTECTED]> wrote: >> >> > In hopes that it may be a useful reference during the current work on >> > symbolics, I wrote a toy Mathematica program for transforming a single >> > higher order ODE into a system of first order ODEs. Most of the free >> > numerical differential equation solvers I've seen want input in the >> > form y'[x] == f(y,x), so the purpose of a program like this is to take >> > more general input and turn it into something suitable for those >> > routines. > > <snip> > >> Thanks for doing this. It is indeed very useful, I always wondered how >> things like this are done in Mathematica. >> >> Any ideas how this could be nicely translated to Python? >> >> Ondrej > > I thought you were going to tell me that sympy already does this. I > believe I saw an example somewhere in the docs about matching > derivatives, but I couldn't immediately find it again. >
The new pynac code referred to elsewhere does this. See the example below: sage: from sage.symbolic.function import function sage: var('r,kappa', ns=1) (r, kappa) sage: psi = function('psi', 1)(r); psi psi(r) sage: g = 1/r^2*(2*r*psi.diff(r,1) + r^2*psi.diff(r,2)); g (2*psi(1,r)*r + psi(2,r)*r^2)*r^(-2) sage: g.expand() psi(2,r) + 2*psi(1,r)*r^(-1) sage: g.coeff(psi.diff(r,2)) 1 sage: g.coeff(psi.diff(r,1)) 2*r^(-1) --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---