• Aucun résultat trouvé

The Numerical Solution of Linear Systems

4.3 THE PIVOTING STRATEGY

4.2-9 use subroutine TRID to solve the linear system

when n = 30 and h = 0.1.

4.2-10 Use Theorem 4.6 and the corollary to Lemma 2.1 to prove that every polynomial of degree < n can be written in exactly one way in Newton form for given centers c1, . . . , cn. (Hint: Consider the linear system for the coefficients in the Newton form for a polynomial which agrees with a given function at c1, . . . , cn, cn+1.)

4.2-11 Prove Theorem 4.7. (Hint: Prove first that any solution of Ax = b remains a solution o f Then show that any operation of the kind mentioned can be undone by an operation of the same kind, hence show that Ax = b can in turn be obtained from b y a sequence of such operations.)

4.3 THE PIVOTING STRATEGY

The elimination algorithm 4.2 presented in the preceding section calculates efficiently and with certainty the solution of any system A x = b, if all calculations are carried out in infinite-precision arithmetic. If, as is more usual, finite-precision arithmetic is used, it is not difficult to give examples for which Algorithm 4.2 produces completely erroneous answers.

In this section, we discuss briefly just one possible source for such a failure, an incorrect pivoting strategy. Here, we mean by pivoting strategy the scheme used to choose the pivotal equation (and, possibly even the pivotal column) at each elimination step.

Example 4.4 The solution of the system

is xl = 10, x2 = 1. We use four-decimal floating arithmetic to solve this system by elimination, picking the first equation as the pivotal equation during the first (and only) step. We get the multiplier

Hence

This gives

Hence, from the first equation,

A “plausible” explanation of this failure goes as follows: The pivot entry a11 = 0.0003 is “very small”; since the computations would break down if a11 were zero, it is not surprising that, in the environment of finite-precision arithmetic, the algorithm performs badly for a1 1 “near zero.”

Of course, this explanation uses such undefined terms as “very small”

and “near zero” and is therefore quite useless. In fact, by multiplying the first equation by an appropriate power of 10, we can make a,, as large as we wish without changing the computed solution. To see this, consider again the system of Example 4.4, but with the first equation multiplied by 10m, where m is some integer:

Using again the first equation floating arithmetic, we get

as pivotal equation, and using four-decimal

Hence

which is the same result as before. Hence again x2 = 1.001, and finally, x1 = (0.001 · 10m)/(0.0003 · 10m) = 3.333.

Actually, the failure in this example is due to the fact that |a11| is small compared with |a12|; thus a relatively small error due to roundoff in the computed x2 led to a large variation of the computed x1, from the correct x1. This is confirmed if we use equation 2 as pivotal equation, where

as compared with We get

and the new first equation becomes

so that x2 = 1, the correct answer, and finally, from the second equation, x1 = 10. But even if roundoff had conspired to give x2 = 1.001 (as it did in Example 4.4), the second equation would still give

a good result.

4.3 THE PlVOTING STRATEGY 159 It is much more difficult (if not impossible) to ascertain for a general linear system how various pivoting strategies affect the accuracy of the computed solution. A notable and important exception to this statement are the linear systems with positive definite coefficient matrix, that is, systems whose coefficient matrix satisfies

For such a system, the error in the computed solution due to rounding errors during elimination and back-substitution can be shown [41; p. 127]

to be acceptably small if the trivial pivoting strategy of no interchanges is used. (See Exercise 4.4-9 for an efficient algorithm for this case.) But it is not possible at present to give a “best” pivoting strategy for a general linear system, nor is it even clear what such a term might mean.

For the sake of economy, the pivotal equation for each step must be selected on the basis of the current state of the system under consideration at the beginning of the step, i.e., without foreknowledge of the effect of the selection on later steps.

A currently accepted strategy is scaled partial pivoting. In this strategy, one calculates initially the “size” di of row i of A, for i = 1, . . . , n. A convenient measure of this size is (see Sec. 4.5) the number

Then, at the beginning of the general, or kth, step of the elimination Algorithm 4.2, one picks as pivotal equation that one from the available n - k candidates which has the absolutely largest coefficient of xk relative to the size of the equation. In the terms of Algorithm 4.2, this means that the integer j is selected as the (usually smallest) integer between k and n for which

Clearly, scaled partial pivoting selects the correct pivoting strategy for the system in Example 4.4, and is not thrown off by a resealing of the equations.

It is possible to modify Algorithm 4.2 so as to leave not only the pivotal equation, but also the unknown to be eliminated open to choice. In this modification, one chooses two permutations, p and q, which designate the pkth equation as the equation to be used during the kth step to eliminate k = 1, . . . , n - 1. In total pivoting, pivotal equation and unknown are selected by looking for the absolutely largest coefficient of any of the n - k unknowns in any of the n - k candidate equations. Of course, such a strategy is much more expensive than scaled partial pivot-ing, hence is not often employed, even though it is admittedly superior to partial pivoting.

EXERCISES

4.3-1 Describe a modification of Algorithm 4.2 which incorporates total pivoting.

4.3-2 Give an example of a 2 × 2 linear system for which total pivoting gives more accurate results than scaled partial pivoting in four-decimal floating arithmetic. (Hint: Make both al1

and a21 “small” compared with a12 and a22.)

4.3-3 Solve the following linear system, using four-decimal floating arithmetic, once with the first equation as pivotal equation and once with the second equation as pivotal equation, and finally with total pivoting.

Compare with the exact answer x1 = 1.000, x2 = 0.2500.

4.34 Solve the system of Exercise 4.2-8, but using scaled partial pivoting, and compare with the results of Exercise 4.2-8.