Gauss quadrature Elena Celledoni Department of Mathematical Sciences, NTNU October 23rd 2012 Elena Celledoni NA
Gauss quadrature
Elena Celledoni
Department of Mathematical Sciences, NTNU
October 23rd 2012
Elena Celledoni NA
Gauss quadrature
Consider [a, b] ⊂ R and
I (f ) :=
∫ b
a
w(x) f (x) dx ,
and w(x) is a weight function. Given x0 < x1 · · · < xn, xi ∈ [a, b],
consider the Hermite interpolation polynomial for f on these nodes:
p2n+1(x) =n∑
i=0
Hi (x)f (xi ) +n∑
i=0
Ki (x)f ′(xi ),
Hi (x) = (Li (x))2(1− 2L′i (xi )(x − xi )),
Ki (x) = (Li (x))2(x − xi ),
Li (x) :=n∏
j=0,j 6=i
x − xjxi − xj
L0(x) ≡ 1,putting p2n+1 in place of f in the integral gives an approximation of theintegral:∫ b
a
w(x) f (x) dx ≈n∑
i=0
Wi f (xi )+n∑
i=0
Vi f′(xi ),
Wi :=∫ b
aw(x)Hi (x) dx ,
Vi :=∫ b
aw(x)Ki (x) dx .
Elena Celledoni NA
Gauss quadrature
Consider [a, b] ⊂ R and
I (f ) :=
∫ b
a
w(x) f (x) dx ,
and w(x) is a weight function. Given x0 < x1 · · · < xn, xi ∈ [a, b],consider the Hermite interpolation polynomial for f on these nodes:
p2n+1(x) =n∑
i=0
Hi (x)f (xi ) +n∑
i=0
Ki (x)f ′(xi ),
Hi (x) = (Li (x))2(1− 2L′i (xi )(x − xi )),
Ki (x) = (Li (x))2(x − xi ),
Li (x) :=n∏
j=0,j 6=i
x − xjxi − xj
L0(x) ≡ 1,
putting p2n+1 in place of f in the integral gives an approximation of theintegral:∫ b
a
w(x) f (x) dx ≈n∑
i=0
Wi f (xi )+n∑
i=0
Vi f′(xi ),
Wi :=∫ b
aw(x)Hi (x) dx ,
Vi :=∫ b
aw(x)Ki (x) dx .
Elena Celledoni NA
Gauss quadrature
Consider [a, b] ⊂ R and
I (f ) :=
∫ b
a
w(x) f (x) dx ,
and w(x) is a weight function. Given x0 < x1 · · · < xn, xi ∈ [a, b],consider the Hermite interpolation polynomial for f on these nodes:
p2n+1(x) =n∑
i=0
Hi (x)f (xi ) +n∑
i=0
Ki (x)f ′(xi ),
Hi (x) = (Li (x))2(1− 2L′i (xi )(x − xi )),
Ki (x) = (Li (x))2(x − xi ),
Li (x) :=n∏
j=0,j 6=i
x − xjxi − xj
L0(x) ≡ 1,putting p2n+1 in place of f in the integral gives an approximation of theintegral:∫ b
a
w(x) f (x) dx ≈n∑
i=0
Wi f (xi )+n∑
i=0
Vi f′(xi ),
Wi :=∫ b
aw(x)Hi (x) dx ,
Vi :=∫ b
aw(x)Ki (x) dx .
Elena Celledoni NA
Gauss quadrature
∫ b
a
w(x) f (x) dx ≈n∑
i=0
Wi f (xi )+n∑
i=0
Vi f′(xi ),
Wi :=∫ b
aw(x)Hi (x) dx ,
Vi :=∫ b
aw(x)Ki (x) dx .
Finally we choose x0, . . . , xn such that Vi = 0.We found that this is possible iff
0 = Vi =
∫ b
a
w(x) (Li (x))2(x − xi ) dx = cj
∫ b
a
w(x)ω(x) Li (x) dx
so0 = Vi ⇔ 〈ω, q〉w = 0, ∀q ∈ Πn
which means we should choose x0, . . . , xn to be the zeros of a polynomialω(x) ∈ Πn+1 belonging to a system of orthogonal polynomials w.r.t.〈·, ·〉w .
Elena Celledoni NA
Gauss quadrature
Summarizing∫ b
aw(x) f (x) dx ≈ Gn(f ) :=
n∑i=0
Wi f (xi )
where
Wi :=
∫ b
aw(x) [Li (x)]2 dx
x0, . . . , xn to be the zeros of a polynomial of degree n + 1 belongingto a system of orthogonal polynomials w.r.t. 〈·, ·〉w
Elena Celledoni NA
Ch. 10.4 Error estimation for Gauss quadrature
Theorem 10.1. Let w (weight function) be defined, integrable,continuous and positive on (a, b) and f ∈ C (2n+2)[a, b] (continuousdifferentiable with 2n + 2 continuous derivatives) and n ≥ 0. Then forthe Gauss quadrature ∃ η ∈ (a, b) s.t.∫ b
a
w(x)f (x) dx −n∑
k=0
Wk f (xk) = Kn f(2n+2)(η), (1)
and
Kn =1
(2n + 2)!
∫ b
a
w(x)[ω(x)]2 dx .
So the the Gauss quadrature is exact for polynomials of degree 2n + 1.
Rough estimate:
maxk=0,..,n
|x − xk | = b − a, |ω(x)|2 ≤((n + 1)(b − a)
)2Kn ≤
1(2n + 2)!
(n + 1)2(b − a)2∫ b
a
w(x) dx .
Elena Celledoni NA
Ch. 10.4 Error estimation for Gauss quadrature
Theorem 10.1. Let w (weight function) be defined, integrable,continuous and positive on (a, b) and f ∈ C (2n+2)[a, b] (continuousdifferentiable with 2n + 2 continuous derivatives) and n ≥ 0. Then forthe Gauss quadrature ∃ η ∈ (a, b) s.t.∫ b
a
w(x)f (x) dx −n∑
k=0
Wk f (xk) = Kn f(2n+2)(η), (1)
and
Kn =1
(2n + 2)!
∫ b
a
w(x)[ω(x)]2 dx .
So the the Gauss quadrature is exact for polynomials of degree 2n + 1.Rough estimate:
maxk=0,..,n
|x − xk | = b − a, |ω(x)|2 ≤((n + 1)(b − a)
)2Kn ≤
1(2n + 2)!
(n + 1)2(b − a)2∫ b
a
w(x) dx .
Elena Celledoni NA
Convergence of Gauss quadrature to the integral
Let us denote the Gauss quadrature formula with
Gn(f ) :=n∑
k=0
Wk f (xk)
Theorem 10.2. Let w (weight function) be defined, integrable,continuous and positive on (a, b) and f ∈ C 0[a, b] (continuous in theclosed interval [a, b]). Then
limn→∞
Gn(f ) =
∫ b
a
w(x)f (x) dx .
Proof. Weierstrass theorem: ∀ε0 > 0, ∃ pN (polynomial) such that
|f (x)− pN(x)| ≤ ε0, ∀x ∈ [a, b], pN ∈ ΠN
∫ b
aw(x)f (x) dx − Gn(f ) =
∫ b
aw(x)(f (x)− pN(x)) dx
+
∫ b
aw(x)pN dx − Gn(pN)
+Gn(pN)− Gn(f ).
Elena Celledoni NA
Convergence of Gauss quadrature to the integral
Let us denote the Gauss quadrature formula with
Gn(f ) :=n∑
k=0
Wk f (xk)
Theorem 10.2. Let w (weight function) be defined, integrable,continuous and positive on (a, b) and f ∈ C 0[a, b] (continuous in theclosed interval [a, b]). Then
limn→∞
Gn(f ) =
∫ b
a
w(x)f (x) dx .
Proof. Weierstrass theorem: ∀ε0 > 0, ∃ pN (polynomial) such that
|f (x)− pN(x)| ≤ ε0, ∀x ∈ [a, b], pN ∈ ΠN
∫ b
aw(x)f (x) dx − Gn(f ) =
∫ b
aw(x)(f (x)− pN(x)) dx
+
∫ b
aw(x)pN dx − Gn(pN)
+Gn(pN)− Gn(f ).
Elena Celledoni NA
Ch 10.5 Composite Gauss formulae
∫ b
af (x) dx =
m∑j=1
∫ xj
xj−1
f (x) dx ,
xj − xj−1 = h = b−am , xj = a + j h.
Change of variables: [xj−1, xj ]→ [−1, 1]:
x =12
(xj−1 + xj) +12ht, t ∈ [−1, 1],
∫ b
af (x) dx =
h
2
m∑j=1
∫ 1
−1f (
12
(xj−1 + xj) +12ht) dt =
h
2
m∑j=1
Ij
approximate each Ij with a Gauss quadrature formula:∫ b
af (x) dx ≈ h
2
m∑j=1
n∑k=0
Wk f (12
(xj−1 + xj) +12hξk)
Wk and ξk weights and nodes of Gauss quadrature on [−1, 1].
Elena Celledoni NA
Ch 10.5 Composite Gauss formulae
∫ b
af (x) dx =
m∑j=1
∫ xj
xj−1
f (x) dx ,
xj − xj−1 = h = b−am , xj = a + j h.
Change of variables: [xj−1, xj ]→ [−1, 1]:
x =12
(xj−1 + xj) +12ht, t ∈ [−1, 1],
∫ b
af (x) dx =
h
2
m∑j=1
∫ 1
−1f (
12
(xj−1 + xj) +12ht) dt =
h
2
m∑j=1
Ij
approximate each Ij with a Gauss quadrature formula:∫ b
af (x) dx ≈ h
2
m∑j=1
n∑k=0
Wk f (12
(xj−1 + xj) +12hξk)
Wk and ξk weights and nodes of Gauss quadrature on [−1, 1].
Elena Celledoni NA
Ch 10.5 Composite Gauss formulae
∫ b
af (x) dx =
m∑j=1
∫ xj
xj−1
f (x) dx ,
xj − xj−1 = h = b−am , xj = a + j h.
Change of variables: [xj−1, xj ]→ [−1, 1]:
x =12
(xj−1 + xj) +12ht, t ∈ [−1, 1],
∫ b
af (x) dx =
h
2
m∑j=1
∫ 1
−1f (
12
(xj−1 + xj) +12ht) dt =
h
2
m∑j=1
Ij
approximate each Ij with a Gauss quadrature formula:∫ b
af (x) dx ≈ h
2
m∑j=1
n∑k=0
Wk f (12
(xj−1 + xj) +12hξk)
Wk and ξk weights and nodes of Gauss quadrature on [−1, 1].
Elena Celledoni NA
Ch 10.5 Composite Gauss formulae
∫ b
af (x) dx =
m∑j=1
∫ xj
xj−1
f (x) dx ,
xj − xj−1 = h = b−am , xj = a + j h.
Change of variables: [xj−1, xj ]→ [−1, 1]:
x =12
(xj−1 + xj) +12ht, t ∈ [−1, 1],
∫ b
af (x) dx =
h
2
m∑j=1
∫ 1
−1f (
12
(xj−1 + xj) +12ht) dt =
h
2
m∑j=1
Ij
approximate each Ij with a Gauss quadrature formula:∫ b
af (x) dx ≈ h
2
m∑j=1
n∑k=0
Wk f (12
(xj−1 + xj) +12hξk)
Wk and ξk weights and nodes of Gauss quadrature on [−1, 1].Elena Celledoni NA
Exercise on Lobatto quadrature: exercise 10.7
a) Show that ∀p2n−1 ∈ Π2n−1 on the interval, we have
p2n−1(x) = (x − a)(b − x)q2n−3(x) + r(x − a) + s(b − x),
q2n−3 ∈ Π2n−3, a, b, r , s ∈ R, with a and b notsimultaneously zero.Note: (x − a), (x − b), (x − a)(b− x)xk and k = 0, . . . , 2n− 3with a and b not simultaneously zero is a basis for Π2n−1.
Solution: using the given basis we can write
p2n−1(x) = (x−a)(b−x)2n−3∑k=0
λkxk+λ2n−2(x−a)+λ2n−1(b−x),
and so taking q2n−3(x) :=∑2n−3
k=0 λkxk and r := λ2n−2,
s := λ2n−1, we see that there existq2n−3 ∈ Π2n−3, a, b, r , s ∈ R, such that any p2n−1 ∈ Π2n−1can be written in the given form.
Elena Celledoni NA
Exercise on Lobatto quadrature: exercise 10.7
a) Show that ∀p2n−1 ∈ Π2n−1 on the interval, we have
p2n−1(x) = (x − a)(b − x)q2n−3(x) + r(x − a) + s(b − x),
q2n−3 ∈ Π2n−3, a, b, r , s ∈ R, with a and b notsimultaneously zero.Note: (x − a), (x − b), (x − a)(b− x)xk and k = 0, . . . , 2n− 3with a and b not simultaneously zero is a basis for Π2n−1.Solution: using the given basis we can write
p2n−1(x) = (x−a)(b−x)2n−3∑k=0
λkxk+λ2n−2(x−a)+λ2n−1(b−x),
and so taking q2n−3(x) :=∑2n−3
k=0 λkxk and r := λ2n−2,
s := λ2n−1, we see that there existq2n−3 ∈ Π2n−3, a, b, r , s ∈ R, such that any p2n−1 ∈ Π2n−1can be written in the given form.
Elena Celledoni NA
Exercise on Lobatto quadrature: exercise 10.7
a) Show that ∀p2n−1 ∈ Π2n−1 on the interval, we have
p2n−1(x) = (x − a)(b − x)q2n−3(x) + r(x − a) + s(b − x),
q2n−3 ∈ Π2n−3, a, b, r , s ∈ R, with a and b notsimultaneously zero.Note: (x − a), (x − b), (x − a)(b− x)xk and k = 0, . . . , 2n− 3with a and b not simultaneously zero is a basis for Π2n−1.Solution: using the given basis we can write
p2n−1(x) = (x−a)(b−x)2n−3∑k=0
λkxk+λ2n−2(x−a)+λ2n−1(b−x),
and so taking q2n−3(x) :=∑2n−3
k=0 λkxk and r := λ2n−2,
s := λ2n−1, we see that there existq2n−3 ∈ Π2n−3, a, b, r , s ∈ R, such that any p2n−1 ∈ Π2n−1can be written in the given form.
Elena Celledoni NA
Exercise on Lobatto quadrature: exercise 10.7
b) Construct the Lobatto quadrature formula
∫ b
aw(x)f (x) dx ≈W0f (a) +
n−1∑k=1
Wk f (xk ) + Wnf (b)
which is exact when f ∈ Π2n−1. Here w(x) is a weight function.
Solution: using the formula obtained in a), w(x) := w(x)(x − a)(b − x)∫ b
aw(x)p2n−1(x)dx =
∫ b
aw(x)q2n−3(x)dx+r
∫ b
aw(x)(x−a)dx+s
∫ b
aw(x)(b−x)dx ,
and using the Gauss quadrature with n − 1 weights and nodes (W ∗k , x
∗k ) wrt
w(x) one gets,
∫ b
aw(x)p2n−1(x)dx =
n−1∑k=1
W ∗k q2n−3(x∗k )+r
∫ b
aw(x)(x−a)dx+s
∫ b
aw(x)(b−x)dx ,
for an arbitrary polynomial p2n−1 ∈ Π2n−1. Since
q2n−3(x∗k ) =p2n−1(x∗k )− r(x∗k − a)− s(b − x∗k )
(x∗k − a)(b − x∗k )
r = p2n−1(b)/(b − a), s = p2n−1(a)/(b − a).
Elena Celledoni NA
Exercise on Lobatto quadrature: exercise 10.7
b) Construct the Lobatto quadrature formula
∫ b
aw(x)f (x) dx ≈W0f (a) +
n−1∑k=1
Wk f (xk ) + Wnf (b)
which is exact when f ∈ Π2n−1. Here w(x) is a weight function.Solution: using the formula obtained in a), w(x) := w(x)(x − a)(b − x)∫ b
aw(x)p2n−1(x)dx =
∫ b
aw(x)q2n−3(x)dx+r
∫ b
aw(x)(x−a)dx+s
∫ b
aw(x)(b−x)dx ,
and using the Gauss quadrature with n − 1 weights and nodes (W ∗k , x
∗k ) wrt
w(x) one gets,
∫ b
aw(x)p2n−1(x)dx =
n−1∑k=1
W ∗k q2n−3(x∗k )+r
∫ b
aw(x)(x−a)dx+s
∫ b
aw(x)(b−x)dx ,
for an arbitrary polynomial p2n−1 ∈ Π2n−1. Since
q2n−3(x∗k ) =p2n−1(x∗k )− r(x∗k − a)− s(b − x∗k )
(x∗k − a)(b − x∗k )
r = p2n−1(b)/(b − a), s = p2n−1(a)/(b − a).
Elena Celledoni NA
Exercise on Lobatto quadrature: exercise 10.7
b) Construct the Lobatto quadrature formula
∫ b
aw(x)f (x) dx ≈W0f (a) +
n−1∑k=1
Wk f (xk ) + Wnf (b)
which is exact when f ∈ Π2n−1. Here w(x) is a weight function.Solution: using the formula obtained in a) and the Gauss quadrature with n− 1weights and nodes (W ∗
k , x∗k ) wrt w(x) = w(x)(x − a)(b − x) one gets,
∫ b
aw(x)p2n−1(x)dx = W0p2n−1(a) +
n−1∑k=1
Wkp2n−1(xk ) + Wnp2n−1(b)
x0 := a, xn := b, xk := x∗k , Wk :=W ∗
k
(x∗k − a)(b − x∗k ), k = 1, . . . , n − 1,
W0 :=1
b − a
(∫ b
aw(x)(b − x)dx −
n−1∑k=1
W ∗k
x∗k − a
),
Wn :=1
b − a
(∫ b
aw(x)(x − a)dx −
n−1∑k=1
W ∗k
b − x∗k
).
Elena Celledoni NA
Exercise on Lobatto quadrature: exercise 10.7
c) Prove that the weights are positive.
Solution: Wk :=W∗
k(x∗
k−a)(b−x∗
k)k = 1, . . . , n − 1 are positive because W ∗
k are
the Gaussian weights which are known to be positive (see beginning of chapter10). We now prove that W0 is positive, the proof is similar for Wn.
W0 :=1
b − a
(∫ b
aw(x)(b − x)
(x − a)
(x − a)dx −
n−1∑k=1
W ∗k
x∗k − a
),
with w(x) = w(x)(x − a)(b − x)
W0 =1
b − a
(∫ b
aw(x)
1(x − a)
dx −n−1∑k=1
W ∗k
x∗k − a
),
this is the error for the Gauss quadrature on m + 1 = n − 1 nodes for 1x−a
wrtw . Using theorem 10.1 (with n in the theorem replaced by m and m = n − 2)we get
W0 =1
b − aKm
d2m+2
dx2m+2
(1
x − a
).
Km = 1(2m+2)!
∫ ba w(x)(ω(x))2 dx (see theorem 10.1) is always positive, and the
even derivatives of 1x−a
are always positive.
Elena Celledoni NA
Exercise on Lobatto quadrature: exercise 10.7
c) Prove that the weights are positive.
Solution: Wk :=W∗
k(x∗
k−a)(b−x∗
k)k = 1, . . . , n − 1 are positive because W ∗
k are
the Gaussian weights which are known to be positive (see beginning of chapter10).
We now prove that W0 is positive, the proof is similar for Wn.
W0 :=1
b − a
(∫ b
aw(x)(b − x)
(x − a)
(x − a)dx −
n−1∑k=1
W ∗k
x∗k − a
),
with w(x) = w(x)(x − a)(b − x)
W0 =1
b − a
(∫ b
aw(x)
1(x − a)
dx −n−1∑k=1
W ∗k
x∗k − a
),
this is the error for the Gauss quadrature on m + 1 = n − 1 nodes for 1x−a
wrtw . Using theorem 10.1 (with n in the theorem replaced by m and m = n − 2)we get
W0 =1
b − aKm
d2m+2
dx2m+2
(1
x − a
).
Km = 1(2m+2)!
∫ ba w(x)(ω(x))2 dx (see theorem 10.1) is always positive, and the
even derivatives of 1x−a
are always positive.
Elena Celledoni NA
Exercise on Lobatto quadrature: exercise 10.7
c) Prove that the weights are positive.
Solution: Wk :=W∗
k(x∗
k−a)(b−x∗
k)k = 1, . . . , n − 1 are positive because W ∗
k are
the Gaussian weights which are known to be positive (see beginning of chapter10). We now prove that W0 is positive, the proof is similar for Wn.
W0 :=1
b − a
(∫ b
aw(x)(b − x)
(x − a)
(x − a)dx −
n−1∑k=1
W ∗k
x∗k − a
),
with w(x) = w(x)(x − a)(b − x)
W0 =1
b − a
(∫ b
aw(x)
1(x − a)
dx −n−1∑k=1
W ∗k
x∗k − a
),
this is the error for the Gauss quadrature on m + 1 = n − 1 nodes for 1x−a
wrtw .
Using theorem 10.1 (with n in the theorem replaced by m and m = n − 2)we get
W0 =1
b − aKm
d2m+2
dx2m+2
(1
x − a
).
Km = 1(2m+2)!
∫ ba w(x)(ω(x))2 dx (see theorem 10.1) is always positive, and the
even derivatives of 1x−a
are always positive.
Elena Celledoni NA
Exercise on Lobatto quadrature: exercise 10.7
c) Prove that the weights are positive.
Solution: Wk :=W∗
k(x∗
k−a)(b−x∗
k)k = 1, . . . , n − 1 are positive because W ∗
k are
the Gaussian weights which are known to be positive (see beginning of chapter10). We now prove that W0 is positive, the proof is similar for Wn.
W0 :=1
b − a
(∫ b
aw(x)(b − x)
(x − a)
(x − a)dx −
n−1∑k=1
W ∗k
x∗k − a
),
with w(x) = w(x)(x − a)(b − x)
W0 =1
b − a
(∫ b
aw(x)
1(x − a)
dx −n−1∑k=1
W ∗k
x∗k − a
),
this is the error for the Gauss quadrature on m + 1 = n − 1 nodes for 1x−a
wrtw . Using theorem 10.1 (with n in the theorem replaced by m and m = n − 2)we get
W0 =1
b − aKm
d2m+2
dx2m+2
(1
x − a
).
Km = 1(2m+2)!
∫ ba w(x)(ω(x))2 dx (see theorem 10.1) is always positive, and the
even derivatives of 1x−a
are always positive.
Elena Celledoni NA
Exercise relevant for the project
Show that
|f (x)− s(x)| ≤ 78h2 ‖f ′′‖∞, ∀x ∈ [a, b],
where f ∈ C 2[a, b] and s is the natural cubic spline on theequidistant knots a = x0 < x1 < · · · < xn = b, xi − xi−1 = h,i = 1, . . . , n.Plan:a) Show first: |f (x)− s(x)| ≤ h2
8 (‖f ′′‖∞ + maxi |s ′′i |);b) show then that |s ′′i | ≤ 6 ‖f ′′‖∞ to obtain the result. (For the
solution see problem set 5 exercise 3.)
Elena Celledoni NA
Solution of point a)
Recall f (xj) = s(xj) and f (xj−1) = s(xj−1). Fix a x ∈ [xj−1, xj ] andconsider
g(x) := f (x)− s(x)− (x − xj−1)(x − xj)
(x − xj−1)(x − xj)(f (x)− s(x)), ∀x ∈ [xj−1, xj ],
and 0 = g(x) = g(xj−1) = g(xj). So there exists ξj(x) ∈ (xj−1, xj) suchthat
0 = g ′′(ξj) = f ′′(ξj)− s ′′(ξj)−2
(x − xj−1)(x − xj)(f (x)− s(x)),
this imples
f (x)− s(x) = (x − xj−1)(x − xj)f ′′(ξj)− s ′′(ξj)
2,
and |(x − xj−1)(x − xj)| ≤ h2/4,
|f (x)− s(x)| ≤ h2
8(|f ′′(ξj)|+ |s ′′(ξj)|),
leading to the proof of point a).Elena Celledoni NA
Adaptive quadrature: Adaptive Simpson
Adaptive quadrature: given a tolerance TOL find I ≈ I s.t.
|I − I | ≤ TOL.
Consider
I =
∫ b
a
f (x) dx ,
Simpson:
S(a, b) :=b − a
6
[f (a) + f
(a + b
2)
+ f (b)
]error
E (a, b) = − 190
(b − a
2
)5
f (4)(ξ), ξ ∈ (a, b),
I = S + E
Plan:
1 Subdivide [a, b] recursively in disjoint subintervals;
2 apply S on each subinterval;
3 stop when |I − I | ≤ TOL is satisfied.
Elena Celledoni NA
Error estimate
Case of two subintervals [a, b] = [a, c] ∪ [c, b] c := a+b2 , h = b − a.
LetI0 = S(a, b), E0 = E (a, b), I = I0 + E0
I = S(a, c) + S(c , b), E = E (a, c) + E (c , b), I = I + E
E = − 190
(12h
2
)5 (f (4)(ξ1) + f (4)(ξ2)
), ξ1 ∈ (a, c), ξ2 ∈ (c , b)
by the intermediate value theorem, since f 4 is assumed continuous,we have
E = − 190
116
(h
2
)5 (f (4)(ξ)
), ξ ∈ (a, b),
we will assume that for h small f (4)(ξ) ≈ f (4)(ξ) this gives
E0 ≈ 16 E , |I − I0| = |E0 − E | ≈ 15|E | ⇒ |E | ≈ |I − I0|15
Elena Celledoni NA
adaptiveS(f , a, b,TOL)
I0 = S(a, b)
c := b+a2
I = S(a, c) + S(c , b)
IF 115 |I − I0| ≤ TOL then I = I + 1
15(I − I0)
ELSE
I =adaptiveS(f , a, c , TOL2 )+adaptiveS(f , c , b, TOL
2 )
END
RETURN IElena Celledoni NA