Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

MATH20602

Numerical Analysis 1

Problem Sheet 1

Part A is provided with solutions for you to work on.  Part B will be worked on in class. Problems marked with * are from previous exam papers.

Signicant figures. To count the number of Significant Figures in a given number, start with the first non-zero digit from the left and, moving to the right, count all the digits thereafter, counting nal zeros if they are to the right of the decimal point. For example, 1.2048, 12.040, 0.012048, 0.0012040 and 1204.0 all have 5 significant figures (s.f.). In rounding or truncation of a number to n s.f., the original is replaced by a number with n s.f. When computing to n s.f., each intermediate result has to be rounded to n s.f.

To say that a = 1.2048 to 5 s.f. means that the exact value of a becomes 1.2048 after rounding to 5 s.f.: that is to say, 1.20475 ≤ a < 1.20485 if we agree on rounding up in case of doubt. (from A Concise Dictionary of Mathematics, C. Clapham, CUP)

Part A

(1.1)   Imagine that you are working on a computer that can store only values between -106  and 106 .  An “overflow” error is generated if a computed value exceeds these limits. Explain the difficulties in computing the variance v of the numbers X1  = 104 , X2  = 104 - 1 and X3  = 104 + 1 by using the formula

3

v = /  V Xi(2)- µ2 ,

i=1

3

µ =  V Xi .

i=1

By rearranging this formula,  show how the variance v can be computed without causing an overflow? Compute v .

Hint:  You may want to recall the definition of variance in probability theory.

(1.2)   Find both roots of

0.37x2 - 10x + 0.0001 = 0.

Illustrate how problems occur if you calculate to three significant gures, by nding the roots with both methods.

(1.3)   A modern computer works to sixteen significant gures, as can be verified by computing x = 1 + 10 16 in MATLAB or Python. The computer rounds this number and stores it as 1, while 1 + 10 15 is stored correctly as 1 + 10 15 . Give an example of a, b, c such that the solution of

ax2 + bx + c = 0,

computed using the standard formula, gives a poor approximation in MATLAB because of rounding errors. 

Part B

(1.4)   Rewrite the polynomial

p3 (x) = 3x3 - x2 + 4x - 2

in the form used in Horner’s algorithm.

(1.5)   How many multiplications are required to evaluate a polynomial of degree n

(a) navely?

(b) by Horners method?

(1.6)   To mimic the effects of computer arithmetic, round the following numbers to four significant gures (and do so after each arithmetic operation involved).

1.  a = π , b = 0.000012974, c = 0.000012976, d = 0.00001, e = 10001.

2.  a = π 2 , b = ^2, c = 1/1000, d = 1 + (1/π6 ).

3.  a = 1+(10, 000 - 10, 000), b = (1+10, 000) - 10, 000, c = 100 - ^1002 - 1 (take the postive square root).

Example:  Compute x = (^π )2  - π . Clearly the exact value xexact  = 0. Now, working to 4 s.f., π = 3.142 and ^3.142 = 1.773 to 4 s.f. Further (1.773)2  = 3.144 and so xcomputed  = 3.144 - 3.142 = 0.002. Note that the absolute error is <xexact - xcomputed < = 0.002. What about the relative error?

(1.7)   * Evaluate the expression

f (x) =^x + 2 - ^x                                           (1)

for x =  1000.  What problem arises if we are only allowed to calculate using three significant figures?  Show how the expression (1) can be rewritten in order to avoid cancellation, and use this to compute the correct result to three significant figures.