You are on page 1of 9

MAT2384 Assignment #4

Due Tuesday November 11 at the beginning of class.


Late assignments will not be accepted, nor will unstapled assignments.
Student Name

Student Number

By signing below, you declare that this work was your own and that you have not copied from any other
individual or other source.
Signature

1. Solve the following initial value problems.


(a) x3 y 000 x2 y 00 + 2xy 0 2y = 0, x > 0, y(1) = 1, y 0 (1) = 3, y 00 (1) = 1
The indicial equation is
r(r 1)(r 2) r(r 1) + 2r 2 = 0
(r 1)[r(r 2) r + 2] = 0
(r 1)(r2 3r + 2) = 0
(r 1)2 (r 2) = 0
y = c1 x + c2 x ln x + c3 x2
y 0 = c1 = c2 ln x + c2 + 2c3 x
c2
+ 2c3
y 00 =
x
Using initial conditions, we have
y(1) = c1 + c3 = 1
0

y (1) = c1 + c2 + 2c3 = 3
y 00 (1) = c2 + 2c3 = 1
c1 + 1 = 3

c1 = 4

4 + c3 = 1

c3 = 3
c2 = 5

c2 + 6 = 1
y = 4x 5x ln x + 3x2
(b) y 000 4y 00 + y 0 + 6y = 8 cos x + 18x + 3, y(0) = 56 , y 0 (0) = 11, y 00 (0) =
Using long division, we have
m2 5m + 6

11
5

m + 1 m3 4m2 + m + 6
m3 + m2
5m2
5m2 5m
6m
6m + 6
0
Thus the characteristic equation is
(m + 1)(m 2)(m 3) = 0
m = 1, 2, 3
yh = c1 ex + c2 e2x + c3 e3x

Using the method of undetermined coefficients, we can choose a particular solution of the form
yp = A cos x + B sin x + Cx + D
yp0 = A sin x + B cos x + C
yp00 = A cos x B sin x
yp000 = A sin x B cos x
Thus
yp000 4yp00 + yp0 + 6yp = A sin x B cos x + 4A cos x + 4B sin x A sin x + B cos x + C
+ 6A cos x + 6B sin x + 6Cx + 6D = 8 cos x + 8x + 3
Collecting like terms, we have
(A + 4B A + 6B) sin x + (B + 4A + B + 6A) cos x + 6Cx + (C + 6D) = 8 cos x + 8x + 3
10B = 0
10A = 8
6C = 18
3 + 6D = 3
4
yp = cos x + 3x
5
Hence the solution is
4
cos x + 3x
5
4
y 0 = c1 ex + 2c2 e2x + 3c3 e3x sin x + 3
5
4
00
x
2x
3x
y = c1 e + 4c2 e + 9c3 e cos x
5
y = c1 ex + c2 e2x + c3 e3x +

Using the initial conditions, we have


4
5
y 0 (0) = c1 + 2c2 + 3c3
4
y 00 (0) = c1 + 4c2 + 9c3
5
c1 + c2 + c3
y(0) = c1 + c2 + c3 +

6
5
= 2
11
=
5
= 2
=

c1 + 2c2 + 3c3 = 14
c1 + 4c2 + 9c3 = 3
61
c1 =
12
37
c2 =
3
21
c3 =
4
61 x 37 2x 21 3x 4
y = e e + e + cos x + 3x
12
3
4
5

B=0
4
A=
5
C=3
D=0

(c) y 000 + 2y 00 = 32e2x + 24x, y(0) = 6, y 0 (0) = 0, y 00 (0) = 14


The characteristic equation is

[3]

m3 + 2m2 = 0
m2 (m + 2) = 0
m = 0, 0, 2
yh = c1 + c2 x + c3 e2x
Using the method of undetermined coefficients, we have
yp = Ae2x + Bx3 + Cx2
Note that we need two powers of x, but 1 and x are part of the homogeneous solution, so we use the
next two available powers. Then
yp0 = 2Ae2x + 3Bx2 + 2Cx
yp00 = 4Ae2x + 6Bx + 2C
yp000 = 8Ae2x + 6B
Thus
yp000 + 2yp00 = 8Ae2x + 6B + 8Ae2x + 12Bx + 4C = 32e2x + 24x
16Ae2x + 12Bx + 6B + 4C = 32e2x + 24x
A=2
B=2
6B + 4C = 0
C = 3
yp = 2e2x + 2x3 3x2
Hence the solution is
y = c1 + c2 x + c3 e2x + 2e2x + 2x3 3x2
y 0 = c2 2c3 e2x + 4e2x + 6x2 6x
y 00 = 4c3 e2x + 8e2x + 12x 6

The initial conditions are


y(0) = c1 + c3 + 2 = 6
0

y (0) = c2 2c3 + 4 = 0
y 00 (0) = 4c3 + 8 6 = 14
c3 = 3
c2 = 2
c1 = 1
y = 1 + 2x + 3e2x + 2e2x + 2x3 3x2
(d) y 00 + y = cos2 x , y(0) = y 0 (0) = 2
The characteristic equation is

