Homework problems for systems of ODEs in sm212 in MAPLE


  
 

>    with(linalg):
with(plots):


  
 

x'=-4y,  x(0)=150,

y'=-x,    y(0)=90.

(a) Set this up in matrix form.
(b) Find the eigenvalues and eigenvectors needed to solve the system.
(c) Solve the system in vector form using the formulas from the handout.
(d) Write the solutions in parameteric form.
(e) Who wins? When? State the losses for each side.

>    A:=matrix([[0,-4],[-1,0]]);
lambda:=eigenvals(A);
v:=eigenvects(A);
soln:=c1*op(op(3,v[1]))*exp(lambda[1]*t)+c2*op(op(3,v[2]))*exp(lambda[2]*t);
de:=diff(x(t),t)=-4*y(t),diff(y(t),t)=-x(t);
ics:=x(0)=150,y(0)=90;
soln:=dsolve({de,ics},{x(t),y(t)});
plot([rhs(soln[1]),rhs(soln[2])],t=0..2);
tod:=solve(rhs(soln[1])=0,t);
evalf(tod);
Y_losses:=90-subs(t=tod,rhs(soln[2]));
evalf(Y_losses);

A := matrix([[0, -4], [-1, 0]])

lambda := 2, -2

v := [-2, 1, {vector([2, 1])}], [2, 1, {vector([-2, 1])}]

soln := c1*vector([2, 1])*exp(2*t)+c2*vector([-2, 1])*exp(-2*t)

de := diff(x(t),t) = -4*y(t), diff(y(t),t) = -x(t)

ics := x(0) = 150, y(0) = 90

soln := {x(t) = -15*exp(2*t)+165*exp(-2*t), y(t) = 15/2*exp(2*t)+165/2*exp(-2*t)}

[Maple Plot]

tod := 1/4*ln(11)

.5994738182

Y_losses := 90-15/2*exp(1/2*ln(11))-165/2*exp(-1/2*ln(11))

40.25062815

  

Solve the following system Av=b,
(a) using Gauss elimination,
(b) by computing A^{-1}b.

x+2y=2,  

3x-4y=3.

>    A:=matrix([[1,2],[3,-4]]);
eigenvals(A);
eigenvects(A);
Px:=plot([A[1,1]*t,A[2,1]*t,t=0..1]):
Py:=plot([A[1,2]*t,A[2,2]*t,t=0..1],color=green):
box1:=plot([t,0,t=0..1],color=blue):
box2:=plot([0,t,t=0..1],color=blue):
#box3:=plot([t,1,t=0..1],color=blue):
#box4:=plot([1,t,t=0..1],color=blue):
display([Px,Py,box1,box2],axes=none,scaling=constrained,title=`image of (blue) unit square under A:R^2->R^2`);
B:=inverse(A);
evalm(B&*vector([2,3]));
solve({x+2*y=2,3*x-4*y=3},{x,y});

A := matrix([[1, 2], [3, -4]])

2, -5

[-5, 1, {vector([1, -3])}], [2, 1, {vector([2, 1])}]

[Maple Plot]

B := matrix([[2/5, 1/5], [3/10, -1/10]])

vector([7/5, 3/10])

{x = 7/5, y = 3/10}

  
 


Solve the system
x'=x+y+z,

y'=-2y+z,

z'=3z.
using the eigenvalue method.

>    A:=matrix([[1,1,1],[0,-2,1],[0,0,3]]);
lambda:=eigenvals(A);
v:=eigenvects(A);
soln:=c1*op(op(3,v[1]))*exp(lambda[3]*t)+c2*op(op(3,v[2]))*exp(lambda[2]*t)+c3*op(op(3,v[3]))*exp(lambda[1]*t);
de:=diff(x(t),t)=x(t)+y(t)+z(t),diff(y(t),t)=-2*y(t)+z(t),diff(z(t),t)=3*z(t);
ics:=x(0)=1,y(0)=1,z(0)=1;
soln:=dsolve({de,ics},{x(t),y(t),z(t)});
spacecurve([rhs(soln[2]),rhs(soln[1]),rhs(soln[3])],t=0..1,scaling=unconstrained,axes=normal);
plot([rhs(soln[2]),rhs(soln[1]),rhs(soln[3])],t=0..1);

