Session 4.2 Defining and solving Differential Equations Part b Two ODEs

> restart;

We want to solve two differential equations simultaneously:

dx1/dt = -x1 + ax2 ; x1(0) = 1

dx2/dt = bx1 - 2x2 ; x2(0) = 0

a and b are constants

> de1:=D(x1)(t)=-x1(t)+a*x2(t); The operator notation for differentiation is somewhat more concise than diff.

[Maple Math]

> de2:=D(x2)(t)=b*x1(t)-2*x2(t);

[Maple Math]

> ic1:=x1(0)=1;

[Maple Math]

> ic2:=x2(0)=0;

[Maple Math]

> s1:=dsolve({de1,de2,ic1,ic2},{x1(t),x2(t)});

The differential equations and initial conditions are all listed in the first set of braces.

The variables to be found are listed in the second set of braces.

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

We can also solve this equation using a Laplace Transform:

> s2:=dsolve({de1,de2,ic1,ic2},{x1(t),x2(t)},laplace);

Note the addition of the term "laplace" at the end of the command

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

> assign(s1);x1:=unapply(x1(t),t);x2:=unapply(x2(t),t);

[Maple Math]
[Maple Math]

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

> x1(0);x2(0);

[Maple Math]

[Maple Math]

> simplify(x1(0));simplify(x2(0));

[Maple Math]

[Maple Math]

>