Opened 5 years ago

Last modified 5 years ago

#17739 new enhancement

enhance desolve output from separable ODEs

Reported by: rws Owned by:
Priority: major Milestone: sage-6.5
Component: calculus Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Not yet reported upstream; Will do shortly. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

At the moment, desolve behaves like this even with trivial separable ODEs:

sage: t = var('t')
sage: y=function('y')(t)
sage: desolve(diff(y,t)-y^2,y)
-1/y(t) == _C + t
sage: desolve(diff(y,t)-y^2+y,y)
log(y(t) - 1) - log(y(t)) == _C + t
sage: desolve(diff(y,t)-y^2-1,y)
arctan(y(t)) == _C + t

They could be solved by substituting a variable for y(t) and calling solve. Only if there is no solution from solve the integrated equation should be given.

Change History (5)

comment:1 Changed 5 years ago by rws

This would yield (doctest):

sage: t = var('t')
sage: y=function('y')(t)
sage: desolve(diff(y,t)-y^2,y)
-1/(_C + t)
sage: desolve(diff(y,t)-y^2+y,y)
-1/(e^(_C + t) - 1)
sage: desolve(diff(y,t)-y^2-1,y)
tan(_C + t)

comment:2 Changed 5 years ago by rws

Do we resolve this in Sage, Maxima, or both?

comment:3 follow-up: Changed 5 years ago by kcrisman

  • Report Upstream changed from N/A to Not yet reported upstream; Will do shortly.

You should report this upstream, but maybe first to the email list, not as a bug. Surely there must be a reason they report the solutions that way ... right? (For instance, maybe this is "more correct" than something with solve that might lose a solution or something. Though it's hard to see how that could happen in your first example!)

comment:4 in reply to: ↑ 3 Changed 5 years ago by rws

Replying to kcrisman:

You should report this upstream, but maybe first to the email list, not as a bug. Surely there must be a reason they report the solutions that way ... right?

It appears not, see http://sourceforge.net/p/maxima/mailman/message/33364512/

comment:5 Changed 5 years ago by rws

So, the inconsistency is in Sage, which removes 'y==' from the results that have it, perhaps to facilitate further usage of the expression.

    if is_SymbolicEquation(soln) and soln.lhs() == dvar:
        # Remark: Here we do not check that the right hand side does not depend on dvar.
        # This probably will not hapen for soutions obtained via ode2, anyway.
        soln = soln.rhs()

We could now either remove the snippet, in order to always get an equation, or always try to solve for dvar and return an equation only when no solution is found.

Note: See TracTickets for help on using tickets.