Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Ma147 QS7

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Dr Emma Davis

MA147 Mathematical Methods & Modelling


Week 7

Note: These question sheets are not for credit and are provided with solutions. The intention
is that you work through the questions in your own time to support the module teaching and
use the solutions after attempting the questions to confirm understanding.

Solving linear inhomogeneous second order ODEs


1. Solve the linear homogeneous second order ODE given by
d2 x dx
−2 + 3x = 0 .
dt2 dt
Where x(0) = ẋ(0) = 1.
2. Solve the linear inhomogeneous second order ODE given by
d2 x dx
−3 + 2x = t2 .
dt2 dt
Where x(0) = 7/4 and ẋ(0) = 5/2.

Difference equations

3. Use Euler’s Method to discretise the following first order differential equations for a small
step-size h > 0.

(a)
dx
= x2 + 2
dt
(b)
dx
= sin(x) + cos(t)
dt
(c)
dx
= xt + t2
dt
(d)
dx
= xe2t
dt
4. Solve the following first order difference equations. Where initial conditions are provided,
calculate the particular solution to the initial value problem.

(a)
xn+1 = 2xn − 2 , x0 = 1
(b) √
xn+1 = xn + 13 , x0 = 0
(c) √
xn+1 = 2xn + 7 , x0 = 2
Solutions: Solving linear inhomogeneous second order ODEs
1. Auxiliary equation:
λ2 − 2λ + 3 = 0

with solutions λ = 1 ± i 2, i.e. p = 1 and q = 0.
Then the general solution is given by

x(t) = ept (l1 cos qt + l2 sin qt) ,

giving √ √
x(t) = et (l1 cos 2t + l2 sin 2t) .
Substitute initial conditions x(0) = 1 and ẋ(0) = 1 to get A = 1 and B = 0. Therefore
particular solution is given by √
x(t) = et cos 2t .

2. Auxiliary equation:
λ2 − 3λ + 2 = 0
with solutions λ1 = 1 and λ2 = 2.
Then the general solution to the homogeneous case is given by

x(t) = l1 et + l2 e2t .

As the equation is inhomogeneous (s(t) = t2 ), we also need to find the particular integral.
As s(t) is a quadratic, we’ll try a generic quadratic function xp (t) = at2 + bt + c. Then

ẋp (t) = 2at + b

and
ẍp (t) = 2a
giving
2at2 + (2b − 6a)t + (2a − 3b + 2c) = t2 .
When we equate terms, we get a = 1/2, b = 3/2 and c = 7/4.
Therefore the general solution to the equation is
1 3 7
x(t) = l1 et + l2 e2t + t2 + t + .
2 2 4
Substituting initial conditions into x(t) and ẋ(t) gives l1 = −1 and l2 = 1, so the particular
solution to the initial value problem is
1 3 7
x(t) = −et + e2t + t2 + t + .
2 2 4

Solutions: Difference equations

3. Recall Euler’s Method for a differential equation


dx
= f (x, t)
dt
says that we can approximate our solution for a small step-size h using the following
formula:
xn+1 = xn + hf (xn , nh) ,
where nh = t – the time at the nth time-step.
(a) We have f (x, t) = x2 + 2, giving f (xn , nh) = x2n + 2. Using our formula, we get
xn+1 = xn + h(x2n + 2) .
This rearranges to give the difference equation
xn+1 = hx2n + xn + 2h .

(b) We have f (x, t) = sin(x) + cos(t), giving f (xn , nh) = sin(xn ) + cos(nh). Using our
formula, we get the difference equation
xn+1 = xn + h(sin(xn ) + cos(nh)) .

(c) We have f (x, t) = xt + t2 , giving f (xn , nh) = xn nh + n2 h2 . Using our formula, we


get
xn+1 = xn + h(xn nh + n2 h2 ) .
This rearranges to get the difference equation
xn+1 = (1 + nh2 )xn + n2 h3 .

(d) We have f (x, t) = xe2t , giving f (xn , nh) = xn e2nh . Using our formula, we get
xn+1 = xn + h(xn e2nh ) .
This rearranges to get the difference equation
xn+1 = (1 + he2nh )xn .

4. Recall that if xn+1 = axn + b then


b
xn = Can + if a ̸= 1 ,
1−a
xn = x0 + bn if a = 1 .
(a) a = 2 and b = −2:
−2
xn = c · 2n + = c · 2n + 2
1−2
Substituting in initial condition x0 = 1 gives
1 = x0 = c + 2
therefore c = −1 and we have solution
xn = −(2n ) + 2 .

(b) a = 1 and b = 3, so we can use the second formula:

xn = x0 + bn = 13n .

(c) a = 2 and b = 7, so we have


7
xn = c · 2n + = c · 2n − 7 .
1−2

Substituting initial conditions x0 = 2 gives

2 = x0 = c − 7

therefore c = 2 + 7 and we have solution

xn = ( 2 + 7) · 2n − 7 .

You might also like