Comment #3 on issue 2180 by smi...@gmail.com: examples/advanced/relativity.py stopped working
http://code.google.com/p/sympy/issues/detail?id=2180

ode_order doesn't recognize it as 2nd order because the 2nd order term has an expr of

-lambda(r)

and ode_order doesn't expect that. After doit, it would become -D(lambda(r), r, r) and then be recognized. So the quick fix is to append ".doit()" to line 213 of relativity. The bigger question is whether dsolve should pre-process derivatives with doit:

eq = eq.subs(dict([(d, d.doit()) for d in eq.atoms(Derivative)])

There are lots of ways that derivatives could be written so ode_order will fail, e.g.

D(D(f(x), x) + f(x)/2, x) is order 2 but will come back as order 1.

ode_order, too, recurses "args of args" without specifying what type of expr is expected. I wonder if this should be

    for a in Add.make_args(expr):
     for m in Mul.make_args(a):
      etc..

and then an error raised if anything other than a simple power is encountered. Though such an expression as below is caught by dsolve, it would pass through ode_order as order 1:

    ode_order(D(f(x), x)**D(f(x), x), f(x)) -> 1

/c

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to