## MAPLE 7 ODE commands - Quick Reference Guide - # some material is from Waterloo MAPLE's "Differential Equations.html" and other sources OM, 01/03 #----------------------------------------------------- # COMMAND # EXPLANATION #----------------------------------------------------- > with(DEtools): # load package DEtools > de1 := diff(x(t),t) = 3*x(t)*(1-x(t)/300); # assign a differential equation to a name > DEplot(de1,x(t),t=0..3,x=0..400); # slope field plot of "de1" > DEplot(de1,x(t),t=0..3,x=0..400,[[x(0)=50]]); # slope field plot + solution through (0,50) > DEplot(de1,x(t),t=0..3, # plot several solutions together [[x(0)=5.*k] $k =1..20],x=0..400, color=blue,linecolor=green,arrows=MEDIUM); > des := [diff(x(t),t)=4-y(t),diff(y(t),t)=x(t)-4]; # an autonomous system of diff. eqns. > DEplot(des,[x(t),y(t)],t= 0..25,[[x(0)=0,y(0)=0]], # plot a solution (x(t),y(t)) stepsize=.05, arrows = medium, color = coral, linecolor= blue,method=classical[foreuler]); > de := diff(y(t),t,t)+diff(y(t),t)^2=0; # a nonlinear ODE > dsolve( {de}, y(t)); # solution > dsolve( {de,y(1)=2,D(y)(1)=3}, y(t)); # solution to initial value problem > ans := dsolve( {de}, y(t), type=series); # series solution > ans := dsolve( {de, y(1)=2, # series solution to ivp D(y)(1)=3}, y(t), type=series); > Order := 3; # set number of terms in series soln > de1:=diff(y(t),t)=-x(t); > de2:=diff(x(t),t)=y(t); > dsolve( {de1,de2,x(0)=A,y(0)=B}, # series solution of a system {x(t),y(t)}, type=series); > sol := dsolve({de,x(0)=50},type=numeric); # numerical solution > fun := t -> rhs(op(2,sol(t))); # the numerical solution as a function > plot([seq([0.1*i,fun(0.1*i)],i=1..20)]); # plot points in the graph of fun(t) (joined) > myDE := x^2*diff(y(x),x,x,x) # a nonlinear differential equation -2*(n+1)*x*diff(y(x),x,x) + (a*x^2+6*n)*diff(y(x),x) -2*a*x*y(x)=0; > infolevel[dsolve] := 3: # Increase the information level to display solution # steps Maple takes in searching for a solution to the DE. > dsolve(myDE); # solve the DE with new infolevel. > infolevel[dsolve] := 0: # reset infolevel to default value. > myDE2:=diff(y(x),x,x)=-3*diff(y(x),x)^2/y(x) # a nonlinear ode. -2*diff(y(x),x)/x+1/(x^6*diff(y(x),x)*y(x)^6); > odeadvisor( myDE2 ); # Ask Maple for a structural analysis of the non-linear ODE. > dsolve( myDE, implicit); # finds solutions in implicit form ## Numerical Solution of Boundary Value Problems > de1 := diff((1+x(t)/(1-x(t)-y(t)))*diff(x(t),t) + # the first equation of a system. x(t)/(1-x(t)-y(t))*diff(y(t),t), t); > de2 := diff((y(t)/(1-x(t)-y(t)))*diff(x(t),t) + # the second equation of a system. (1+y(t)/(1-x(t)-y(t)))*diff(y(t),t), t); > bvpSolution := dsolve( {de1=0, de2=0, # numerical solution to BVP x(0)=.418, y(0)=.573, x(1)=0, y(1)=0},numeric): > plots[odeplot](bvpSolution, [[t,x(t)],[t,y(t)]], # a plot of the numerical solution 0..1,numpoints=25, scaling=constrained, thickness=2); ## Numerical Solution of Initial Value Problems > predatorPreyDE := {diff( x(t),t) = x(t)*(1-y(t)), # predator prey model with initial cond's. diff( y(t),t) = 0.3*y(t)*(x(t)-1), x(0) = 0.5, y(0) = 1 }; > populations := dsolve( predatorPreyDE, numeric, # numerical solution with rkf45 method = rkf45, # may also use method = dverk78 abserr = 1e-8, relerr = 1e-8): # with error tolerance 10^-8 > populations( 1000 ); # gives populations for t = 1000. > plots[odeplot]( populations, [[t,x(t)],[t,y(t)]], # a plot 0..100, thickness=2,numpoints=50);