Starting from:

$30

MATH 340 LAB 10 Assignment

MATH 34
LAB 10 Assignment
DUE Tuesday 04-05-2016
Numerical Integration:
Gaussian Quadrature
To approximate integrals of the form
I(f) = Z 1
−1
f(x)dx ,
we use the nodes {x1, x2, . . . , xn} and the weights or coefficients {c1, c2, . . . , cn} in
the Gaussian quadrature formula:
In(f) = Xn
j=1
cjf(xj ) . (1)
To transform a generic given integral I(f) = R b
a
f(x)dx to one with endpoints of
integration [−1, 1] to use the formula (1) above, we need a change of variable that
transforms the generic domain x ∈ [a, b] to t ∈ [−1, 1] (and viceversa). That is,
we need to express x =
b+a+t(b−a)
2
, so that −1 ≤ t ≤ 1 is equivalent to a ≤ x ≤ b.
We can then rewrite (1) with the function f expressed in the form:
I(f) = Z 1
−1
f

(b − a)t + b + a
2

b − a
2
dt (2)
This is formula (5.46) in your textbook.
Problem 1:
Use the form (2) for your integrand in the Gaussian quadrature formula (1) with
n = 2, 4, 6, 8, using nodes and weights from the table attached to this document
1
to approximate respectively:
(a)
Z 2
1
ln xdx = 2 ln 2 − 1 ≈ 0.38629436111989
(b)
Z 4
0
x

x
2 + 9
dx = 2
(c)
Z 1
0
xex
dx = 1
(d)
Z 2
−1
x
5
dx = 10.5
For each of the approximated integrals In(f) calculate the error from the exact
value of the integral I(f), given by
Errn = |I(f) − In(f)|
Show your results in a tabular form as you did for last Lab assignment. Show
for each execution (a) − (d) in columns n, In(f), Errn.
Comment on your results.
2

More products