Contributing some first order ode routines



Over my summer break I have managed to work on my first order ode 
routines.  I have attached a brief description below.  I'd like to 
create a share/contrib/diffequations directory and put them there
to mature for a while.  Any objections.


========================== contrib_ode.usg ========================
-*- mode: Text;  -*-

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.  The code may be
integrated into MAXIMA at some stage.

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.  Each
solution can be: an explicit solution for the dependent variable; an
implicit solution for the dependent variable; or a parametric solution
in terms of variable %t.  %C is used to represent the constant in the
case of first order equations, and %K1 and %K2 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.  

(C1) eqn:x*'diff(y,x)^2-(1+x*y)*'diff(y,x)+y=0;

                           dy 2             dy
(D1)                    x (--)  - (x y + 1) -- + y = 0
                           dx               dx

(C2) contrib_ode(eqn,y,x);

                                                    x
(D2)                     [y = LOG(x) + %C, y = %C %E ]


(C3) method;

(D3)                                FACTOR

Nonlinear odes can have singular solutions without constants of
integration.

(C4) eqn:'diff(y,x)^2+x*'diff(y,x)-y=0;

                              dy 2     dy
(D4)                         (--)  + x -- - y = 0
                              dx       dx

(C5) contrib_ode(eqn,y,x);

                                                  2
                                        2        x
(D5)                      [y = %C x + %C , y = - --]
                                                 4
(C6) method;

(D6)                               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.

(C7) eqn:'diff(y,x)=(x+y)^2;

                                 dy          2
(D7)                             -- = (y + x)
                                 dx

(C8) contrib_ode(eqn,y,x);

(D8) [[x = %C - ATAN(SQRT(%T)), y = - x - SQRT(%T)],
      [x = ATAN(SQRT(%T)) + %C, y = SQRT(%T) - x]]

(C9) method;

(D9)                              lagrange


For first order ODEs contrib_ode calls ode2.  It then tries the
following methods: factorization, Clairault, Lagrange, Riccati and Lie
symmetry methods.

For second order ODEs contrib_ode calls ode2.  No other methods are
implemented yet.

Extensive debugging traces and messages are displayed if the command
put('contrib_ode,true,'verbose) is executed.


TO DO
=====

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.

* Work out how to return partial solutions, such as those obtained for
  Riccati equations.

* Add routines for Abel equations.

* 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.

TEST CASES
==========

The routines have been tested on a few hundred test cases from Murphy,
Kamke and Zwillinger.  These are included in the tests subdirectory.

* The Clairault routine ode1_clairault finds all known solutions,
  including singular soultions.  (This statement is asking for
  trouble).

* 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.


References
==========

[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