Professional Documents
Culture Documents
Fall 2023
COMPUTATIONAL METHODS FOR ENGINEERS Homework 2
Problem 1: (30%)
For the linear system Ax “ b:
» fi » fi » fi
1 1 1 1 1 x1 1
— 2 4 8 16 32 ffi — x2 ffi — 22 ffi
— ffi — ffi — ffi
— 3 9 27 81 243 ffi — x3 ffi “ — 183 ffi (1)
— ffi — ffi — ffi
– 4 16 64 256 1024 fl – x4 fl – 820 fl
5 25 125 625 3125
looooooooooooooooomooooooooooooooooon x5
looomooon 2605
loooomoooon
A x b
2. (5%) Solve (1) using Gauss elimination method. Verify your result.
A “ P L U, (2)
4. (5%) Based on the factorization in (2), solve (1) from the following steps:
U x “ y, L y “ z, P z “ b.
5. (5%) Compare your previous results (from 2. and 4.) with the ones obtained by
6. (5%) Can you solve (1) by iterative methods, e.g., Jacobi, Gauss-Seidel methods? Explain.
Problem 2: (20%)
Determine the concentration of chloride in each of the Great Lakes using the information
180 QSH = 67
QMH = 36
QHE = 161
QEO = 182
QOO = 212
Superior QSHcS 740
3850
QHEcH
Superior
Erie
QOOcO
FIGURE P12.7
A chloride balance for the Michigan QMHcM Ontario
Great Lakes. Numbered arrows
are direct inputs.
Hint: Great Lakes are shown in Figure 1. We aim to estimate the concentration of chloride in
each of the Great Lakes (i.e., Superior, Michigan, Huron, Erie, Ontario) based on Fig. P12.7
using the basic approach in Section 12.1, p. 319, Textbook (read the section!).
As shown in Fig. P12.7, one denotes by c (mg{m3 ) and Q (m3 {min) the concentration of
chloride and the flow rate, respectively. For instance, cS stands for the concentration of chloride
in Superior, and QSH for the flow rate between Superior and Huron.
For five parameters QSH , QMH , QHE , QEO , QOO , we want to calculate 5 unknowns
cS , cM , cH , cE , cO .
To do that, we need to construct a system of five equations involving the unknowns.
For steady state, the conservation of mass can be applied to the lakes as follows
ÿ ÿ
chloride in “ chloride out
For example, consider the case of Huron in which the conservation of mass of chloride yields
Q SH cS ` 740 ` QMH cM
loooooooooooooooomoooooooooooooooon “ Q HE cH .
loomoon
ř ř
chloride in chloride out
We obtain one of the equations. Seek for the rest of the linear system and solve it!
Problem 3: (20%)
Solve Problem 12.6 (Textbook, p. 331).
Problem 4: (10%)
Choose a proper solver and solve Problem 12.25 (Textbook, p. 336).
Problem 5: (20%)
Polynomial interpolation consists of determining the unique pn´1qth-order polynomial that
fits n data points. Such polynomials have the general form,
f pxq “ p1 xn´1 ` p2 xn´2 ` . . . ` pn´1 x ` pn (3)
where the p1 s are constant coefficients. A straightforward way for computing the coefficients is
to generate n linear algebraic equations that we can solve simultaneously for the coefficients.
Suppose that we want to determine the coefficients of the fourth-order polynomial (n “ 5)
f pxq “ p1 x4 ` p2 x3 ` p3 x2 ` p4 x ` p5 (4)
that passes through the following five points:
pxi , yi q P tp200, 0.746q, p250, 0.675q, p300, 0.616q, p400, 0.525q, p500, 0.457qu . (5)
Each of these pairs can be substituted into Eq. (3) to yield a system of five equations with five
unknowns (the p1 s).
1. (10%) Find the coefficients tpk uk“1,4 in (4). Show the graph of y “ f pxq, where f is
defined in (4), and the data points (5) in the same figure.
2. (10%) We aim at investigating the above polynomial interpolation for general cases. For
n P N given arbitrarily. Let tpxi , yi qui“1,n be some data set that is generated randomly
by using gpxq:
1
(a) gpxq “ g1 pxq “ 1`e´x
,
(b) gpxq “ g2 pxq “ tanhpx ´ 5q,
i.e., yi “ gpxi q for xi P r1, 10s, where txi u are selected randomly. Perform the polynomial
interpolation (3) for each case of gpxq. Explain your results when n becomes large.
(Source: Problem 10.25 Textbook.)
Therefore we obtain the first linear algebraic equation. Continue to complete the system. Then
solve it for p1 , . . . , p5 .