MATH3511_Assignment_3
MATH3511_Assignment_3
Assignment 3
Phoebe Grosser, u7294693
April 24, 2023
We can do this via the Composite Simpson’s Rule, given below in general form as:
Z b n/2 n/2
h X X
f (t)dt = f (a) + 2 f (t2i−2 ) + 4 f (t2i−1 ) + f (b) (2)
a 3 i=2 i=1
wherein n refers to the number of intervals that we are approximating the solution over and h, the width of these intervals,
is accordingly equal to (b − a)/n. In the case of Q1a, n = 2 and h = 1/2. Hence, substituting n = 2, h = 1/2 and the
integral bounds [a, b] = [1, 2] into Equation 2, we derive the following approximation:
Z b Z 2
f (x) dx = f (x) dx
a 1
" 1
#
1 X
= f (1) + 4 f (t2i−1 ) + f (2)
6 i=1
1
= [f (1) + 4f (t1 ) + f (2)]
6
1
= [f (1) + 4f (1.5) + f (2)]
6
1
= [10 + 4 · 7 + 5]
6
43
= ≈ 7.167
6
Hence, the approximation to the integral is 436 , or ≈ 7.167, in this case. Note here that f (ti ) refers to the intermediate
values between x = a and x = b that we are approximating the integral over. In this case, we have only one intermediate
value at x = 1.50, so t1 = 1.50 has been used in the above calculations. Also, note that the first sum in Equation 2 has
been nullified as the upper limit of the sum, n/2 = 1, is less than the initial value, i = 2.
b.
We now want to repeat the previous part with the values x = 1, 1.25, 1.5, 1.75 and 2. As before, we shall use the
Composite Simpson’s Rule but now with the updated interval number n = 4 and interval width h = 1/4. Substituting
Page 1
these values into Equation 2 produces the following approximation:
Z b Z 2
f (x) dx = f (x) dx
a 1
" 2 2
#
1 X X
= f (1) + 4 f (t2i−1 ) + 2 f (t2i−2 ) + f (2)
12 i=1 i=2
1
= [f (1) + 4(f (t1 ) + f (t3 )) + 2f (t2 ) + f (2)]
12
1
= [f (1) + 4(f (1.25) + f (1.75)) + 2f (1.5) + f (2)]
12
1
= [10 + 4 · (8 + 6) + 2 · 7 + 5]
12
85
= ≈ 7.083
12
85
Hence, the approximation to the integral is 12 , or ≈ 7.083, in this case. The intermediate values used above were t1 = 1.25,
t2 = 1.5 and t3 = 1.75.
c.
We now want to establish an improved approximation to the integral in Equation 1, using the above results and also the
fact that the error terms are of the form Ch4 + o(h4 ). Here, C is a constant that is dependent only on the integral itself,
and not on the width of the intervals, h, in the approximation. Thus, if the approximation in 1a is referred to as S(f, h),
and the approximation in 1b must accordingly be S(f, h2 ), then the error terms can be characterised as:
To find a better approximation to the true integral, I, we want to eliminate the lowest-order error term (that is, the error
term proportional to h4 ). If we take 16 × Equation 4 − Equation 3, then we get:
h Ch4
16(I − S(f, )) − (I − S(f, h)) = 16( ) − (Ch4 ) + o(h4 )
2 16
h
=⇒ 15I − 16S(f, ) + S(f, h) = o(h4 )
2
which indeed has eliminated the h4 error terms. Finally, rearranging the above for the true integral, I:
h
15I = 16S(f, ) − S(f, h) + o(h4 )
2 !
16S(f, h2 ) − S(f, h)
I= + o(h4 )
15
This implies that the improved approximation for the integral is:
16S(f, h2 ) − S(f, h)
(5)
15
We can now substitute our approximations from 1a and 1b to compute the value of the improved approximation above.
Using S(f, h2 ) = 85 43
12 and S(f, h) = 6 , we get:
16S(f, h2 ) − S(f, h) 16 · 85
12 −
43
6
=
15 15
637
=
90
≈ 7.078
Page 2
Question 2: Norms
a.
We want to compute the condition number of the following matrix, using the matrix norms ∥A∥1 and ∥A∥∞ :
α 1
A= (6)
1 1
By default, we will use the relative condition number, κ. As derived in the lectures, κ for matrix-vector multiplication is
only dependent on the matrix itself, and equal to:
κ = ∥A∥∥A−1 ∥ (7)
We will first compute the relative condition number using the 1-norm, ∥A∥1 . Note the definition of the matrix 1-norm:
n
X
∥A∥1 = max |ai,j | (9)
j
i=1
wherein n refers to the dimension of the matrix. In more simple terms, this definition necessitates taking the sum of the
absolute value of all the entries along a particular column, and then choosing the maximum of these sums from all of the
columns. Hence, the 1-norm of A and A−1 can be found as:
∥A∥1 = max {|α| + |1|, |1| + |1|}
(10)
= max {|α| + 1, 2}
|1| + | − 1| | − 1| + |α|
∥A−1 ∥1 = max { , }
|α − 1| |α − 1|
(11)
2 1 + |α|
= max { , }
|α − 1| |α − 1|
The maximum of these sums depends on the value of |α|. If |α| > 1, then the maximum of Equation 10 will be |α| + 1
1+|α|
and the maximum of Equation 11 will be |α−1| . This produces the following κ:
1 + |α|
κ = ∥A∥∥A−1 ∥ = (|α| + 1)
|α − 1|
(1 + |α|)2
=
|α − 1|
2
Conversely, if |α| < 1, then the maximum of Equation 10 will be 2 and the maximum of Equation 11 will be |α−1| . This
produces the following κ:
2
κ = ∥A∥∥A−1 ∥ = 2
|α − 1|
4
=
|α − 1|
Hence, the relative condition number, using the matrix 1-norm, can be specified as:
(1+|α|)2
(
|α−1| , if |α| > 1
κ= 4
(12)
|α−1| , if |α| < 1
Note that, due to the denominator of κ in both cases, κ will diverge towards infinity at α = 1 (in other words, as α → 1,
we attain very large condition numbers). We can now find the relative condition number using the matrix ∞-norm. The
definition of the matrix ∞-norm is:
n
X
∥A∥∞ = max |ai,j | (13)
i
j=1
Page 3
wherein n once again refers to the dimension of the matrix. In more simple terms, this definition necessitates taking the
sum of the absolute value of all the entries along a particular row, and then choosing the maximum of these sums from
all of the rows. Hence, the ∞-norm of A and A−1 can be found as:
This is exactly the same as the 1-norm case, because both A and A−1 are symmetric matrices. We once again therefore
attain the following specification for the relative condition number using matrix ∞-norms:
(1+|α|)2
(
|α−1| , if |α| > 1
κ= 4
(16)
|α−1| , if |α| < 1
b.
We want to determine if the following is a valid norm for x ∈ Rn :
This can be done by cross-checking the norm definition against the properties that define a norm on Rn . One such
property is that:
By virtue of ”if and only if,” this property must be applicable both ways. That is, if ∥x∥ = 0, then x = 0. Furthermore,
if x = 0, then ∥x∥ = 0. It is simple to show that the norm property holds in the latter direction:
x = 0 =⇒ x1 = x2 = x3 = ... = xn = 0
∴ ∥x∥ = max {|x2 |, |x3 |, |x4 |, ..., |xn |} = max {|0|, |0|, |0|, ..., |0|} = 0
However, it can be shown that the norm property does not hold in the converse direction by a counterexample. Consider
the vector given by:
T
x= ϵ 0 0 0 ... 0
where ϵ is any non-zero number. Because the vector elements x2 up to xn are 0, then:
∥x∥ = max {|x2 |, |x3 |, |x4 |, ..., |xn |} = max {|0|, |0|, |0|, ..., |0|} = 0
So ∥x∥ = 0, but because the first element of x is non-zero, x ̸= 0. Hence, the norm definition does not satisfy the property
in Equation 18 when taken in the forward direction, and is consequently not a valid norm definition.
Page 4
Question 3: Method of Undetermined Coefficients
We want to derive a formula of the form:
Z b
f (x) dx ≈ c0 f (a) + c1 f (b) + c2 f ′ (a) + c3 f ′ (b) (19)
a
which is exact for polynomials of the highest degree possible. Because we have four degrees of freedom in our expression
(c0 , c1 , c2 and c3 ), we expect our formula to be exact for polynomials up to degree 3. However, we will first simplify the
above formula by applying a change of variables y = x − a to the integral (which will not affect any terms on the RHS):
Z b−a
f (y + a) dy ≈ c0 f (a) + c1 f (b) + c2 f ′ (a) + c3 f ′ (b)
0
Now define the shifted function h(y) = f (y + a). Without changing the definition of the constants, the above formula, in
terms of h(y), becomes:
Z b−a
h(y) dy ≈ c0 h(0) + c1 h(b − a) + c2 h′ (0) + c3 h′ (b − a)
0
Finally, let ξ = b − a. We arrive at the equivalent problem to Equation 19 that we will actually solve for the constants
c0 , c1 , c2 and c3 :
Z ξ
h(y) dy ≈ c0 h(0) + c1 h(ξ) + c2 h′ (0) + c3 h′ (ξ) (20)
0
By imposing exactness requirements, we will generate four simultaneous equations for the four constants. Our first
condition can be produced by requiring Equation 20 to be exact for polynomials of degree 0, ie. h(t) = 1. In this case
(noting that the choice of dummy variable in the integral is completely arbitrary), the integral in Equation 20 becomes:
Z ξ Z ξ
h(y) dy = 1 dy
0 0
ξ
=y
0
=ξ
Then, if h(t) = 1 (and therefore h′ (t) = 0), the following function evaluations on the RHS of Equation 20 can be specified
as:
h(0) = h(ξ) = 1
h′ (0) = h′ (ξ) = 0
By substituting these values into Equation 20 and equating to the integral we previously calculated, we can generate the
first restriction on the coefficients:
ξ = c0 + c1 (21)
We will now repeat the above process for polynomials of degree 1, 2 and 3. For polynomials of degree 1, h(t) = t, the
integral in Equation 20 is:
Z ξ Z ξ
h(y) dy = y dy
0 0
y2 ξ
=
2 0
ξ2
=
2
If h(t) = t and h′ (t) = 1, the function evaluations on the RHS of Equation 20 can be specified as:
h(0) = 0, h(ξ) = ξ
h′ (0) = h′ (ξ) = 1
Page 5
By requiring exactness and thus equating the integral and these values as in Equation 20, we attain our second restriction
on the coefficients:
ξ2
= ξc1 + c2 + c3 (22)
2
For polynomials of degree 2, h(t) = t2 , the integral can be computed as:
Z ξ Z ξ
h(y) dy = y 2 dy
0 0
y3 ξ
=
3 0
ξ3
=
3
If h(t) = t2 and h′ (t) = 2t, the function evaluations on the RHS of Equation 20 can be specified as:
h(0) = h′ (0) = 0
h(ξ) = ξ 2 , h′ (ξ) = 2ξ
Once again, by requiring exactness and equating the integral and these values as in Equation 20, we attain our third
restriction on the coefficients:
ξ3
= ξ 2 c1 + 2ξc3 (23)
3
Finally, we will examine polynomials of degree 3, h(t) = t3 . The integral can be computed as:
Z ξ Z ξ
h(y) dy = y 3 dy
0 0
y4 ξ
=
4 0
ξ4
=
4
If h(t) = t3 and h′ (t) = 3t2 , the function evaluations on the RHS of Equation 20 can be specified as:
h(0) = h′ (0) = 0
h(ξ) = ξ 3 , h′ (ξ) = 3ξ 2
So our final restriction on the coefficients can be attained by requiring exactness and equating the integral and these
values as in Equation 20:
ξ4
= ξ 3 c1 + 3ξ 2 c3 (24)
4
We now must use Equations 21, 22, 23 and 24 to find c0 , c1 , c2 and c3 . First notice that Equations 23 and 24 are dependent
on only c1 and c3 , so we can solve for both these coefficients with just these two equations. Rearranging Equation 23 for
c3 , we get:
ξ3
= ξ 2 c1 + 2ξc3
3
ξ2
=⇒ = ξc1 + 2c3
3
ξ2 c1 ξ
=⇒ c3 = −
6 2
Page 6
Now, substituting this into Equation 24 (once it has been simplified by dividing through by ξ 2 ) for c3 , we can solve for c1 :
ξ2
= ξc1 + 3c3
4
ξ2
2
ξ c1 ξ
=⇒ = ξc1 + 3 −
4 6 2
2
3ξ ξ ξ2
=⇒ c1 ξ − c1 = −
2 4 2 2
−ξ −ξ
=⇒ c1 =
2 4
ξ
=⇒ c1 =
2
Now that we have c1 = 2ξ , we can substitute this back into our equation for c3 in terms of c1 to attain:
ξ2 c1 ξ
c3 = −
6 2
2
ξ ξ ξ
= −
6 2 2
ξ2
=−
12
2
ξ ξ
Hence, we have that c1 = 2 and c3 = − 12 . Because we have c1 , we can substitute this into our first restriction (Equation
21) to solve for c0 :
ξ = c0 + c1
ξ
=⇒ ξ = c0 +
2
ξ
=⇒ c0 =
2
2
ξ ξ
Finally, we can substitute c1 = 2 and c3 = − 12 into our second restriction (Equation 22) to solve for c2 :
ξ2
= ξc1 + c2 + c3
2
ξ2
2
ξ ξ
=⇒ =ξ + c2 + −
2 2 12
ξ2 ξ2 ξ2
=⇒ c2 = − +
2 2 12
ξ2
=⇒ c2 =
12
2 2
Hence, we have solved the coefficients in Equation 20 as c0 = c1 = 2ξ , c2 = 12
ξ ξ
and c3 = − 12 . Because the definition of
these constants did not change in the manipulations from our original formula, Equation 19, to the modified equivalent
formula, Equation 20, these constants are also valid for Equation 19. Thus, our original formula can be specified as:
b
ξ2 ξ2
Z
ξ ξ
f (x) dx ≈ f (a) + f (b) + f ′ (a) − f ′ (b)
a 2 2 12 12
Or, because we defined ξ = b − a in our manipulations, this formula can be more appropriately represented as:
b
(b − a) (b − a) (b − a)2 ′ (b − a)2 ′
Z
f (x) dx ≈ f (a) + f (b) + f (a) − f (b) (25)
a 2 2 12 12
Page 7
−1
Noting that a = 0, b = 1, f (x) = 1+x 1
and the corresponding derivative is f ′ (x) = (1+x)2 , we can determine all the
function evaluations in Equation 25 as:
1
f (a) = f (0) = =1
1+0
1 1
f (b) = f (1) = =
1+1 2
−1
f ′ (a) = f ′ (0) = = −1
(1 + 0)2
−1 −1
f ′ (b) = f ′ (1) = =
(1 + 1)2 4
Substituting these into the RHS of Equation 25 (along with (b − a) = 1), we attain the following approximation of the
integral as:
Z 1
1 1 1 1 1 1 −1
dx ≈ (1) + + (−1) −
0 1+x 2 2 2 12 12 4
1 1 1 1
= + − +
2 4 12 48
11
= ≈ 0.6875
16
The true answer to this integral is ln (2). Hence, the absolute error between the true and approximate values can be
computed as:
11
errorabs = ln (2) − ≈ 0.0056
16
1
Clearly, the approximation is not exact, but we wouldn’t expect this as f (x) = 1+x is not a polynomial of degree up to
and including 3.
Page 8
Question 4: Gaussian Quadrature
We want to derive the following 4-point Gaussian quadrature rule:
Z 1
f (x) dx ≈ A0 f (x0 ) + A1 f (x1 ) + A2 f (x2 ) + A3 f (x3 ) (27)
−1
be determined via:
p
k1 = t2 =⇒ t = ± k1
p
k2 = t2 =⇒ t = ± k2
Substituting the quadratic roots k1 and k2 into the above equations, we generate all four polynomial roots t1 , t2 , t3 and
t4 :
√
r
p 1
t = ± k1 = ± 3 + 4 0.3
7
√
r
1
=⇒ t1 = 3 + 4 0.3
7
√
r
1
=⇒ t2 = − 3 + 4 0.3
7
√
r
p 1
t = ± k2 = ± 3 − 4 0.3
7
√
r
1
=⇒ t3 = 3 − 4 0.3
7
√
r
1
=⇒ t4 = − 3 − 4 0.3
7
Page 9
Substituting these roots as xi in Equation 27, we generate the updated Gaussian quadrature scheme:
! ! !
√ √ √
Z 1 r r r
1 1 1
f (x) dx ≈ A0 f 3 + 4 0.3 + A1 f − 3 + 4 0.3 + A2 f 3 − 4 0.3 + ...
−1 7 7 7
! (29)
√
r
1
... + A3 f − 3 − 4 0.3
7
Note to marker: Please note that my x0 , A0 , etc. are not specified with exactly the same index that’s in the question,
ie. the question’s x0 is my x3 . I switch this at the very end, but note the process below displays an index you might not
expect.
We now require this scheme to be exact for polynomials of up to and including degree 3. In enforcing this, we will be able
to solve for the coefficients A0 , A1 , A2 and A3 . This process is very similar to the one carried out in Question 3 - hence,
a slightly more condensed approach will be adopted in this question to avoid tedium.
We will first enforce exactness for polynomials of degree 0, ie. f (x) = 1. Substituting f (x) = 1 into Equation 29 and
performing the function evaluations f (ti ) with this functional form produces the following exactness condition:
Z 1
1 dx = A0 (1) + A2 (1) + A3 (1) + A4 (1)
−1
1
=⇒ x = A0 + A2 + A3 + A4
−1
=⇒ 2 = A0 + A2 + A3 + A4
Hence, our first exactness condition is that:
2 = A0 + A2 + A3 + A4 (30)
Now, we will enforce exactness for polynomials of degree 1, ie. f (x) = x. Substituting f (x) = x into Equation 29 and
performing the function evaluations f (ti ) with this functional form produces the following exactness condition:
! ! ! !
√ √ √ √
Z 1 r r r r
1 1 1 1
x dx = A0 3 + 4 0.3 + A1 − 3 + 4 0.3 + A2 3 − 4 0.3 + A3 − 3 − 4 0.3
−1 7 7 7 7
! !
√ √
r r
x2 1 1 1
=⇒ = 3 + 4 0.3 (A0 − A1 ) + 3 − 4 0.3 (A2 − A3 )
2 −1 7 7
! !
√ √
r r
1 1
=⇒ 0 = 3 + 4 0.3 (A0 − A1 ) + 3 − 4 0.3 (A2 − A3 )
7 7
√ √
r r
=⇒ 0 = 3 + 4 0.3 (A0 − A1 ) + 3 − 4 0.3 (A2 − A3 )
We will now enforce exactness for polynomials of degree 2, ie. f (x) = x2 . Substituting f (x) = x2 into Equation 29 and
performing the function evaluations f (ti ) with this functional form produces the following exactness condition:
!2 !2 !2 !2
√ √ √ √
Z 1 r r r r
2 1 1 1 1
x dx = A0 3 + 4 0.3 + A1 − 3 + 4 0.3 + A2 3 − 4 0.3 + A3 − 3 − 4 0.3
−1 7 7 7 7
x3 1 √ √
1 1
=⇒ = 3 + 4 0.3 (A0 + A1 ) + 3 − 4 0.3 (A2 + A3 )
3 −1 7 7
√ √
2 1 1
=⇒ = 3 + 4 0.3 (A0 + A1 ) + 3 − 4 0.3 (A2 + A3 )
3 7 7
Hence, our third exactness condition is that:
√ √
2 1 1
= 3 + 4 0.3 (A0 + A1 ) + 3 − 4 0.3 (A2 + A3 ) (32)
3 7 7
Page 10
Finally, we will enforce exactness for polynomials of degree 3, ie. f (x) = x3 . Substituting f (x) = x3 into Equation 29
and performing the function evaluations f (ti ) with this functional form produces the following exactness condition:
3 3 3 3
! ! ! !
√ √ √ √
Z 1 r r r r
1 1 1 1
x3 dx = A0 3 + 4 0.3 + A1 − 3 + 4 0.3 + A2 3 − 4 0.3 + A3 − 3 − 4 0.3
−1 7 7 7 7
!3 !3
√ √
r r
x4 1 1 1
=⇒ = 3 + 4 0.3 (A0 − A1 ) + 3 − 4 0.3 (A2 − A3 )
4 −1 7 7
!3 !3
√ √
r r
1 1
=⇒ 0 = 3 + 4 0.3 (A0 − A1 ) + 3 − 4 0.3 (A2 − A3 )
7 7
√ 32 √ 32
=⇒ 0 = 3 + 4 0.3 (A0 − A1 ) + 3 − 4 0.3 (A2 − A3 )
We now want to solve Equations 30, 31, 32 and 33 for A0 , A1 , A2 and A3 . We can do this by first noticing that, in
Equations 31 and 33, we have (A0 − A1 ) and (A2 − A3 ) terms in both. If we let (A0 − A1 ) = α and (A2 − A3 ) = β, then
Equation 31 reduces to:
√ √
r r
0=α 3 + 4 0.3 + β 3 − 4 0.3 (34)
Substituting this into Equation 33 (with α and β substituted in place of (A0 − A1 ) and (A2 − A3 ) respectively) produces
an equation for β:
√ 23 √ 23
0 = α 3 + 4 0.3 + β 3 − 4 0.3
q √
− 3 − 4 0.3 √ 3 √ 3
=⇒ 0 = q β 3 + 4 0.3 2 + β 3 − 4 0.3 2
√
3 + 4 0.3
!
√ √ √ 32
r
=⇒ 0 = − 3 − 4 0.3 3 + 4 0.3 + 3 − 4 0.3 β
=⇒ β = 0
This similarly implies that α = 0, or that A2 = A3 . With the knowledge that A0 = A1 and A2 = A3 , we can simplify
Equations 30 and 32 and solve for A0 and A2 (which will of course give us A1 and A3 as well). Equation 30 will simplify
to:
Page 11
We can now solve these relatively simply. Substitute A0 = 1 − A2 (from Equation 36) into the above:
√ √
2 1 1
= 2(1 − A2 ) 3 + 4 0.3 + 2A2 3 − 4 0.3
3 7 7
7 √ √
= (1 − A2 ) 3 + 4 0.3 + A2 3 − 4 0.3
3
7 √ √ √
− 3 + 4 0.3 = A2 3 − 4 0.3 − 3 + 4 0.3
3
2 √ √
− − 4 0.3 = A2 (−8 0.3)
3 √
− 23 − 4 0.3
=⇒ A2 = √
−8 0.3
2 1
=⇒ A2 = √ +
24 0.3 2
r !
1 1 10
=⇒ A2 = 1+
2 6 3
Hence, with these coefficients substituted into Equation 29, we have derived the following 4-point Gaussian quadrature
approximation:
r ! ! r ! !
√ √
Z 1 r r
1 1 10 1 1 1 10 1
f (x) dx ≈ 1− f 3 + 4 0.3 + 1− f − 3 + 4 0.3 + ...
−1 2 6 3 7 2 6 3 7
r ! ! r ! ! (38)
√ √
r r
1 1 10 1 1 1 10 1
... + 1+ f 3 − 4 0.3 + 1+ f − 3 − 4 0.3
2 6 3 7 2 6 3 7
Page 12
With a simple index switch (x0 ←→ x3 ), we can attain the same coefficients and pivot values that are presented in the
question:
r !
√
r
1 1 1 10
x0 = − 3 − 4 0.3 , A0 = 1+ (44)
7 2 6 3
r !
√
r
1 1 1 10
x1 = − 3 + 4 0.3 , A1 = 1− (45)
7 2 6 3
r !
√
r
1 1 1 10
x2 = 3 − 4 0.3 , A2 = 1+ (46)
7 2 6 3
r !
√
r
1 1 1 10
x3 = 3 + 4 0.3 , A3 = 1− (47)
7 2 6 3
Page 13
Question 5
In this question, we implement the Romberg algorithm in Matlab and use it to find the approximation to the following
integrals:
Z 1
1
dx = ln (2) (48)
0 1+x
Z 1
ex dx = e1 − 1 (49)
0
Z 1
1 π
dx = (50)
0 (1 + x2 ) 4
Z 1p
2
(x) dx = (51)
0 3
The following plot in Figure 1 displays the error of each ”best” integral approximation against the row and column index,
n, in the Romberg integration scheme. For example, n = 3 refers to the R(3, 3) integral approximation. The reason
why the ”best” approximation of the integral is R(n, n) lies in the definition of the Romberg scheme itself. The first
index (i) in R(i, j) refers to the size of the interval, h, over which the approximation is made (with h = (a − b)/2i ), and
the second index (j) determines the order of accuracy of the approximation in terms of powers of h. Hence, the best
approximation should theoretically be the smallest interval paired with the highest order of accuracy possible, given the
mechanism of the Romberg scheme. For each different h, and therefore i, the highest order of accuracy possible will be
R(i, i), or equivalently R(n, n).
Figure 1: Error in the Romberg integration scheme against row and column index n for different integrals
Page 14
For all four integrals, the error decreases as we update the Romberg scheme and extract the ”best” approximation,
R(n, n), as expected. However, we cannot extract a lot of meaningful information about the convergence rate of the
Romberg integration scheme from this plot, as we do not have guaranteed convergence towards the true integral I for
successive R(n, n) approximations. It can be observed graphically that the error does appear to approach 0 for all four
approximations, but we don’t have theory to guarantee this.
However, we do have guaranteed convergence as we go down a column in the Romberg scheme (corresponding to a specified
order of accuracy, j) and increase i, because i → ∞ implies that h → 0 (ie. the interval widths go to 0). This is precisely
what is formulated with Riemann sums. That is,
We know that this convergence holds so long as f is continuous on the domain of integration, [0, 1]. All four integrals
presented at the start of this question are continuous on [0, 1], so we indeed expect this convergence to hold. Hence, if
we instead plot successive R(i, 1) approximations (moving down the first column of the Romberg scheme), then we can
observe this convergence property, as shown below in Figure 2. Note here that j has been chosen arbitrarily, as this
property is relevant to any column selected.
Figure 2: Error in the first column of the Romberg integration scheme against row index i for different integrals
What can be first observed in this plot is that the absolute error of all four R(i, 1) approximations continues linearly
towards 0 as i is increased (or, equivalently, as h is reduced). Thus, it can be inferred that the approximation is indeed
converging to the true value of the integral for i → ∞.
More interestingly, we can observe a homogeneous convergence rate for the integrals of f1 , f2 and f3 , given by O 212i .
This convergence rate comes from the definition of h, as well as the Euler-Maclaurin Formula. Via the application of the
Page 15
Euler-Maclaurin Formula to the trapezoidal rule for different h (which is simply just the Romberg integration method),
we expect errors of size O(h2j ) for successive columns in the Romberg integration scheme. However, this is only when
the Euler-Maclaurin Formula holds, which necessitates that f and its derivatives up to a specified order are continuous
on the interval of integration, [0, 1]. For f1 , f2 and f3 , all derivatives on [0, 1] are continuous, so we expect errors of the
form O(h2j ) to be applicable. We are examining the first column in Figure 2, so j = 1 is set. Then, h, the width of the
intervals that we are integrating over,
is determined
by i, with hi = (b − a)/2i = 1/2i . That means that our errors should
1 2 1
decrease with convergence rate O 2i = O 22i . This exact convergence rate can be observed graphically in Figure
2.
The approximation to the f4 integral does not follow the expected convergence rate. While it does still display convergence
towards 0, the convergence rate is weaker than the others. This is due to the fact that the Euler-Maclaurin formula does
not hold for f4 , as the first derivative f4′ (x) = 2√
1
x
”blows up” towards infinity at x = 0 (one of our specified integral
bounds) and hence not continuous. So, while the error converges towards 0 (as we expect with any f that is continuous
on [0, 1]), it does so slower than the others.
Page 16