>

> # (Anything after `#' is for comments. Maple does not treat them as input.) This is a tutorial to some common commands on solving differential equations.

> with(plots): # Load up the graphic package. End any command with `:' if you don't want to see the output. Otherwise, end it with `;'.

> with(DEtools): # Load up another package for differential equations.

> ?dsolve;

> # Asking question in the form ``?[subject]'' is a very useful tool to learn new commands and techniques.

> ode:=diff(y(t),t$2)+2*diff(y(t),t)+5*y(t)=cos(t);

[Maple Math]

> dsolve(ode,y(t));

[Maple Math]
[Maple Math]

> ic:=y(0)=10,D(y)(0)=-1;

[Maple Math]

> solu:=dsolve({ode,ic},y(t),type=numeric):

> a:=odeplot(solu,[t,y(t)],0..10,color=black):

> display({a});

> ?dfieldplot; # Find out how to plot direction field.

> dfieldplot(diff(y(t),t)=y(t)*(1-y(t)),y(t),t=-3..3,y=-3..3,\
title=`Logistic Equation`);# You can assign variable colors using an expression such as `color=1/2*(-t-(t^2+4*y)))'.

> phaseportrait([D(x)(t)=-x(t)-y(t),D(y)(t)=2*x(t)-y(t)], \
[x(t),y(t)],t=0..20,[[x(0)=1,y(0)=0],[x(0)=3,y(0)=3]],x=-4..4,y=-4..4,stepsize=.05, \
scene=[x(t),y(t)],linecolour=sin(t*Pi/2)); # Here is another way to do vector field with solutions.

>