




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Numerical Computing, F’05 Professor Kapila
Sample Problems, Some With Solutions, For Final Exam
i. Using higher-precision arithmetic will make an ill-conditioned problem better conditioned. F
ii. A stable algorithm applied to a well-conditioned problem produces an accurate solution. T iii. In a floating-point number system the underflow level is the smallest positive number that perturbs the number 1 when added to it. F iv. If two real numbers are exactly representable as floating-point numbers, then their product will also be exactly representable as a floating-point number. F v. If a linear system is well-conditioned then pivoting is unnecessary in Gaussian elimination. F
vi. If a matrix has a very small determinant then it is nearly singular. F vii. The norm of a singular matrix is zero. F viii. If A is a nonsingular matrix, then A and A−^1 have the same condition numbers. T ix. For a linear system, a small residual necessarily implies an accurate solution. F x. Newton’s method for finding the root of f (x) = 0 does not always converge quadratically. T
(b) Define the following terms. i. The convergence rate r of an iterative method. Let the absolute value of error at step n of the iterative method be en. Let us further suppose that lim n→∞
en+ ern
Then the method converges linearly if r = 1 and C < 1. It converges with rate r if r > 1. ii. Richardson’s extrapolation. Let the numerical approximation to a quantity Q be N (h) where h is the step size, and let
Q = N (h) + a 1 hp^ + a 2 hq^ + · · · ,
where q > p > 0. Richardson extrapolation uses a second approximation, at step size αh, say, where α < 1 , to obtain a higher-order approximation to Q. We have
Q = N (αh) + a 1 αphp^ + a 2 αq^ hq^ + · · ·.
Elimination of a 1 from the last two equations leads to the more accurate result
N (αh) − αpN (h) 1 − αp^
hq 1 − αp^
(d) Find the condition number κ(A) of the matrix
For = 0. 01 , what is the value of κ(A)? Is A well-conditioned or ill-conditioned in this case?
x 1 x 2 x 3
b 1 b 2 b 3
When using Gaussian elimination, what will the initial pivot element be if (i) no pivoting is used, (ii) partial pivoting is used, and (iii) complete pivoting is used? In each case, rewrite the above system so that the appropriate element is in the pivot position. (b) Consider the system (^) [ 1 1 1
x 1 x 2
i. Solve this system by Gaussian elimination without pivoting. Show all steps. (Only carry out the minimum number of operations; do not simplify. For example, if your answer is a quotient involving the quantity 1/ in the numerator and the denominator, do not simplify by multiplying throughout with . ) ii. Suppose that = 10−^8 and that you are computing on a normalized decimal machine with 6-digit precision. What answers will the machine give for x 1 and x 2? iii. Repeat parts (i) and (ii) above, but now use pivoting. iv. Determine the exact solution for = 10−^8. Find the relative errors in the computation of x 1 and x 2 for each of the two cases above. What conclusion do you draw about the merit of pivoting?
ex^ + x^2 5
Determine whether the fixed-point iteration xn = g(xn− 1 ) will converge for each of the two roots.
To minimize the error,
∂E ∂c
= 2(c ln 2 − 3) ln 2 + 2(c ln 3 − 4) ln 3 = 0.
Then, c =
3 ln 2 + 4 ln 3 ln^2 2 + ln^2
(b) Observe that for f = 2 sin x, |f ′′(x) = −2 sin x| which is bounded by 2. Therefore a bound on the error on a typical interval, [0, h], is
x(x − h) 2
f ′′(ξ)
x(x − h) 2
∣ ≤^ max|x(x^ −^ h)|,
where the maximum is taken over the interval [0, h]. This maximum will occur at h/2 and is h^2 / 4. Therefore the prescribed tolerance is satisfied if h^2 / 4 < 0. 01 , or h < 0. 2.
f ′(x) ≈ D(h) ≡
2 h
[4f (x + h) − 3 f (x) − f (x + 2h)]
and show that the associated error term is of the form (h^2 /3)f ′′′ (ξ). If the interval is halved and f ′(x) is also approximated by D(h/2), then what combination of D(h) and D(h/2) gives an improved estimate of f ′(x)? Justify your conclusion. (b) Write down (but do not solve) the equations whose solution will determine the parameters ai and bi so that S(x) is a natural cubic spline interpolating the data (− 1 , 1), (0, 2), (1, −1), where
S(x) =
a 1 x^3 + a 2 x^2 + a 3 x + a 4 − 1 ≤ x ≤ 0 b 1 x^3 + b 2 x^2 + b 3 x + b 4 0 ≤ x ≤ 1.
(a) Consider the following Taylor series:
f (x + h) = f (x) + hf ′(x) + h^2 2!
f ′′(x) + h^3 3!
f ′′′(x) + h^4 4!
f (x) = f (x)
f (x + 2h) = f (x) + 2hf ′(x) +
4 h^2 2!
f ′′(x) +
8 h^3 3!
f ′′′(x) +
16 h^4 4!
Then,
4 f (x + h) − 3 f (x) − f (x + 2h) = 4[f (x) + hf ′(x) +
h^2 2!
f ′′(x) +
h^3 3!
f ′′′(x) +
h^4 4!
− 3 f (x)
−[f (x) + 2hf ′(x) +
4 h^2 2! f ′′(x) +
8 h^3 3! f ′′′(x) +
16 h^4 4!
= 2 hf ′(x) − 4 h^3 3!
f ′′′(x) + · · ·.
Therefore,
f ′(x) =
2 h
[4f (x + h) − 3 f (x) − f (x + 2h)] + h^2 3
f ′′(x) + · · ·
= D(h) +
h^2 3
f ′′(x) + · · ·.
Upon halving the interval we get
f ′(x) = D(h/2) +
h^2 12
f ′′(x) + · · ·.
Upon eliminating the O(h^2 ) term from the last two equations we get the better estimate
f ′(x) ≈
4 D(h/2) − D(h) 3
(b) The following conditions apply: 3 interpolation conditions, 3 conditions from continuity of S, S′ and S′′^ at x = 0, and two natural conditions S′′(−1) = S′′(1) = 0. Note that
S′(x) =
3 a 1 x^2 + 2a 2 x + a 3 − 1 ≤ x ≤ 0 3 b 1 x^2 + 2b 2 x + b 3 0 ≤ x ≤ 1 ,
and S′′(x) =
6 a 1 x + 2a 2 − 1 ≤ x ≤ 0 6 b 1 x + 2b 2 0 ≤ x ≤ 1. The eight equations are, in the order described above,
−a 1 + a 2 − a 3 + a 4 = 1 , a 4 = 2 , b 1 + b 2 + b 3 + b 4 = − 1 , a 4 − b 4 = 0 , a 3 − b 3 = 0 , a 2 − b 2 = 0 , − 6 a 1 + 2a 2 = 0 , 6 b 1 + 2b 2 = 0.
(a) Use Newton interpolation to find the polynomial interpolant for the above data. (b) Use the interpolant to estimate the population in the year 2000. What population trend do you see? (c) Will the result in part (b) above change if you interpolated by using a different set of basis functions that are not polynomials?
(a) The Newton form of the interpolant is
P (x) = a 1 + a 2 (x − 1950) + a 3 (x − 1950)(x − 1960) + a 4 (x − 1950)(x − 1960)(x − 1970) +a 5 (x − 1950)(x − 1960)(x − 1970)(x − 1980).
Interpolation requirement leads to the equations
a 1 = 150 a 1 + 10a 2 = 180 a 1 + 20a 2 + 20 · 10 a 3 = 200 a 1 + 30a 2 + 30 · 20 a 3 + 30 · 20 · 10 a 4 = 225 a 1 + 40a 2 + 40 · 30 a 3 + 40 · 30 · 20 a 4 + 40 · 30 · 20 · 10 = 250.
the solution of this tridiagonal system is
a 1 = 150, a 2 = 3, a 3 = − 1 / 20 , a 4 = 1/ 400 , a 5 = −(5/6)10−^4.
Let yn represent the numerical approximation to the solution y(tn). Every single-step numerical method for the ODE is of the form
yn+1 = yn + H(h, tn, yn),
where h is the step size and the function H depends upon the numerical method chosen. Write down the expression for H(h, tn, yn) for the Taylor method of order 2.
(b) Specialize the problem of part (a) above to t 0 = 0, y 0 = 1, h = 0.1 and f (t, y) = (y + t)e−^2 y^. Then write down the value of y 1. (c) Consider the ODE initial-value problem
dy dt
= − 5 y, y(0) = 1.
Suppose that Taylor method of order 2 is to be used to compute the solution numerically. What constraint must be placed on the step size h to ensure that the computation is stable?
(a) yn+1 = yn + hf (tn, yn) +
h^2 2
[ft(tn, yn) + f (tn, yn)fy (tn, yn)].
(b) We have ft = e−^2 y^ and fy = (1 − 2 y − 2 t)e−^2 y^. Therefore the above method, when specialized to n = 0, yields the following.
y 1 = y 0 + hf (t 0 , y 0 ) +
h^2 2
[ft(t 0 , y 0 ) + f (t 0 , y 0 )fy (t 0 , y 0 )
= y 0 + h(y 0 + t 0 )e−^2 y^0 +
h^2 2
[e−^2 y^0 + (1 − 2 y 0 − 2 t 0 )e−^2 y^0 ]
= 1 + 0. 1 × e−^2 + 0.005[e−^2 − e−^2 ] = 1 + 0. 1 × e−^2.
(c) For the given ODE, f = − 5 y, ft = 0, fy = − 5. The Taylor method of order 2 yields
yn+1 = yn + hf (tn, yn) +
h^2 2
[ft(tn, yn) + f (tn, yn)fy (tn, yn)]
= yn + h(− 5 yn) +
h^2 2 [0 + (− 5 yn)(−5)]
= yn − 5 hyn +
h^2 yn
1 − 5 h +
h^2
yn.
This difference equation, subject to y 0 = 1, has solution
yn = βn,
where β = 1 − 5 h +
h^2.
For the numerical solution to decay we must have
− 1 < 1 − 5 h +
h^2 < 1.
The right inequality gives h < 2 / 5. and then, the left inequality is automatically satisfied.
y′(t) = f (t, y), y(t 0 ) = y 0. (1)
Define the term stability for this mathematical problem. Classify the following ODEs as to stability or instability. i. y′(t) = 5y − e−^10 t. ii. y′(t) = 5t + e−^10 y^. (b) Let y(tn) be the exact solution of the problem (1) at t = tn, and yn the corresponding numerical approximation. What does one mean by the terms local truncation error and global error? Is there any relationship between these two quantities? (c) Write down the following problem as a system of two first-order ODEs and calculate the approx- imate solution at t = 0.1 by using one step of the forward Euler method.
x′′(t) = x^2 et^ + x′(t), x(0) = 1, x′(0) = 2.
(d) The following numerical method is proposed for problem (1):
yn+1 = yn +
h 2
[f (tn, yn) + f (tn+1, yn+1)].
i. State whether the numerical algorithm is (i) implicit or explicit, and (ii) single-step or mul- tistep. ii. Find the local truncation error for the method, by employing Taylor series or otherwise.