Solution - M15/Allgemeines

Zentrum Mathematik
Technische Universität München
Prof. Dr. Massimo Fornasier
Dr. Markus Hansen
WS 2016/17
Testexam
Modeling and Simulation with ODE for MSE
Problem 1 (IVP for first order ODE)
Determine a solution of the Initial value problem for the inhomogeneous linear ODE of
first order
2x
y(x) = 1 , y(0) = 0.
y 0 (x) − 2
x +1
Solution:
As usual with linear equations, we first consider the homogeneous problem. Hence we
need to solve the equation
2x
y(x),
y 0 (x) = 2
x +1
which is a separable ODE. This gives for y 6≡ 0
Z
Z
2x
dy
=
dx,
2
y
x +1
and hence
ln |y| = ln(x2 + 1) + c,
and after exponentiation we obtain the general solution
y = C(x2 + 1),
C ∈ R,
(note that allowing for C < 0 allows to get rid of the modulus, and C = 0 corresponds to
the solution y ≡ 0, which needed to be excluded in the calculation).
For the inhomogeneous problem we use the Variation of constants approach. Using the
ansatz yp0 (x) = C(x)(x2 + 1), we obtain yp0 (x) = C 0 (x)(x2 + 1) + 2xC(x), and insertion
into the ODE results in
2x
1 = C 0 (x)(x2 + 1) + 2xC(x) − 2
C(x)(x2 + 1),
x +1
and hence
1
=⇒ C(x) = arctan(x).
C 0 (x) = 2
x +1
A particular solution for the inhomogeneous problem thus is given by
yp (x) = (x2 + 1) arctan x.
To finally solve the IVP, we need to consider the general solution
y(x) = C(x2 + 1) + (x2 + 1) arctan x
at the point x = 0, hence
0 = y(0) = C(0 + 1) + (0 + 1)0 = C.
In other words, the desired solution of the IVP is given by
y(x) = (x2 + 1) arctan x.
Problem 2 (Linear ODE of second order with constant coefficients)
Let the ODE
y 00 (x) + 2y 0 (x) + 5y(x) = r(x) ,
r(x) = e−x ,
be given.
(a) Determine a real Fundamental system for the corresponding homogeneous ODE.
(b) Find a particular solution for the inhomogeneous ODE.
(c) Determine the solution of the IVP corresponding to the initial values y(0) = 0 and
y 0 (0) = 0.
(d) Which ansatz for a particular solution should be used for r(x) = (x + 1)e−x cos(2x)
and r(x) = x3 (ex + sin(3x))?
Solution:
(a) We first need to consider the roots of the characteristic polynomial. In our case that
polynomial is p(λ) = λ2 +2λ+5, with roots λ1/2 = −1±2i. Hence a real Fundamental
system is given by {e−x cos(2x), e−x sin(2x)}.
(b) For the inhomogeneous equation we can use the Method of Undetermined coefficients. Thus we choose the ansatz yp (x) = Ae−x (note that −1 is no root of the
characteristic polynomial). This leads to the equation
Ae−x − 2Ae−x + 5Ae−x = e−x ,
and hence A = 41 , and the particular solution yp (x) = 14 e−x .
(c) The general solution of the ODE is given by
1
y(x) = c1 e−x cos(2x) + c2 e−x sin(2x) + e−x ,
4
and hence
1
y 0 (x) = −c1 e−x cos(2x) − 2c1 e−x sin(2x) − c2 e−x sin(2x) + 2c2 e−x cos(2x) − e−x .
4
Inserting x = 0 leads to the equations
0 = c1 +
1
4
and
1
0 = −c1 + 2c2 − ,
4
and thus c1 = − 41 and c2 = 0. Ultimately, the solution of the IVP is given by
1 −x
1 −x
y(x) = − e cos(2x) +
.
4
4
(d) For r(x) = (x + 1)e−x cos(2x) we note that 1 + 2i is a root of the characteristic
polynomial, so we need to apply the modification rule. Hence the ansatz is
yp (x) = (Ax2 + Bx)e−x (C cos(2x) + D sin(2x)).
Remark: Using a2 x2 +a1 x+a0 as the polynomial factor is not wrong, but the coefficient
a0 necessarily remains undetermined, since a0 e−x (C cos(2x)+D sin(2x)) is a solution
of the homogeneous ODE for every choice of C and D.
In case of r(x) = x3 (ex + sin(3x)) we have the sum of two terms, and neither 1 nor
3i are roots of the characteristic polynomial. The suitable ansatz thus is
yp (x) = (a3 x3 + a2 x2 + a1 x + a0 )ex + (b3 x3 + b2 x2 + b1 x + b0 )(c sin(3x) + d cos(3x)).
Problem 3 (Fundamental system)
Argue that {e2x cos(3x), e2x sin(3x)} is a real Fundamental system for the ODE
y 00 (x) − 4y 0 (x) + 13y(x) = xex .
Explanation: This problem does NOT refer to solving the (homogeneous) ODE, but to
checking the property of being a Fundamental system.
Hint / Key word: Wronski determinant
Solution: For some functions to form a Fundamental system they have to be solutions
of the homogeneous ODE as well as linearly independent (and of course, we need to have
sufficiently many, i.e. as many as the order of the ODE). In our case it is easily checked
that indeed both y1 (x) = e2x cos(3x) and y2 (x) = e2x sin(3x) are indeed solutions.
In fact, we have y10 (x) = 2e2x cos(3x)−3e2x sin(3x) and y100 (x) = −5e2x cos(3x)−12e2x sin(3x),
and thus
y100 (x) − 4y10 (x) + 13y(x) = (−5 − 8 + 13)e2x cos(3x) + (−12 + 12 + 0)e2x sin(3x) = 0.
Similarly for y2 .
It remains to check linear independence of y1 and y2 . This can be done via their Wronski
determinant. We have
y1 (x) y2 (x)
W (x) = det 0
y1 (x) y20 (x)
e2x cos(3x)
e2x sin(3x)
= det
2e2x cos(3x) − 3e2x sin(3x) 2e2x sin(3x) + 3e2x cos(3x)
= 3e4x (cos2 (3x) + sin2 (3x)) + (2 − 2)e4x sin(3x) cos(3x) = 3e4x .
We particularly have W (0) = 3 6= 0, hence W (x) 6= 0 everywhere and y1 and y2 are
linearly independent.
Problem 4 (Systems of ODEs)
Transform the system of ODEs
ÿ1 − 3ÿ2 + 6ẏ1 + 2y2 − y3 = e−t
...
y 2 + 4ÿ2 − 3ẏ1 + 2ẏ2 + y1 − y3 = cos(3t)
ẏ3 − 2ÿ2 + 3ẏ1 + 4ẏ2 − y1 + 2y2 − 3y3 = t2 sin(4t)
into a system of ODEs of first order, and state it in matrix-vector-notation.
Solution: We first note that the first equation is a second order ODE for y1 , the second
equation is a third order ODE for y2 , and the third equation is a first order equation for
y3 (note: while it is also a second order equation with respect to y2 , this point of view
would not lead to a correct transformation). We first rename y1 = x1 , y2 = x3 (since the
first equation is of order 2) and y3 = x6 (since the previous equations are of orders 2 and
3). The we have
ẋ1 = x2
ẋ2 = 3ÿ2 − 6ẏ1 − 2y2 + y3 + e−t
= 3x5 − 6x2 − 2x3 + x6 + e−t
ẋ3 = x4
ẋ4 = x5
ẋ5 = −4ÿ2 + 3ẏ1 − 2ẏ2 − y1 + y3 + cos(3t)
= −4x5 + 3x2 − 2x4 − x1 + x6 + cos(3t)
ẋ6 = 2ÿ2 − 3ẏ1 − 4ẏ2 + y1 − 2y2 + 3y3 + t2 sin(4t)
= 2x5 − 3x2 − 4x4 + x1 − 2x3 + 3x6 + t2 sin(4t) .
In matrix-vector notation this reads as
 

x1
0
1
x2 
 0 −6
 

x3 
0
0


x= ,
A=

0
x4 
0
x5 
−1 3
x6
1 −3
ẋ = Ax + b with

0
0
0 0
−2 0
3 1

0
1
0 0
,
0
0
1 0

0 −2 −4 1
−2 −4 2 3


0
 e−t 




0

.
b=

0


 cos(3t) 
t2 sin(4t)
Remark: This last problem is what often informally is called “Einserbremse”, i.e. a problem which is slightly more difficult, but still solvable with the previously used methods,
though these may need to be applied in a no quite obvious way. The latter particularly
applies here to how the third equation needs to be treated as primarily being first order
in y3 , despite that not being the highest order derivative.
Information and material related to the lecture can be found at the lecture webpage
http://www-m15.ma.tum.de/Allgemeines/ModelingSimulation