#4

The problem involves the following information

> MODEL := diff( y(t) , t ) = sin( y(t) ) ; # define the differential equation model

[Maple Math]

> IC := y(0) = 1; # specify the initial condition

[Maple Math]

> DOMAIN:= t = 0 .. 3 ;

[Maple Math]

> Nsteps := 6; # this makes dt=0.5

[Maple Math]

>

> ptsE := Euler( MODEL, IC, DOMAIN, Nsteps );

[Maple Math]

> convert( ptsE, matrix ); # these results look a little better displayed in 2 columns

[Maple Math]

> plotE := plot( ptsE, color = GREEN, thickness = 2 ):

> plotE;

>

> VAR := { y(t) }; # specify the variables in the model

[Maple Math]

> RANGE := y = -0.5*Pi .. 1.5*Pi ; # specify a reasonable interval for the dependent variable

[Maple Math]

> plotSLOPE := DEplot( MODEL, VAR, DOMAIN, RANGE, arrows = MEDIUM ):

> display( [ plotSLOPE, plotE ] );

Observe that the approximate solution starts out following the slope field but starts to cross the slope field towards the end of each segment of the plotted solution.

>

We can also compare the Euler approximation with the "true solution" (which is itself, if truth be told, only a better approximation).

> plotSOLN:= DEplot( MODEL, VAR, DOMAIN, RANGE, [ [IC] ], linecolor = BLUE, arrows = MEDIUM ):

> display( [plotE, plotSOLN] );

>