Chap1.mw

 Maple Text Commands for Chapter 1 -  

DIFFERENTIAL EQUATIONS 

> restart:with(DEtools):with(plots):
 

Example 1: Solve the differential equation  

> deqn1:=diff(y(x),x)=-x/y(x):
dsolve(deqn1,y(x));
 

y(x) = `*`(`^`(`+`(`-`(`*`(`^`(x, 2))), _C1), `/`(1, 2))), y(x) = `+`(`-`(`*`(`^`(`+`(`-`(`*`(`^`(x, 2))), _C1), `/`(1, 2))))) (1)
 

> C1:=x^2+y^2:
 

Figure 1.1: Plot solution curves for Example 1. 

> implicitplot({C1=1,C1=4,C1=9},x=-4..4,y=-4..4,numpoints=1000,color=blue,scaling=CONSTRAINED,font=[TIMES,ROMAN,15],labels=[`t`,`x`]);
 

Plot_2d
 

Example 3: The logistic equation modelling population growth. 

> Logistic:=diff(P(t),t)=P(t)*(b-d*P(t)):
dsolve(Logistic,P(t));
 

P(t) = `/`(`*`(b), `*`(`+`(d, `*`(exp(`+`(`-`(`*`(b, `*`(t))))), `*`(_C1, `*`(b)))))) (2)
 

Example 8: The chemical reaction between nitrous oxide and oxygen to form nitrogen dioxide. Initial value problem `/`(`*`(dc), `*`(dt)) = `+`(`*`(0.713e-2, `*`((`+`(4, `-`(`*`(`^`(c, 2)))))(`+`(1, `-`(`*`(`/`(1, 2), `*`(c)))))))), c(0) = 0. 

> k:=0.00713:a0:=4:b0:=1:
deqn2:=diff(c(t),t)=k*(a0-(c(t))^2)*(b0-c(t)/2);
 

diff(c(t), t) = `+`(`*`(0.713e-2, `*`(`+`(4, `-`(`*`(`^`(c(t), 2)))), `*`(`+`(1, `-`(`*`(`/`(1, 2), `*`(c(t))))))))) (3)
 

Figure 1.6: Plot a solution curve. 

> DEplot(deqn2,c(t),t=0..1000,[[c(0)=0]],c=0..2.2,thickness=2,linecolor=blue);
 

Plot_2d
 

Example 10: Solve the differential equation `+`(`/`(`*`(I, `*`(`^`(d, 2))), `*`(`^`(dt, 2))), `/`(`*`(5, `*`(dI)), `*`(dt)), `*`(6, I)) = `+`(`*`(10, `*`(sin(t)))), `and`((I)(0) = `*`(`/`(`*`(dI), `*`(dt)), 0), `*`(`/`(`*`(dI), `*`(dt)), 0) = 0...     

> ode:=diff(i(t),t,t)+5*diff(i(t),t)+6*i(t)=10*sin(t):
dsolve({ode,i(0)=0,D(i)(0)=0});
 

i(t) = `+`(`-`(exp(`+`(`-`(`*`(3, `*`(t)))))), `*`(2, `*`(exp(`+`(`-`(`*`(2, `*`(t))))))), `-`(cos(t)), sin(t)) (4)
 

Exercise 7: Solve the system  

> sys1:=diff(x(t),t)=-a*x(t),diff(y(t),t)=a*x(t)-b*y(t),diff(z(t),t)=b*y(t);
 

diff(x(t), t) = `+`(`-`(`*`(a, `*`(x(t))))), diff(y(t), t) = `+`(`*`(a, `*`(x(t))), `-`(`*`(b, `*`(y(t))))), diff(z(t), t) = `*`(b, `*`(y(t))) (5)
 

> dsolve([sys1,x(0)=M,y(0)=0,z(0)=0]);
 

{x(t) = `*`(M, `*`(exp(`+`(`-`(`*`(a, `*`(t))))))), y(t) = `+`(`-`(`/`(`*`(`+`(`-`(a), b), `*`(a, `*`(M, `*`(exp(`+`(`-`(`*`(b, `*`(t))))))))), `*`(`^`(`+`(a, `-`(b)), 2)))), `-`(`/`(`*`(a, `*`(exp(`+...
{x(t) = `*`(M, `*`(exp(`+`(`-`(`*`(a, `*`(t))))))), y(t) = `+`(`-`(`/`(`*`(`+`(`-`(a), b), `*`(a, `*`(M, `*`(exp(`+`(`-`(`*`(b, `*`(t))))))))), `*`(`^`(`+`(a, `-`(b)), 2)))), `-`(`/`(`*`(a, `*`(exp(`+...
(6)
 

Example: Plot a solution curve for  

> sys1:=diff(x(t),t)=z(t)-x(t),diff(y(t),t)=-y(t),diff(z(t),t)=z(t)-17*x(t)+16:
DEplot3d({sys1},{x(t),y(t),z(t)},t=0..10,[[x(0)=0.8,y(0)=0.8,z(0)=0.8]],scene=[x(t),y(t),z(t)],stepsize=0.05,linecolor=blue,thickness=1);
 

Plot
 

Example: A time series plot. 

> DEplot({sys1},{x(t),y(t),z(t)},t=0..10,[[x(0)=0.8,y(0)=0.8,z(0)=0.8]],scene=[t,x(t)],stepsize=0.05,linecolor=blue,thickness=1);
 

Plot_2d
 

Example 7: Solve the initial value problem  

> LDE:=diff(x(t),t)+t*x(t)=t^3;
 

`+`(diff(x(t), t), `*`(t, `*`(x(t)))) = `*`(`^`(t, 3)) (7)
 

> dsolve({LDE,x(0)=1},x(t));
 

x(t) = `+`(`-`(2), `*`(`^`(t, 2)), `*`(3, `*`(exp(`+`(`-`(`*`(`/`(1, 2), `*`(`^`(t, 2))))))))) (8)
 

> seriessolLDE:=dsolve({LDE,x(0)=1},x(t),series);
 

x(t) = series(`+`(1, `-`(`*`(`/`(1, 2), `*`(`^`(t, 2)))), `*`(`/`(3, 8), `*`(`^`(t, 4))))+O(`^`(t, 6)),t,6) (9)
 

Example 8: Solve the van der Pol differential equation  

using numerical methods and a series solution. Compare the results near to the initial conditions. 

> restart:with(DEtools):with(plots):
vanderPol:=diff(x(t),t,t)+2*(x(t)^2-1)*diff(x(t),t)+x(t)=0;
numsol:=dsolve({vanderPol,x(0)=5,D(x)(0)=0},numeric,range=0..0.08):
p1:=odeplot(numsol):
seriessol:=dsolve({vanderPol,x(0)=5,D(x)(0)=0},x(t),series);
approxpoly:=convert(rhs(seriessol),polynom);
p2:=plot({approxpoly},t=0..0.08,colour=blue):
display({p1,p2},font=[TIMES,ROMAN,15],title=["Numerical and Series Solutions"]);
 

>
 

 

 

 

Plot_2d
 

End of Chapter 1 Commands