2 * Introduction to contrib_ode::
3 * Functions and Variables for contrib_ode::
4 * Possible improvements to contrib_ode::
5 * Test cases for contrib_ode::
6 * References for contrib_ode::
9 @node Introduction to contrib_ode, Functions and Variables for contrib_ode, Package contrib_ode, Package contrib_ode
11 @section Introduction to contrib_ode
13 Maxima's ordinary differential equation (ODE) solver @mref{ode2} solves
14 elementary linear ODEs of first and second order. The function
15 @mref{contrib_ode} extends @code{ode2} with additional methods for linear
16 and non-linear first order ODEs and linear homogeneous second order ODEs.
17 The code is still under development and the calling sequence may change
18 in future releases. Once the code has stabilized it may be
19 moved from the contrib directory and integrated into Maxima.
21 This package must be loaded with the command @code{load("contrib_ode")}
24 The calling convention for @code{contrib_ode} is identical to @code{ode2}.
26 three arguments: an ODE (only the left hand side need be given if the
27 right hand side is 0), the dependent variable, and the independent
28 variable. When successful, it returns a list of solutions.
30 The form of the solution differs from @code{ode2}.
31 As non-linear equations can have multiple solutions,
32 @code{contrib_ode} returns a list of solutions. Each solution can
33 have a number of forms:
36 an explicit solution for the dependent variable,
39 an implicit solution for the dependent variable,
42 a parametric solution in terms of variable @code{%t}, or
45 a transformation into another ODE in variable @code{%u}.
49 @code{contrib_ode} uses the global variables @mrefcomma{%c}
50 @mrefcomma{%k1} @mrefcomma{%k2} @mref{method} and @mref{yp}
51 similarly to @code{ode2}.
54 cannot obtain a solution for whatever reason, it returns @code{false}, after
55 perhaps printing out an error message.
57 It is necessary to return a list of solutions, as even first order
58 non-linear ODEs can have multiple solutions. For example:
61 @c load("contrib_ode")$
62 @c eqn:x*'diff(y,x)^2-(1+x*y)*'diff(y,x)+y=0;
63 @c contrib_ode(eqn,y,x);
67 (%i1) load("contrib_ode")$
69 (%i2) eqn:x*'diff(y,x)^2-(1+x*y)*'diff(y,x)+y=0;
71 (%o2) x (--) - (1 + x y) -- + y = 0
75 (%i3) contrib_ode(eqn,y,x);
77 (%t3) x (--) - (1 + x y) -- + y = 0
80 first order equation not linear in y'
83 (%o3) [y = log(x) + %c, y = %c %e ]
91 Nonlinear ODEs can have singular solutions without constants of
92 integration, as in the second solution of the following example:
95 @c load("contrib_ode")$
96 @c eqn:'diff(y,x)^2+x*'diff(y,x)-y=0;
97 @c contrib_ode(eqn,y,x);
101 (%i1) load("contrib_ode")$
103 (%i2) eqn:'diff(y,x)^2+x*'diff(y,x)-y=0;
105 (%o2) (--) + x -- - y = 0
108 (%i3) contrib_ode(eqn,y,x);
110 (%t3) (--) + x -- - y = 0
113 first order equation not linear in y'
117 (%o3) [y = %c x + %c , y = - --]
126 The following ODE has two parametric solutions in terms of the dummy
127 variable @code{%t}. In this case the parametric solutions can be manipulated
128 to give explicit solutions.
131 @c load("contrib_ode")$
132 @c eqn:'diff(y,x)=(x+y)^2;
133 @c contrib_ode(eqn,y,x);
137 (%i1) load("contrib_ode")$
139 (%i2) eqn:'diff(y,x)=(x+y)^2;
145 (%i3) contrib_ode(eqn,y,x);
146 (%o3) [[x = %c - atan(sqrt(%t)), y = (- x) - sqrt(%t)],
147 [x = atan(sqrt(%t)) + %c, y = sqrt(%t) - x]]
155 The following example (Kamke 1.112) demonstrates an implicit solution.
158 @c load("contrib_ode")$
160 @c eqn:x*'diff(y,x)-x*sqrt(y^2+x^2)-y;
161 @c contrib_ode(eqn,y,x);
165 (%i1) load("contrib_ode")$
167 (%i2) assume(x>0,y>0);
171 (%i3) eqn:x*'diff(y,x)-x*sqrt(y^2+x^2)-y;
173 (%o3) x -- - x sqrt(y + x ) - y
177 (%i4) contrib_ode(eqn,y,x);
179 (%o4) [x - asinh(-) = %c]
190 The following Riccati equation is transformed into a linear
191 second order ODE in the variable @code{%u}. Maxima is unable to
192 solve the new ODE, so it is returned unevaluated.
194 @c load("contrib_ode")$
195 @c eqn:x^2*'diff(y,x)=a+b*x^n+c*x^2*y^2;
196 @c contrib_ode(eqn,y,x);
200 (%i1) load("contrib_ode")$
202 (%i2) eqn:x^2*'diff(y,x)=a+b*x^n+c*x^2*y^2;
204 (%o2) x -- = c x y + b x + a
208 (%i3) contrib_ode(eqn,y,x);
212 (%o3) [[y = - ----, %u c (-- + b x ) + ---- c = 0]]
223 For first order ODEs @code{contrib_ode} calls @code{ode2}. It then tries the
224 following methods: factorization, Clairaut, Lagrange, Riccati,
225 Abel and Lie symmetry methods. The Lie method is not attempted
226 on Abel equations if the Abel method fails, but it is tried
227 if the Riccati method returns an unsolved second order ODE.
229 For second order ODEs @code{contrib_ode} calls @code{ode2} then @mref{odelin}.
231 Extensive debugging traces and messages are displayed if the command
232 @code{put('contrib_ode,true,'verbose)} is executed.
234 @opencatbox{Categories:}
235 @category{Differential equations}
236 @category{Share packages}
237 @category{Package contrib_ode}
241 @node Functions and Variables for contrib_ode, Possible improvements to contrib_ode, Introduction to contrib_ode, Package contrib_ode
242 @section Functions and Variables for contrib_ode
245 @deffn {Function} contrib_ode (@var{eqn}, @var{y}, @var{x})
247 Returns a list of solutions of the ODE @var{eqn} with
248 independent variable @var{x} and dependent variable @var{y}.
251 @opencatbox{Categories:}
252 @category{Package contrib_ode}
258 @deffn {Function} odelin (@var{eqn}, @var{y}, @var{x})
260 @code{odelin} solves linear homogeneous ODEs of first and
262 independent variable @var{x} and dependent variable @var{y}.
263 It returns a fundamental solution set of the ODE.
265 For second order ODEs, @code{odelin} uses a method, due to Bronstein
266 and Lafaille, that searches for solutions in terms of given
270 @c load("contrib_ode")$
271 @c odelin(x*(x+1)*'diff(y,x,2)+(x+5)*'diff(y,x,1)+(-4)*y,y,x);
274 (%i1) load("contrib_ode")$
276 (%i2) odelin(x*(x+1)*'diff(y,x,2)+(x+5)*'diff(y,x,1)+(-4)*y,y,x);
277 gauss_a(- 6, - 2, - 3, - x) gauss_b(- 6, - 2, - 3, - x)
278 (%o2) @{---------------------------, ---------------------------@}
284 @opencatbox{Categories:}
285 @category{Package contrib_ode}
291 @deffn {Function} ode_check (@var{eqn}, @var{soln})
293 Returns the value of ODE @var{eqn} after substituting a
294 possible solution @var{soln}. The value is equivalent to
295 zero if @var{soln} is a solution of @var{eqn}.
298 @c load("contrib_ode")$
299 @c eqn:'diff(y,x,2)+(a*x+b)*y;
300 @c ans:[y = bessel_y(1/3,2*(a*x+b)^(3/2)/(3*a))*%k2*sqrt(a*x+b)
301 @c +bessel_j(1/3,2*(a*x+b)^(3/2)/(3*a))*%k1*sqrt(a*x+b)];
302 @c ode_check(eqn,ans[1]);
305 (%i1) load("contrib_ode")$
307 (%i2) eqn:'diff(y,x,2)+(a*x+b)*y;
310 (%o2) --- + (b + a x) y
314 (%i3) ans:[y = bessel_y(1/3,2*(a*x+b)^(3/2)/(3*a))*%k2*sqrt(a*x+b)
315 +bessel_j(1/3,2*(a*x+b)^(3/2)/(3*a))*%k1*sqrt(a*x+b)];
318 (%o3) [y = bessel_y(-, --------------) %k2 sqrt(a x + b)
322 + bessel_j(-, --------------) %k1 sqrt(a x + b)]
325 (%i4) ode_check(eqn,ans[1]);
330 @opencatbox{Categories:}
331 @category{Package contrib_ode}
338 @deffn {Function} gauss_a (@var{a}, @var{b}, @var{c}, @var{x})
340 @code{gauss_a(a,b,c,x)} and @code{gauss_b(a,b,c,x)} are 2F1
341 hypergeometric functions. They represent any two independent
342 solutions of the hypergeometric differential equation
343 @code{x*(1-x) diff(y,x,2) + [c-(a+b+1)x] diff(y,x) - a*b*y = 0} (A&S 15.5.1).
345 The only use of these functions is in solutions of ODEs returned by
346 @mref{odelin} and @mref{contrib_ode}. The definition and use of these
347 functions may change in future releases of Maxima.
349 See also @mrefcomma{gauss_b} @mref{dgauss_a} and @mrefdot{gauss_b}
351 @opencatbox{Categories:}
352 @category{Package contrib_ode}
358 @deffn {Function} gauss_b (@var{a}, @var{b}, @var{c}, @var{x})
359 See @mrefdot{gauss_a}
361 @opencatbox{Categories:}
362 @category{Package contrib_ode}
368 @deffn {Function} dgauss_a (@var{a}, @var{b}, @var{c}, @var{x})
369 The derivative with respect to @var{x}
370 of @mref{gauss_a}@code{(@var{a}, @var{b}, @var{c}, @var{x})}.
372 @opencatbox{Categories:}
373 @category{Package contrib_ode}
379 @deffn {Function} dgauss_b (@var{a}, @var{b}, @var{c}, @var{x})
380 The derivative with respect to @var{x}
381 of @mref{gauss_b}@code{(@var{a}, @var{b}, @var{c}, @var{x})}.
383 @opencatbox{Categories:}
384 @category{Package contrib_ode}
391 @deffn {Function} kummer_m (@var{a}, @var{b}, @var{x})
393 Kummer's M function, as defined in Abramowitz and Stegun,
394 @i{Handbook of Mathematical Functions}, Section 13.1.2.
396 The only use of this function is in solutions of ODEs returned by
397 @mref{odelin} and @mref{contrib_ode}. The definition and use of this
398 function may change in future releases of Maxima.
400 See also @mrefcomma{kummer_u} @mrefcomma{dkummer_m} and @mrefdot{dkummer_u}
402 @opencatbox{Categories:}
403 @category{Package contrib_ode}
409 @deffn {Function} kummer_u (@var{a}, @var{b}, @var{x})
411 Kummer's U function, as defined in Abramowitz and Stegun,
412 @i{Handbook of Mathematical Functions}, Section 13.1.3.
414 See @mrefdot{kummer_m}
416 @opencatbox{Categories:}
417 @category{Package contrib_ode}
423 @deffn {Function} dkummer_m (@var{a}, @var{b}, @var{x})
424 The derivative with respect to @var{x}
425 of @mref{kummer_m}@code{(@var{a}, @var{b}, @var{x})}.
427 @opencatbox{Categories:}
428 @category{Package contrib_ode}
434 @deffn {Function} dkummer_u (@var{a}, @var{b}, @var{x})
435 The derivative with respect to @var{x}
436 of @mref{kummer_u}@code{(@var{a}, @var{b}, @var{x})}.
438 @opencatbox{Categories:}
439 @category{Package contrib_ode}
444 @anchor{bessel_simplify}
445 @deffn {Function} bessel_simplify (@var{expr})
446 Simplifies expressions containing Bessel functions @mrefcomma{bessel_j}
447 @mrefcomma{bessel_y} @mrefcomma{bessel_i} @mrefcomma{bessel_k}
448 @mrefcomma{hankel_1} @mrefcomma{hankel_2} @mref{struve_h}
449 and @mrefdot{struve_l}
450 Recurrence relations (DLMF ยง10.6(i))(A&S 9.1.27)
451 are used to replace functions of highest order n
452 by functions of order n-1 and n-2.
454 This process is repeated until all the orders
455 differ by less than 2.
458 @c load("contrib_ode")$
459 @c bessel_simplify(4*bessel_j(n,x^2)*(x^2-n^2/x^2)
460 @c +x*((bessel_j(n-2,x^2)-bessel_j(n,x^2))*x
461 @c -(bessel_j(n,x^2)-bessel_j(n+2,x^2))*x)
462 @c -2*bessel_j(n+1,x^2)+2*bessel_j(n-1,x^2));
463 @c bessel_simplify( -2*bessel_j(1,z)*z^3 - 10*bessel_j(2,z)*z^2
464 @c + 15*%pi*bessel_j(1,z)*struve_h(3,z)*z - 15*%pi*struve_h(1,z)
465 @c *bessel_j(3,z)*z - 15*%pi*bessel_j(0,z)*struve_h(2,z)*z
466 @c + 15*%pi*struve_h(0,z)*bessel_j(2,z)*z - 30*%pi*bessel_j(1,z)
467 @c *struve_h(2,z) + 30*%pi*struve_h(1,z)*bessel_j(2,z));
470 (%i1) load("contrib_ode")$
472 (%i2) bessel_simplify(4*bessel_j(n,x^2)*(x^2-n^2/x^2)
473 +x*((bessel_j(n-2,x^2)-bessel_j(n,x^2))*x
474 -(bessel_j(n,x^2)-bessel_j(n+2,x^2))*x)
475 -2*bessel_j(n+1,x^2)+2*bessel_j(n-1,x^2));
479 (%i3) bessel_simplify( -2*bessel_j(1,z)*z^3 - 10*bessel_j(2,z)*z^2
480 + 15*%pi*bessel_j(1,z)*struve_h(3,z)*z - 15*%pi*struve_h(1,z)
481 *bessel_j(3,z)*z - 15*%pi*bessel_j(0,z)*struve_h(2,z)*z
482 + 15*%pi*struve_h(0,z)*bessel_j(2,z)*z - 30*%pi*bessel_j(1,z)
483 *struve_h(2,z) + 30*%pi*struve_h(1,z)*bessel_j(2,z));
488 @opencatbox{Categories:}
489 @category{Package contrib_ode}
490 @category{Bessel functions}
491 @category{Special functions}
496 @anchor{expintegral_e_simplify}
497 @deffn {Function} expintegral_e_simplify (@var{expr})
498 Simplify expressions containing exponential integral @mref{expintegral_e}
499 using the recurrence (A&S 5.1.14).
502 = (1/n) * (exp(-z)-z*expintegral_e(n,z)) n = 1,2,3 ....
504 @opencatbox{Categories:}
505 @category{Package contrib_ode}
506 @category{Exponential Integrals}
507 @category{Special functions}
513 @node Possible improvements to contrib_ode, Test cases for contrib_ode, Functions and Variables for contrib_ode, Package contrib_ode
514 @section Possible improvements to contrib_ode
517 These routines are work in progress. I still need to:
522 Extend the FACTOR method @code{ode1_factor} to work for multiple roots.
525 Extend the FACTOR method @code{ode1_factor} to attempt to solve higher
526 order factors. At present it only attempts to solve linear factors.
529 Fix the LAGRANGE routine @code{ode1_lagrange} to prefer real roots over
533 Add additional methods for Riccati equations.
536 Improve the detection of Abel equations of second kind. The existing
537 pattern matching is weak.
540 Work on the Lie symmetry group routine @code{ode1_lie}. There are quite a
541 few problems with it: some parts are unimplemented; some test cases
542 seem to run forever; other test cases crash; yet others return very
543 complex "solutions". I wonder if it really ready for release yet.
550 @node Test cases for contrib_ode, References for contrib_ode, Possible improvements to contrib_ode, Package contrib_ode
551 @section Test cases for contrib_ode
554 The routines have been tested on a approximately one thousand test cases
556 Kamke, Zwillinger and elsewhere. These are included in the tests subdirectory.
560 The Clairaut routine @code{ode1_clairaut} finds all known solutions,
561 including singular solutions, of the Clairaut equations in Murphy and
565 The other routines often return a single solution when multiple
569 Some of the "solutions" from @code{ode1_lie} are overly complex and
573 There are some crashes.
577 @node References for contrib_ode, ,Test cases for contrib_ode, Package contrib_ode
578 @section References for contrib_ode
583 E. Kamke, Differentialgleichungen L@"osungsmethoden und L@"osungen, Vol 1,
584 Geest & Portig, Leipzig, 1961
587 G. M. Murphy, Ordinary Differential Equations and Their Solutions,
588 Van Nostrand, New York, 1960
591 D. Zwillinger, Handbook of Differential Equations, 3rd edition,
595 F. Schwarz, Symmetry Analysis of Abel's Equation, Studies in
596 Applied Mathematics, 100:269-294 (1998)
599 F. Schwarz, Algorithmic Solution of Abel's Equation,
600 Computing 61, 39-49 (1998)
603 E. S. Cheb-Terrab, A. D. Roche, Symmetries and First Order
604 ODE Patterns, Computer Physics Communications 113 (1998), p 239.
606 (@url{http://lie.uwaterloo.ca/papers/ode_vii.pdf})
609 E. S. Cheb-Terrab, T. Kolokolnikov, First Order ODEs,
610 Symmetries and Linear Transformations, European Journal of
611 Applied Mathematics, Vol. 14, No. 2, pp. 231-246 (2003).
613 (@url{http://arxiv.org/abs/math-ph/0007023},@*
614 @url{http://lie.uwaterloo.ca/papers/ode_iv.pdf})
618 G. W. Bluman, S. C. Anco, Symmetry and Integration Methods for
619 Differential Equations, Springer, (2002)
622 M. Bronstein, S. Lafaille,
623 Solutions of linear ordinary differential equations in terms
624 of special functions,
625 Proceedings of ISSAC 2002, Lille, ACM Press, 23-28.
626 (@url{http://www-sop.inria.fr/cafe/Manuel.Bronstein/publications/issac2002.pdf})