[3]
m2 + 1 = 0
m = i
yh = c1 cos x + c2 sin x

Using the method of variation of parameters, we have


c01 (x) cos x + c02 (x) sin x = 0
c01 (x) sin x + c02 (x) cos x =

2
cos x

Thus
c01 (x) = c02 (x) tan x
2
c02 (x) tan x sin x c02 (x) cos x =
cos x
c02 (x) sin2 x + c02 (x) cos2 x = 2
c02 (x) = 2
c2 (x) = 2x
c01 (x) = 2 tan x
Z
sin x
dx
c1 = 2
cos x
u = cos x
du
= sin x
dx
dx
du =
sin x
c1 (x) = 2

du

u 
sinx


sinx


= 2 ln |u|
= 2 ln |cos x|
yp = 2 ln |cos x| cos x + 2x sin x
Thus the general solution is
y = c1 cos x + c2 sin x + 2 ln |cos x| cos x + 2x sin x
2
 2 ln |cos x| sin x + 2 sin x + 2x cos x
y 0 = c1 sin x + c2 cos x
sin x
cosx

cosx

The initial conditions are thus
y(0) = c1 = 2
y 0 (0) = c2 = 2
Hence the solution is
y = 2 cos x + 2 sin x + 2 ln |cos x| cos x + 2x sin x.
Note: the absolute value signs are crucial here, as cos x can easily be negative.
(e) x3 y 000 6xy 0 + 12y = 20x4 , x > 0, y(1) = 83 , y 0 (1) =
The inidical equation is

50
3 ,

y 00 (1) = 14

r(r 1)(r 2) 6r + 12 = 0
(r 2)[r(r 1) 6] = 0
(r 2)(r2 r 6) = 0
(r 2)(r + 2)(r 3) = 0
r = 2, 3
yh = c1 x2 + c2 x2 + c3 x3

We could use the method of undetermined coefficients, but lets use the method of variation of
parameters to see how it works in this kind of example. Note that in order to do this, the original
equation must be in standard form, which is
y 000 6x2 y 0 + 12x3 y = 20x
The particular solution comes from
yp = c1 (x)x2 + c2 (x)x2 + c3 (x)x3
Hence
c01 (x)x2 + c02 (x)x2 + c3 (x)x3 = 0
c01 (x)2x c02 (x)2x3 + c3 (x)3x2 = 0
c01 (x)2 + c02 (x)6x4 + c3 (x)6x = 20x

By Cramers rule, we have

c01 (x) =

0
x2
x3

3
3x2
det 0 2x
4
20x 6x
6x

x2
x2
x3

3
3x2
det 2x 2x
2
6x4
6x
100x
=
= 5x
20
5
c1 (x) = x2
2

x2
0
x3

det 2x 0 3x2
2 20x 6x

c02 (x) =
2
x
x2
x3

det 2x 2x3 3x2


2
6x4
6x
20x5
= x5
20
1
c2 (x) = x6
6

x2
x2
0

det 2x 2x3 0
4
2
6x
20x

c03 (x) =
x2
x2
x3

det 2x 2x3 3x2


2
6x4
6x
80
=
=4
20
c3 (x) = 4x
=

Thus the particular solution is


5
1
5
yp = x4 + x4 + 4x4 = x4
2
6
3

Hence the general solution is


5
y = c1 x2 + c2 x2 + c3 x3 + x4
3
20
y 0 = 2c1 x 2c2 x3 + 3c3 x2 + x3
3
y 00 = 2c1 + 6c2 x4 + 6c3 x + 20x2
The initial conditions are
5
8
=
2
3
20
50
y 0 (1) = 2c1 2c2 + 3c3 +
=
3
3
y 00 (1) = 2c1 6c2 + 6c3 + 20 = 14
y(1) = c1 + c2 + c3 +

c1 + c2 + c3 = 1
2c1 2c2 + 3c3 = 10
2c1 6c2 + 6c3 = 6
c1 = 3
c2 = 2
c3 = 0
5
y = 3x2 2x2 + x4
3
(f) x2 y 00 2xy 0 + 2y = x2 , x > 0, y(1) = 3, y 0 (1) = 5
The indicial equation is

[3]

r(r 1) 2r + 2 = 0
(r 1)(r 2) = 0
r = 1, 2
yh = c1 x2 + c2 x
Using the method of variation of parameters, we have
c01 (x)x2 + c02 (x)x = 0
c01 (x)2x + c01 (x) = 1
"

x2 x
2x 1

#"

"

(recall the original equation needs to be in standard form)

" #

c01 (x)
0
=
c02 (x)
1

"

1
c01 (x)
1
x
= 2
0
2
c2 (x)
x 2x 2x x2
"

1 x
= 2
x x2
"

1
x

#" #

0
1

