# # Numerical dsolve is used with Euler's method. The numeric solutions # are graphed and compared with the analytic solution. # # Maple Worksheet written by Denise Kirschner # > with(DEtools): with(plots): -------------------------------------------------------------------------------- # > p1:=DEplot(diff(y(x),x)=3*y(x)+1,[x,y],0..0.5,{[0,.1]},stepsize=.1,method=`Euler`,thickness=1): -------------------------------------------------------------------------------- # > p2:=DEplot(diff(y(x),x)=3*y(x)+1,[x,y],0..0.5,{[0,.1]},stepsize=.05,method=`Euler`,thickness=2): -------------------------------------------------------------------------------- > p3:=DEplot(diff(y(x),x)=3*y(x)+1,[x,y],0..0.5,{[0,.1]},stepsize=.01,method=`Euler`,thickness=3): # > diffeq1:=diff(y(x),x)=3*y(x)+1; inits:=y(0)=.1; d diffeq1 := ---- y(x) = 3 y(x) + 1 dx inits := y(0) = .1 > sol1:=dsolve({diffeq1,inits},y(x)); sol1 := y(x) = - 1/3 + .4333333333 exp(3 x) > p4:=plot(rhs(sol1),x=0..0.4): > > display([p1,p2,p3,p4]); # HERE IS THE SAME PROBLEM SOLVED WITH IMPROVED EULER: -------------------------------------------------------------------------------- # > p5:=DEplot(diff(y(x),x)=3*y(x)+1,[x,y],0..0.5,{[0,.1]},stepsize=.1,method=`impeuler`,thickness=1): -------------------------------------------------------------------------------- # > p6:=DEplot(diff(y(x),x)=3*y(x)+1,[x,y],0..0.5,{[0,.1]},stepsize=.05,method=`impeuler`,thickness=2): -------------------------------------------------------------------------------- > p7:=DEplot(diff(y(x),x)=3*y(x)+1,[x,y],0..0.5,{[0,.1]},stepsize=.01,method=`impeuler`,thickness=3): > display([p4,p5,p6,p7]); > ?DEtools[options]; -------------------------------------------------------------------------------- >