ENGR20005
Numerical Methods in Engineering
Workshop 7 Solutions
7.3 Consider the function
f(x)=6×3 +x2 −11x+4 (1) The exact value of the integral
is given by
Using the Trapezoidal rule, we may approximate the integral as ITrapezoid = 12(f(0)+f(1))
= 12(4+0) =2
I =
1 0
f(x) dx
3413112 1 I=x+x− x+4x
2320 = 3 + 1 − 11 + 4
232 = 13
Hence the error is given by
For Simpson’s rule, the error is given by
∆5 |E| = − 90 f(iv)(ξ)
Since Eq. (1) is a polynomial of order 3, then the error term is zero and the integral is exact.
1 5 | E | = 2 − 3 = 3
1
7.4 See Q7 4 sol.m
7.5 (a)
We’ll consider the three point case
1 −1
1
1dx=w0 +w1(1)+w2(1) =2
−1 1
xdx=w0(−1)+w1x21 +w2(1)=0 −1
12
x2 dx=w0(1)+w1x31 +w2(1) = 3 −1
1
x3 dx=w0(−1)+w1x41 +w2(1)=0
−1
See Q7 5 sol.m for the solution for the other cases.
Since for the N-point Gauss–Lobatto quadrature formula there are 2N − 2 de- grees of freedom, we require 2N − 2 equations to solve. Thus, the highest order polynomial the quadrature formula will integrate exactly is 2N − 3.
i. Expanding
d (t2 − 1)dPk (t) = k(k + 1)Pk(t) dt dt
dt2 dt
ii. Since the domain of the Legendre function is −1 ≤ t ≤ 1, then integrating
from t = −1 to t = x gives
ˆ 2 dPk t
(b)
(c)
f(x) dx = w0f(−1) + w1f(x1) + w2f(1)
I =
Since we have four unknowns then we consider the integrals of {1, x, x2, x3}.
using the product rule, we obtain the Legendre differential equation (1−t2)d2Pk −2tdPk −k(k+1)Pk(t)=0
Lok+1(t)=(1−t ) dt =−k(k+1)
iii. The Lobatto polynomials when k = 1, 2, 3, 4 are given by
2
−1
Pk(τ)dτ
ˆt Lo2(t) = −2
x dτ = 1 − t2 (2) ˆt12 2
−1
−1
−1
Lo3(t)=−6
ˆt13 342
2(3x −1)dτ =3t(1−t ) (3)
2(5x −3x)dτ =−2(5t −6t +1) (4) ˆt142542
Lo4(t)=−12 Lo5(t)=−20
ˆ
• Lo2: t=−1,1
ˆ
• Lo3: t=−1,0,1
ˆ
• Lo4: t = −1, −0.44721, 0.44721, 1
ˆ
• Lo5: t = −1, −0.65465, 0, 0.65465, 1
which are the same as the Quadrature points found in part (a). (d) For a six point quadrature formula
1
f(x) dx = w0f(−1) + w1f(x1) + w2f(x2) + w3f(x3) + w4f(x4) + w5f(1)
8(35x −30x +3)dτ =−2t(7t −10t +3) (5) iv. The roots of the Completed Lobatto polynomials in part iii. are
−1
−1
the equations we have to solve are given by
w0 +w1 +w2 +w3 +w4 +w5 =2 w0 +w1x1 +w2x2 +w3x3 +w4x4 +w5 = 0
−w0 +w1x21 +w2x2 +w3x23 +w4x24 +w5 = 32 w0 +w1x31 +w2x32 +w3x3 +w4x34 +w5 = 0 −w0 +w1x41 +w2x42 +w3x43 +w4x4 +w5 = 52 w0 +w1x51 +w2x52 +w3x53 +w4x54 +w5 = 0
−w0 +w1x61 +w2x62 +w3x63 +w4x64 +w5 = 72 w0 +w1x71 +w2x72 +w3x73 +w4x74 +w5 = 0 −w0 +w1x81 +w2x82 +w3x83 +w4x84 +w5 = 92 w0 +w1x91 +w2x92 +w3x93 +w4x94 +w5 = 0
(6)
3
Substituting in the roots of the sixth Completed Lobatto polynomial into Eq. (6), we find that the quadrature points and weights are
Trapezodial rule
Point xi Weight wi ±0.285232 0.554858 ±0.765055 0.378475
±1 0.066667
7.6 (a)
(b) See Q7 6 sol.m
See Q7 6 sol.m
(c) The inverse Laplace transform is given by
2eγt ∞
f(t)= π
b ∆N−1 g(x)dx≈ 2 g(0)+2g(xi)+g(b)
a i=1
0
ˆ
R f(γ+iω) cos(ωt)dω
(7)
(8) (so that
Let a = 0 and consider equally spaced nodes with a spacing of ∆ = Nb b = N∆ ≫ 1, then Eq. (8) becomes
2eγt ∞
ˆ
R f(γ+iω) cos(ωt)dω
f(t)= π
2eγt∆ ˆ ˆ
0
N−1
≈ π 2 R f(γ+i(0)) cos((0)t)+2 R f(γ+iω) cos(ωt) (9) i=1
ˆ
+R f(γ+iN∆) cos(N∆t)
Assuming that the integral is convergent, then
ˆ
R f(γ+iN∆) cos(N∆t)→0 (10)
as N → ∞.
Letting N → ∞, we have
∞ 2eγt∆ ˆ ˆ
f(t)≈ π 2 R f(γ) +2 R f(γ+ik∆) cos(k∆t) (11) i=1
4
And upon simplification becomes
∆eγtˆ 2∆eγt∞ˆ
f(t)≈ π R f(γ+iω) + π R f(γ+ik∆) cosk∆t (12) k=1
(d) Assuming that ∆ = π 2t
and γ = A , Eq. (11) becomes 2t
f(t)≈
as required.
(e) See Q7 6 sol.m
(f) See Q7 6 sol.m
(−1)kR fˆ
(13)
A eA/2 ∞ R fˆ +
eA/2
2t 2t t
A+2kπi
2t
5
k=1