Maxima Manual: 38. contrib_ode

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

# 38. contrib_ode

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 38.1 Introduction to contrib_ode

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:

- an explicit solution for the dependent variable,
- an implicit solution for the dependent variable,
- a parametric solution in terms of variable `%t`, or
- a tranformation into another ODE in variable `%u`.

`%c` is used to represent the constant of integration for first order equations. `%k1` and `%k2` are the constants for second order equations. 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 (--)  - (x y + 1) -- + y = 0
                        dx               dx
    (%i3) contrib_ode(eqn,y,x);
                                                 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);
                                               2
                                     2        x
    (%o3)              [y = %c x + %c , y = - --]
                                              4
    (%i4) method;
    (%o4)                       clairault

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)                     -- = (y + x)
                              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     n - 2   a     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, Clairault, 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.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 38.2 Functions and Variables for contrib_ode

Function: contrib_ode (eqn, y, x)

  Returns a list of solutions of the ODE eqn with independent variable x and dependent variable y.

Function: odelin (eqn, y, x)

  `odelin` solves linear homogeneous ODEs of first and second order with independent variable x and dependent variable y. It returns a fundamental solution set of the ODE.

  For second order ODEs, `odelin` uses a method, due to Bronstein and Lafaille, that searches for solutions in terms of given special functions.

      (%i1) load('contrib_ode);

      (%i2) odelin(x*(x+1)*'diff(y,x,2)+(x+5)*'diff(y,x,1)+(-4)*y,y,x);
      ...trying factor method
      ...solving 7 equations in 4 variables
      ...trying the Bessel solver
      ...solving 1 equations in 2 variables
      ...trying the F01 solver
      ...solving 1 equations in 3 variables
      ...trying the spherodial wave solver
      ...solving 1 equations in 4 variables
      ...trying the square root Bessel solver
      ...solving 1 equations in 2 variables
      ...trying the 2F1 solver
      ...solving 9 equations in 5 variables
             gauss_a(- 6, - 2, - 3, - x)  gauss_b(- 6, - 2, - 3, - x)
      (%o2) {---------------------------, ---------------------------}
                          4                            4
                         x                            x

Function: ode_check (eqn, soln)

  Returns the value of ODE eqn after substituting a possible solution soln. The value is equivalent to zero if soln is a solution of eqn.

      (%i1) load('contrib_ode)$
      (%i2) eqn:'diff(y,x,2)+(a*x+b)*y;

                               2
                              d y
      (%o2)                   --- + (a x + b) y
                                2
                              dx
      (%i3) ans:[y = bessel_y(1/3,2*(a*x+b)^(3/2)/(3*a))*%k2*sqrt(a*x+b)
               +bessel_j(1/3,2*(a*x+b)^(3/2)/(3*a))*%k1*sqrt(a*x+b)];

                                        3/2
                          1  2 (a x + b)
      (%o3) [y = bessel_y(-, --------------) %k2 sqrt(a x + b)
                          3       3 a
                                                3/2
                                  1  2 (a x + b)
                       + bessel_j(-, --------------) %k1 sqrt(a x + b)]
                                  3       3 a
      (%i4) ode_check(eqn,ans[1]);
      (%o4)                           0

System variable: method

  The variable `method` is set to the successful solution method.

Variable: %c

  `%c` is the integration constant for first order ODEs.

Variable: %k1

  `%k1` is the first integration constant for second order ODEs.

Variable: %k2

  `%k2` is the second integration constant for second order ODEs.

Function: gauss_a (a, b, c, x)

  `gauss_a(a,b,c,x)` and `gauss_b(a,b,c,x)` are 2F1 geometric functions. They represent any two independent solutions of the hypergeometric differential equation `x(1-x) diff(y,x,2) + [c-(a+b+1)x diff(y,x) - aby = 0` (A&S 15.5.1).

  The only use of these functions is in solutions of ODEs returned by `odelin` and `contrib_ode`. The definition and use of these functions may change in future releases of Maxima.

  See also `gauss_b`, `dgauss_a` and `gauss_b`.

Function: gauss_b (a, b, c, x)

  See `gauss_a`.

Function: dgauss_a (a, b, c, x)

  The derivative with respect to x of `gauss_a(a, b, c, x)`.

Function: dgauss_b (a, b, c, x)

  The derivative with respect to x of `gauss_b(a, b, c, x)`.

Function: kummer_m (a, b, x)

  Kummer's M function, as defined in Abramowitz and Stegun, Handbook of Mathematical Functions, Section 13.1.2.

  The only use of this function is in solutions of ODEs returned by `odelin` and `contrib_ode`. The definition and use of this function may change in future releases of Maxima.

  See also `kummer_u`, `dkummer_m` and `dkummer_u`.

Function: kummer_u (a, b, x)

  Kummer's U function, as defined in Abramowitz and Stegun, Handbook of Mathematical Functions, Section 13.1.3.

  See `kummer_m`.

Function: dkummer_m (a, b, x)

  The derivative with respect to x of `kummer_m(a, b, x)`.

Function: dkummer_u (a, b, x)

  The derivative with respect to x of `kummer_u(a, b, x)`.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 38.3 Possible improvements to contrib_ode

These routines are work in progress. I still need to:

- Extend the FACTOR method `ode1_factor` to work for multiple roots.
- Extend the FACTOR method `ode1_factor` to attempt to solve higher order factors. At present it only attemps to solve linear factors.
- Fix the LAGRANGE routine `ode1_lagrange` to prefer real roots over complex roots.
- Add additional methods for Riccati equations.
- Improve the detection of Abel equations of second kind. The exisiting pattern matching is weak.
- Work on the Lie symmetry group routine `ode1_lie`. There are quite a few problems with it: some parts are unimplemented; some test cases seem to run forever; other test cases crash; yet others return very complex "solutions". I wonder if it really ready for release yet.
- Add more test cases.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 38.4 Test cases for contrib_ode

The routines have been tested on a approximately one thousand test cases from Murphy, Kamke, Zwillinger and elsewhere. These are included in the tests subdirectory.

- The Clairault routine `ode1_clairault` finds all known solutions, including singular solutions, of the Clairault equations in Murphy and Kamke.
- The other routines often return a single solution when multiple solutions exist.
- Some of the "solutions" from `ode1_lie` are overly complex and impossible to check.
- There are some crashes.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 38.5 References for contrib_ode

1. E. Kamke, Differentialgleichungen Losungsmethoden und Losungen, Vol 1, Geest & Portig, Leipzig, 1961
2. G. M. Murphy, Ordinary Differential Equations and Their Solutions, Van Nostrand, New York, 1960
3. D. Zwillinger, Handbook of Differential Equations, 3rd edition, Academic Press, 1998
4. F. Schwarz, Symmetry Analysis of Abel's Equation, Studies in Applied Mathematics, 100:269-294 (1998)
5. F. Schwarz, Algorithmic Solution of Abel's Equation, Computing 61, 39-49 (1998)
6. E. S. Cheb-Terrab, A. D. Roche, Symmetries and First Order ODE Patterns, Computer Physics Communications 113 (1998), p 239.
   (http://lie.uwaterloo.ca/papers/ode_vii.pdf)
7. E. S. Cheb-Terrab, T. Kolokolnikov, First Order ODEs, Symmetries and Linear Transformations, European Journal of Applied Mathematics, Vol. 14, No. 2, pp. 231-246 (2003).
   (http://arxiv.org/abs/math-ph/0007023, http://lie.uwaterloo.ca/papers/ode_iv.pdf)
8. G. W. Bluman, S. C. Anco, Symmetry and Integration Methods for Differential Equations, Springer, (2002)
9. M. Bronstein, S. Lafaille, Solutions of linear ordinary differential equations in terms of special functions, Proceedings of ISSAC 2002, Lille, ACM Press, 23-28.

[ << ] | [ >> ] |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by Robert Dodier on Dezember, 29 2019 using texi2html 1.76.