Docsity

Numerical Computing: Test I Solutions - Floating-Point Systems and Matrix Determinant - Pr, Exams of Mathematics

Toggle sidebar
bg1
NUMERICAL COMPUTING
TEST I SOLUTIONS
February 24, 2003
NAME (print)
NOTES
1. Please make sure that your test package consists of 7 pages.
2. Do any three problems. In the table below, cross out the number of the problem you do not wish
to be graded.
3. In order to receive full credit, your work MUST be accompanied by appropriate explanatory statements,
written in comprehensible English.
4. The test is closed-book and closed-notes.
5. Best wishes.
1
2
3
4
TOTAL
1
pf3
pf4
pf5

Partial preview of the text

Download Numerical Computing: Test I Solutions - Floating-Point Systems and Matrix Determinant - Pr and more Exams Mathematics in PDF only on Docsity!

NUMERICAL COMPUTING

TEST I SOLUTIONS

February 24, 2003

NAME (print)

NOTES

  1. Please make sure that your test package consists of 7 pages.
  2. Do any three problems. In the table below, cross out the number of the problem you do not wish to be graded.
  3. In order to receive full credit, your work MUST be accompanied by appropriate explanatory statements, written in comprehensible English.
  4. The test is closed-book and closed-notes.
  5. Best wishes.

TOTAL

  1. Consider a hypothetical, normalized, floating-point system of positive numbers with base 2, precision 4 and exponent range [− 1 , 1]. Let the normalization be chosen such that a typical number in this system is represented as (·d 1 d 2 d 3 d 4 ) 2E^. Let rounding be done by chopping.

(a) Write down all the numbers that can be represented exactly in this system. (You may find it convenient to write the numbers as fractions, arranged on a straight line.) (b) Define the terms underflow limit and overflow limit for a general floating-point number system. Write down their values for the system at hand. (c) Define the term machine epsilon for a general floating-point number system, and write down its value for the system at hand. (d) Consider the matrix A =

[

]

i. Write down the matrix A as it would be stored in the machine under the above system. ii. Compute the value of the determinant of A. In carrying out this computation, assume that each floating-point operation is performed exactly, and then chopped appropriately for rep- resentation in the system.

(a) For the mantissa the choices (in binary and their fractional equivalents) are

. 1000 = 1 / 2 . 1001 = 9 / 16 . 1010 = 10 / 16 . 1011 = 11 / 16 . 1100 = 12 / 16 . 1101 = 13 / 16 . 1110 = 14 / 16 . 1111 = 15 / 16.

The allowable exponents are -1, 0 and 1, and correspond to the multiplication of the mantissa by 1/2, 1 and 2. The full resulting set is

1 / 4 , 9 / 32 , 10 / 32 , 11 / 32 , 12 / 32 , 13 / 32 , 14 / 32 , 15 / 32 ,

1 / 2 , 9 / 16 , 10 / 16 , 11 / 16 , 12 / 16 , 13 / 16 , 14 / 16 , 15 / 16 , 1 , 9 / 8 , 10 / 8 , 11 / 8 , 12 / 8 , 13 / 8 , 14 / 8 , 15 / 8.

(b) The UFL is the smallest positive number, and the OFL the largest positive number in the system. Here these are 1/4 and 15/8 respectively. (c) Macine epsilon is the smallest number  for which float(1 + ) > 1. Here, mach = 1/ 8. (Re- member that rounding is specified to be by chopping.) (d) Each element of the matrix is entered into the system as itself if it is machine representable, or chopped to the immediately smaller machine number. Thus A is rendered as

A =

[

]

The determinant is computed as float(15/16)−float(3/16) = 15/ 16 −0 = 15/16 since 3/16, being smaller than the UFL, is entered as 0.

  1. (a) Write out the LU factorization of the following matrix (show both the L and U matrices explicitly). Check whether the product LU recovers A.  

(b) What does the term condition number mean in the context of the problem Ax = b? Find the condition number of the matrix A =

[

]

(a) Gaussian elimination by hand gives, for step 1, m 21 = − 1 / 2 , m 31 = 1. Then, the matrix A transforms into (^) 

In step 2, m 32 = 1, leading to the upper triangular matrix

U =

The corresponding lower triangular matrix, formed by starting with a unit matrix and inserting −mij in the appropriate positions, turns out to be

L =

It is easily checked that LU = A. (b) Condition number determines the extent to which error in the solution vector x is affected by errors in the input matrix A or the input vector b. For a given relative input error, a large (small) condition number implies a large (small) relative output error. The determinant of A is 0.2, and the inverse matrix is

A−^1 = 5

[

]

Using maximal row norms, ||A|| = 11, ||A−^1 || = 55, so that the condition number

κ(A) = ||A|| ||A−^1 || = 11 × 55 = 605.

  1. (a) For the system Ax = b, give the relation between the residual and the relative error. Then deduce the condition under which a small residual implies a small error. (b) Why is pivoting important in Gaussian elimination? What is the difference between partial pivoting and complete pivoting? (c) What is the definition of convergence rate for an iterative method? Give an example of a linearly convergent and a quadratically convergent algorithm in root finding. (d) In the bisection method for solving f (x) = 0, what role is played by f in determining the rate of convergence?

(a) The relationship is ||x − xˆ|| ||x||

= κ(A)

||r|| ||b|| where xˆ is the computed solution, κ(A) the condition number of A and r = b − Ax.ˆ Small residual will imply a small error only if the problem is well-conditioned. (b) Pivoting ensures stability. In partial pivoting the column below the current pivot is scanned and a row exchange made to put the largest elemnt in the column in the pivot position. In complete pivoting the entire unreduced submatrix associated with the current pivot is scanned, and both row and column exchanges made to put the largest element in the submatrix in the pivot position. (c) If the errors in the iteration obey lim n→∞

||en+1|| ||en||r^

= C,

where r ≥ 1 and C is a constant, then r is the convergence rate. (For r = 1, we need C < 1. ) Bisection is linearly convergent and Newton’s method quadratically convergent. (d) None.