3 Driver routine for first order nonlinear ODE routines
6 Copyright (C) 2004 David Billinghurst
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 put('ode1_nonlinear,001,'version)$
25 if get('ode1_clairaut,'version)=false then
26 load("ode1_clairaut.mac")$
27 if get('ode1_lagrange,'version)=false then
28 load("ode1_lagrange.mac")$
29 if get('ode1_riccati,'version)=false then
30 load("ode1_riccati.mac")$
31 if get('ode1_lie,'version)=false then
33 if get('ode1_factor,'version)=false then
34 load("ode1_factor.mac")$
35 if get('ode1_abel,'version)=false then
36 load("ode1_abel.mac")$
39 ode1_nonlinear(de,y,x):=block(
42 ode_disp(" in ode1_nonlinear"),
44 ode_disp(" -> ode1_factor"),
45 q:ode1_factor(de,y,x),
46 if (is(q#false)) then return(q),
48 ode_disp(" -> ode1_clairaut"),
49 q:ode1_clairaut(de,y,x),
50 if (is(q#false)) then return(q),
52 ode_disp(" -> ode1_lagrange"),
53 q:ode1_lagrange(de,y,x),
54 if (is(q#false)) then return(q),
56 /* Sometimes ode1_lie() can solve Riccati equations
57 that are only partially solved by ode1_riccati() */
58 ode_disp(" -> ode1_riccati"),
59 q:ode1_riccati(de,y,x),
60 if (is(q#false)) then return( block(
61 if not(freeof(%u,q)) then (
62 q2:ode1_lie_wrapper(de,y,x),
63 if (is(q2#false)) then q:q2
68 ode_disp(" -> ode1_abel"),
70 /* Give up if return [] */
71 if (q=[]) then return(false),
72 if (is(q#false)) then return(q),
74 ode_disp(" -> ode1_lie"),
75 q:ode1_lie_wrapper(de,y,x),
76 if (is(q#false)) then return([q]),
81 /* Wrapper for ode1_lie() */
82 ode1_lie_wrapper(de,y,x) := block(
84 phi:solve(lhs(de)-rhs(de),'diff(y,x)),