A := matrix([[1, 1, 1], [0, -2, 1], [0, 0, 3]])

lambda := 1, -2, 3

v := [-2, 1, {vector([1, -3, 0])}], [3, 1, {vector([3, 1, 5])}], [1, 1, {vector([1, 0, 0])}]

soln := c1*vector([1, -3, 0])*exp(3*t)+c2*vector([3, 1, 5])*exp(-2*t)+c3*vector([1, 0, 0])*exp(t)

de := diff(x(t),t) = x(t)+y(t)+z(t), diff(y(t),t) = -2*y(t)+z(t), diff(z(t),t) = 3*z(t)

ics := x(0) = 1, y(0) = 1, z(0) = 1

soln := {y(t) = 1/5*exp(3*t)+4/5*exp(-2*t), x(t) = 3/5*exp(3*t)-4/15*exp(-2*t)+2/3*exp(t), z(t) = exp(3*t)}

[Maple Plot]

[Maple Plot]

  
 

Using the eigenvalue method, solve
x'=x+3y,
y'=x-y.

>    A:=matrix([[1,3],[1,-1]]);
lambda:=eigenvals(A);
v:=eigenvects(A);
soln:=c1*op(op(3,v[1]))*exp(lambda[1]*t)+c2*op(op(3,v[2]))*exp(lambda[2]*t);
de:=diff(x(t),t)=x(t)+3*y(t),diff(y(t),t)=x(t)-y(t);
ics:=x(0)=1,y(0)=1;
soln:=dsolve({de,ics},{x(t),y(t)});
plot([rhs(soln[2]),rhs(soln[1])],t=0..2);
plot([rhs(soln[2]),rhs(soln[1]),t=0..2]);

A := matrix([[1, 3], [1, -1]])

lambda := 2, -2

v := [-2, 1, {vector([-1, 1])}], [2, 1, {vector([3, 1])}]

soln := c1*vector([-1, 1])*exp(2*t)+c2*vector([3, 1])*exp(-2*t)

de := diff(x(t),t) = x(t)+3*y(t), diff(y(t),t) = x(t)-y(t)

ics := x(0) = 1, y(0) = 1

soln := {y(t) = 1/2*exp(2*t)+1/2*exp(-2*t), x(t) = 3/2*exp(2*t)-1/2*exp(-2*t)}

[Maple Plot]

[Maple Plot]

  
 

Consider the system
x'=x-2y+t,   x(0)=1,
y'=-3x+6y-\sin(t),  y(0)=-3.
Set this up in matrix form. Do not solve the system.
However, find the eigenvalues and eigenvectors needed
to solve the system and find the fundamental
solutions to the homogeneous system.

>    A:=matrix([[1,-2],[-3,6]]);
lambda:=eigenvals(A);
v:=eigenvects(A);
soln:=c1*op(op(3,v[1]))*exp(lambda[1]*t)+c2*op(op(3,v[2]))*exp(lambda[2]*t);
de:=diff(x(t),t)=x(t)-2*y(t),diff(y(t),t)=-3*x(t)+6*y(t);
soln:=dsolve({de},{x(t),y(t)});

A := matrix([[1, -2], [-3, 6]])

lambda := 0, 7

v := [0, 1, {vector([2, 1])}], [7, 1, {vector([1, -3])}]

soln := c1*vector([2, 1])+c2*vector([1, -3])*exp(7*t)

de := diff(x(t),t) = x(t)-2*y(t), diff(y(t),t) = -3*x(t)+6*y(t)

soln := {x(t) = _C1+_C2*exp(7*t), y(t) = -3*_C2*exp(7*t)+1/2*_C1}

  
 

  
 

  
 

  
 
sm212_h12.mws

Created 11-5-2003 by wdj