Solution to Homework_2_S09

# Solution to Homework_2_S09 - Solution to Homework#2 21...

This preview shows pages 1–3. Sign up to view the full content.

Solution to Homework #2 EGM6341 21. For the following numbers x A and x T , how many significant digits are there in x A with respect to x T ? a) x A = 451.023, x T = 451.01 b) x A =-0.045113, x T = -0.04518 c) x A = 23.4213, x T = 23.4604 Soln. a) | x A - x T | = |451.023-451.01| = 0.013 m+1=5 m=4. b) | x A - x T | = | -0.045113 + 0. 04518 | = 0.000 0 67 m+1=3 m=2. c) | x A - x T | = | 23.4213 – 23.4604 | = 0.0391 m+1=4 m =3. 22. a) 1.1062+0.947 => [1.10615+0.9465, 1.10625+0.9475]=[2.05265, 2.05375] b) 23.46-12.753 => [23.455-12.7535, 23.465-12.7525]=[10.7015, 10.7125] c) (2.747)(6.83) => [(2.7465)(6.825), (2.7475)(6.835)]=[ 18.7448625, 18.7791625] d) (8.473)/(0.064) => [(8.4725)/(0.0645), (8.4735)/(0.0635)] [131.3566, 133.4409] 25. Given exact ways of avoiding loss-of-significance errors in the following computations a) log(x+1) – log(x) large x b) sin(x)- sin(y) x y Sol. a) log(x+1) – log(x) = log[(x+1)/x] = log(1+1/x) Experiment on a single precision machine: x log(y)-log(x) log(1+1/x) 1/x-1/(2x^2)+1/(3x^3) 10 9.53102E-02 9.53102E-02 9.53333300E-02 100 9.95016E-03 9.95032E-03 9.95033330E-03 1000 9.99451E-04 9.99547E-04 9.99500390E-04 10000 1.00136E-04 1.00012E-04 9.99949990E-05 100000 1.04904E-05 1.00135E-05 9.99994970E-06 1000000 9.53674E-07 9.53674E-07 9.99999540E-07 1.00E+07 0.00E+00 1.19209E-07 9.99999940E-08 1.00E+08 0.00E+00 0.00E+00 9.99999990E-09 1.00E+09 0.00E+00 0.00E+00 1.00E-09 Observations: i) log(1+1/x) is better than log(x+1)-log(x) ii) log(1+1/x) still suffers from inaccuracy for large x because 1+1/x will be treated as 1 once 1/x is less than machine epsilon. iii) For large x, Taylor series expansion works very well and does not suffer from the roundoff error. b) sin(x)- sin(y) = 2 cos( 2 y x + ) sin( 2 y x - ) Experiment on a single precision using y= π /4, x= π /4+ ε , ε =x-y sin(y+ ε )-sin(y) 2*cos(y+ ε /2)sin( ε /2 ) 0.1 6.7060351E-02 6.7060299E-02 1.0E-02 7.0356131E-03 7.0355949E-03 1.0E-03 7.0679188E-04 7.0675317E-04 1.0E-04 7.0750713E-05 7.0707138E-05

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1.0E-05 7.0929527E-06 7.0710325E-06 1.0E-06 7.1525574E-07 7.0710644E-07 1.0E-07 1.1920929E-07 7.0710669E-08 1.0E-08 0.0000000E+00 7.0710677E-09 1.0E-09 0.0000000E+00 7.0710676E-10 1.0E-10 0.0000000E+00 7.0710680E-11 1.0E-11 0.0000000E+00 7.0710677E-12 1.0E-12 0.0000000E+00 7.0710679E-13 1.0E-13 0.0000000E+00 7.0710683E-14 1.0E-14 0.0000000E+00 7.0710675E-15 1.0E-15 0.0000000E+00 7.0710676E-16 1.0E-16 0.0000000E+00 7.0710674E-17 Comments:
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

Solution to Homework_2_S09 - Solution to Homework#2 21...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online