Maple: A Comprehensive Tool for Introductory ODEs

Douglas B. Meade

Department of Mathematics University of South Carolina Columbia, SC 29208

Phone:  (803) 777-6183

E-mail:  meade@math.sc.edu
WWW URL: http://www.math.sc.edu/˜ meade/

12 January 1996

Maple: Pro and Con

• Advantages

– one tool, many uses ∗ analytic computations

∗ numeric approximations

∗ graphical/visual representations

– skills applicable beyond ODEs

– wide availability at a reasonable cost ∗ variety of site licenses

∗ Student Version (Brooks/Cole, <$100)

Maple: Pro and Con

• Drawbacks – steep learning curve

– changes emphasis of course

– deterioration of manipulative skills

Minimal Hardware Requirements

Platform Operating System  Disk  RAM
Windows  Windows 3.1.1+ 14-21MB 4MB
Mac/PPC System 6.0.7+ 14-21MB 4MB
DOS  DOS 5.0+  14-21MB 4MB
Linux  Linux 1.0  30MB  8MB
UNIX  various  30MB  8MB
⋮  ⋮  ⋮  ⋮

Requirements for Maple V, Release 3. A full listing of platforms

and requirements is available on the WWW:

http://www.maplesoft.com/Products/MapleV/MapleAvail.html

Maple & Introduction to ODEs

• Analytical Methods – exact solutions: explicit and implicit

– solution techniques

– theory/structure of solutions

• Numerical Methods – examine convergence/approximation

– implement numerical methods (including systems)

– compute with complicated/realistic problems

• Graphical/Visual Representations – direction fields & phase portraits

– qualitative analysis

Picard Iterates and Maple

• Picard’s Method for \frac{dy}{dt} = f(t, y(t)), y(t_{0}) = y0 – Given ϕ_{0}

– Define, for all k = 0, 1, 2, …,

ϕ_{k+1}(t) = y_{0} + ∫_{t_{0}}^{t} f(x, ϕ_{k}(x)) dx.

• Maple implementation

> restart;
> with( DEtools ):
> with( plots ):
> picard := proc(f, init, phi)
> local t0, y0;
> t0 := init[1];
> y0 := init[2];
> unapply( y0 + int( f(x,phi(x)), x=t0..t ), t );
> end:

Picard Iterates: Example 1

Consider the initial value problem: \frac{dy}{dy} = −y, y(0) = 1 A first step is to visualize the solution to this problem

> DF := DEplot( diff(y(t),t)=-y(t), [t,y], t=0..5, {[0,1]},
>  y=0..1, arrows=THIN, title=`y'=-y, y(0)=1` ):
> display( DF );

Picard Iterates: Example 1

To use picard it is necessary to define:

• the RHS of the differential equation,

   > RHS := (t,y) -> -y;

RHS := ( t, y) → −y

• the initial condition,

   > IC := [ 0, 1 ];

IC := [ 0, 1 ]

• the initial guess,

   > phi[0] := t -> 0;

ϕ_{0} := 0

• and the number of iterations

   > N := 8;

N := 8

Picard Iterates: Example 1

Computation of the Picard iterates is easy to write in a loop

 > for k from 0 to N-1 do
 > phi[k+1] := picard( RHS, IC, phi[k] );
 > od;

ϕ_{1} := 1

ϕ_{2} := t → 1 − t

ϕ_{3} := t → 1 − t + \frac{1}{2} t^{2}

⋮

ϕ_{8} := t → 1 + \frac{1}{24} t^{4} + \frac{1}{2} t^{2} − \frac{1}{5040} t^{7} − \frac{1}{120} t^{5} + \frac{1}{720} t^{6} − \frac{1}{6} t^{3} − t

Picard Iterates: Example 1

Analysis is easier when terms are ordered

 > for k from 0 to N-1 do
 > phi[k+1] := picard( RHS, IC, phi[k] ):
 > print( sort( simplify( phi[k+1](t) ) ) );
 > od:

1

−t + 1

\frac{1}{2} t^{2} − t + 1

⋮