c1 (x) = ln |x|
c2 (x) = x
Thus the particular solution is
yp = x2 ln |x| x x = x2 ln |x| x2

Hence the general solution is


y = c1 x2 + c2 x + x2 ln |x|

(where c1 = c1 1)

y = 2
c1 x + c2 + 2x ln |x| + x
Applying the initial conditions, we have
y(1) = c1 + c2 = 3
2
c1 + c2 + 1 = 5
c2 = 3 c1
2
c1 + 3 c1 + 1 = 5
c1 = 1
c2 = 2
y = x2 + 2x + x2 ln |x|

2. Consider the four equidistant data points


(1, 0.022), (1.2, 0.0345), (1.4, 0.11478), (1.6, 0.356)
where each point is in the form (xi , fi ), with fi = f (xi ) for some unknown function f .
(a) Use the Newton-Gregory forward difference formula to estimate the value of f at x = 1.5. Moreover,
if 0.25 |f (4) (t)| 0.7 for t [1, 1.6], give bounds for the error in your estimate of f (1.5).
We have h = 1.5 1/0.2 = 2.5. The table is
xj
1
1.2
1.4
1.6
fj
0.022
0.0354
0.11478
-0.356
fj
0.0125
0.08028
-0.47078
0.06778
-0.55106
0.61884
Thus
p3 (1.5) = 0.022 + 2.5(0.0125) +

2.5(2.5 1)
2.5(2.5 1)(2.5 2)
(0.06778) +
(0.61884)
2
6

= 0.01305
The error satisfies
3 = 2.5(2.5 1)(2.5 2)(2.5 3)

0.2 (4)
f (t)
4!

= 0.0000625f (4) (t)


0.0000625(0.7) 3 0.0000625(0.25)
0.00004375 3 0.000015625
0.01305 0.00004375 f 0.01305 0.000015625
0.01309375 f 0.013065625
(b) Use the last three points to construct both a linear spline and a cubic spline (with natural endpoints).
Estimate the value of each spline at x = 1.5.
The linear spline consists of S1 = a1 + b1 x and S2 = a2 + b2 x. We have
[3]

a1 + b1 (1.2) = 0.0345
a1 + b1 (1.4) = 0.11478
a2 + b2 (1.4) = 0.11478
a2 + b2 (1.6) = 0.356

0.0345
a1
1 1.2 0 0
1 1.4 0 0 b 0.11478

0 0 1 1.4 a2 0.11478
0.356
0 0 1 1.6 b2
1

1 1.2 0 0
a1
b 1 1.4 0 0

=
a2 0 0 1 1.4
0 0 1 1.6
b2

0.0345
0.11478

0.11478
0.356

0.44718
0.4014

3.41024
2.3539
Thus the linear spline is

S1 (x) = 0.44718 + 0.4014x

for 1.2 x 1.4

S2 (x) = 3.41024 2.3539x

for 1.4 x 1.6

Hence S2 (1.5) = 0.12061.


For the cubic spline, we have S1 = a1 + b1 x + c1 x2 + d1 x3 and S2 = a2 + b2 x + c2 x2 + d2 x3 . We have
a1 + b1 (1.2) + c1 (1.2)2 + d1 (1.2)3 = 0.0345
a1 + b1 (1.4) + c1 (1.4)2 + d1 (1.4)3 = 0.11478
a2 + b2 (1.4) + c2 (1.4)2 + d2 (1.4)3 = 0.11478
a2 + b2 (1.6) + c2 (1.6)2 + d2 (1.6)3 = 0.356
b1 + 2c1 (1.4) + 3d1 (1.4)2 = b2 + 2c2 (1.4) + 3d2 (1.4)2
2c1 + 6d1 (1.4) = 2c2 + 6d2 (1.4)
2c1 + 6d1 (1.2) = 0
2c2 + 6d2 (1.6) = 0

1.22

1.23

1 1.2
1 1.4 1.42
1.43
0 0
0
0
0 0
0
0
0 1 2(1.4) 3(1.4)2
0 0
2
6(1.4)
0 0
2
6(1.2)
0 0
0
0

0 0
0
0
0.0345
0 0
0
0
0.11478

1 1.4
1.42
1.43
0.11478

1 1.6
1.62
1.63
0.356

0 1 2(1.4) 3(1.4)2
0

0 0
2
6(1.4)
0

0
0 0
0
0
0 0
2
6(1.6)
0

Using Matlab or Excel (or even by hand if youre feeling brave), we find
a1 = 28.48347
b1 = 73.302875
c1 = 61.99425
d1 = 17.220625
a2 = 66.02332
b2 = 129.211675
c2 = 82.659
d2 = 17.220625

Thus the cubic spline is

S1 (x) = 28.48347 73.302875x + 61.99425x2 17.220625x3


2

S2 (x) = 66.02332 + 129.211675x 82.659x + 17.220625x

Hence S2 (1.5) = 0.0689481

for 1.2 x 1.4


for 1.4 x 1.6

You might also like