#14 - 17
The problem involves the following information
> MODEL := diff( v(t) , t ) = ( exp(-0.1*t) - v(t) ) / 0.2 ; # define the differential equation model
> DOMAIN:= t = 0 .. 10 ;
> Nsteps := 10; # this makes dt=1.0
> ptsEa := Euler( MODEL, v(0)=0, DOMAIN, Nsteps ); # with NSTEPS= 4, we have dt=1.0
> ptsEb := Euler( MODEL, v(0)=2, DOMAIN, Nsteps ); # with NSTEPS= 4, we have dt=1.0
> ptsEc := Euler( MODEL, v(0)=-2, DOMAIN, Nsteps ); # with NSTEPS= 4, we have dt=1.0
> ptsEd := Euler( MODEL, v(0)=4, DOMAIN, Nsteps ); # with NSTEPS= 4, we have dt=1.0
> plotE4 := plot( [ptsEa,ptsEb,ptsEc,ptsEd], color = [GREEN,CYAN,BLUE,RED], title="Nsteps=10" ):
> plotE4;
Note the scale of the vertical axis. These solutions all appear to be growing at a tremendous rate! To see if this is real, let's recompute the Euler results with more steps. Let's double Nsteps to 20, i.e., cut dt in half (to dt=0.5)
>
The magnitude is somewhat diminished but the solutions are still very rough (they should be smooth). Let's double Nsteps to 40 (i.e., dt=0.25).
>
This looks better but is still rather jagged at the beginning. Let's repeat with Nsteps=80 (dt=0.125).
>
This looks smooth. The point of this exercise was to find a reasonable number of steps to use in Euler's method.
>