Next: Functions and Variables for contrib_ode, Previous: contrib_ode, Up: contrib_ode [Contents][Index]
Maxima’s ordinary differential equation (ODE) solver ode2
solves
elementary linear ODEs of first and second order. The function
contrib_ode
extends ode2
with additional methods for linear
and non-linear first order ODEs and linear homogeneous second order ODEs.
The code is still under development and the calling sequence may change
in future releases. Once the code has stabilized it may be
moved from the contrib directory and integrated into Maxima.
This package must be loaded with the command load("contrib_ode")
before use.
The calling convention for contrib_ode
is identical to ode2
.
It takes
three arguments: an ODE (only the left hand side need be given if the
right hand side is 0), the dependent variable, and the independent
variable. When successful, it returns a list of solutions.
The form of the solution differs from ode2
.
As non-linear equations can have multiple solutions,
contrib_ode
returns a list of solutions. Each solution can
have a number of forms:
%t
, or
%u
.
contrib_ode
uses the global variables %c
,
%k1
, %k2
, method
and yp
similarly to ode2
.
If contrib_ode
cannot obtain a solution for whatever reason, it returns false
, after
perhaps printing out an error message.
It is necessary to return a list of solutions, as even first order non-linear ODEs can have multiple solutions. For example:
(%i1) load("contrib_ode")$
(%i2) eqn:x*'diff(y,x)^2-(1+x*y)*'diff(y,x)+y=0; dy 2 dy (%o2) x (--) - (1 + x y) -- + y = 0 dx dx
(%i3) contrib_ode(eqn,y,x); dy 2 dy (%t3) x (--) - (1 + x y) -- + y = 0 dx dx first order equation not linear in y' x (%o3) [y = log(x) + %c, y = %c %e ]
(%i4) method; (%o4) factor
Nonlinear ODEs can have singular solutions without constants of integration, as in the second solution of the following example:
(%i1) load("contrib_ode")$
(%i2) eqn:'diff(y,x)^2+x*'diff(y,x)-y=0; dy 2 dy (%o2) (--) + x -- - y = 0 dx dx
(%i3) contrib_ode(eqn,y,x); dy 2 dy (%t3) (--) + x -- - y = 0 dx dx first order equation not linear in y' 2 2 x (%o3) [y = %c x + %c , y = - --] 4
(%i4) method; (%o4) clairaut
The following ODE has two parametric solutions in terms of the dummy
variable %t
. In this case the parametric solutions can be manipulated
to give explicit solutions.
(%i1) load("contrib_ode")$
(%i2) eqn:'diff(y,x)=(x+y)^2; dy 2 (%o2) -- = (x + y) dx
(%i3) contrib_ode(eqn,y,x); (%o3) [[x = %c - atan(sqrt(%t)), y = (- x) - sqrt(%t)], [x = atan(sqrt(%t)) + %c, y = sqrt(%t) - x]]
(%i4) method; (%o4) lagrange
The following example (Kamke 1.112) demonstrates an implicit solution.
(%i1) load("contrib_ode")$
(%i2) assume(x>0,y>0); (%o2) [x > 0, y > 0]
(%i3) eqn:x*'diff(y,x)-x*sqrt(y^2+x^2)-y; dy 2 2 (%o3) x -- - x sqrt(y + x ) - y dx
(%i4) contrib_ode(eqn,y,x); y (%o4) [x - asinh(-) = %c] x
(%i5) method; (%o5) lie
The following Riccati equation is transformed into a linear
second order ODE in the variable %u
. Maxima is unable to
solve the new ODE, so it is returned unevaluated.
(%i1) load("contrib_ode")$
(%i2) eqn:x^2*'diff(y,x)=a+b*x^n+c*x^2*y^2; 2 dy 2 2 n (%o2) x -- = c x y + b x + a dx
(%i3) contrib_ode(eqn,y,x); d%u --- 2 dx 2 a n - 2 d %u (%o3) [[y = - ----, %u c (-- + b x ) + ---- c = 0]] %u c 2 2 x dx
(%i4) method; (%o4) riccati
For first order ODEs contrib_ode
calls ode2
. It then tries the
following methods: factorization, Clairaut, Lagrange, Riccati,
Abel and Lie symmetry methods. The Lie method is not attempted
on Abel equations if the Abel method fails, but it is tried
if the Riccati method returns an unsolved second order ODE.
For second order ODEs contrib_ode
calls ode2
then odelin
.
Extensive debugging traces and messages are displayed if the command
put('contrib_ode,true,'verbose)
is executed.
Next: Functions and Variables for contrib_ode, Previous: contrib_ode, Up: contrib_ode [Contents][Index]