− \frac{1}{5040} t^{7} + \frac{1}{720} t^{6} − \frac{1}{120} t^{5} + \frac{1}{24} t^{4} − \frac{1}{6} t^{3} + \frac{1}{2} t^{2} − t + 1

Picard Iterates: Example 1

Convergence can be demonstrated graphically

> plot( { phi[i] $ i=0..N }, 0..2,
>  title=`Picard Iterates for y'=-y, y(0)=1` );

Picard Iterates: Example 1

• Discussion – this sequence should look familiar: ∑_{n=0}^{∞} \frac{(−t)^{n}}{n!}

– provides additional justification that the solution is y = e^{−t} – animating the iterates can also be effective

   > for k from 0 to N do
   > P[k]:=display([ DF, plot( phi[k],0..5,color=GREEN) ]);
   > od:
   > display( [ P[i] $ i=0..N ], insequence=true );

Picard Iterates: Example 2

Consider, now, the initial value problem: \frac{dy}{dt} = y^{2}, y(0) = \frac{1}{2}

> DF:=DEplot(diff(y(t),t)=y(t)^2, [t,y], t=0..2.2, {[0,1/2]},
>  y=0..10, arrows=THIN, title=`y'=y^2, y(0)=1/2` ):
> display( DF );

Picard Iterates: Example 2

Define the initial value problem and initial guess.

 > RHS := (t,y) -> y^2;

RHS := ( t, y) → y^{2}

 > IC := [ 0, 1/2 ];

IC := [0, \frac{1}{2}]

 > phi[0] := t -> 0;

ϕ_{0} := 0

 > N := 7;

N := 7

Picard Iterates: Example 2

Compute the first 7 iterates (last two omitted – 8 pages of output)

> for k from 0 to N-1 do
> phi[k+1] := picard( RHS, IC, phi[k] );
> print( sort( simplify( "(t) ) ) );
> od:

\frac{1}{2}

\frac{1}{4} t + \frac{1}{2}

\frac{1}{48} t^{3} + \frac{1}{8} t^{2} + \frac{1}{4} t + \frac{1}{2}

\frac{1}{16128} t^{7} + \frac{1}{1152} t^{6} + \frac{1}{192} t^{5} + \frac{1}{48} t^{4} + \frac{1}{16} t^{3} + \frac{1}{8} t^{2} + \frac{1}{4} t + \frac{1}{2} ; \frac{1}{3901685760} t^{15} + \frac{1}{130056192} t^{14} + \frac{1}{9289728} t^{13} + \frac{1}{1032192} t^{12} ; + \frac{5}{774144} t^{11} + \frac{11}{322560} t^{10} + \frac{43}{290304} t^{9} + \frac{71}{129024} t^{8} + \frac{29}{16128} t^{7} ; + \frac{1}{192} t^{6} + \frac{13}{960} t^{5} + \frac{1}{32} t^{4} + \frac{1}{16} t^{3} + \frac{1}{8} t^{2} + \frac{1}{4} t + \frac{1}{2}

15

Picard Iterates: Example 2

> plot( { phi[i] $ i=0..N }, 0..2.2,
>  title=`Picard Iterates for y'=y^2, y(0)=1/2` );

Picard Iterates: Example 2

• Discussion – Iterates converge to ∑_{n=0}^{∞} \frac{t^{n}}{2^{n+1}} = \frac{1}{2 − t} (for |t| < 2)

– Finite time “blow-up” is more clearly seen when the iterates are animated, and the exact solution is included in the plots

  > for k from 0 to N do
  > P[k]:=display([DF, plot(phi[k],0..2.2,color=GREEN)]);
  > od:
  > display( [ P[i] $ i=0..N ], insequence=true );

Picard Iterates: Concluding Comments

• symbolic, numerical, and graphical tools in Maple have been used to provide an interactive introduction to Picard iterates and their role in the existence theory for IVPs

• additional benefits that can be obtained from this discussion: – an early introduction to power series solutions

– rigorous discussion of existence/uniqueness theorem

– discussion of analogous ideas for systems of IVPs