mathhint2

1
Numerical Methods: Math 360 - 2011 Hints for Tutorial 2 1. a. 0.0111 b. .10111 c. 0.011 011 3. See example 1.7 in lecture notes. ln(1 + h) h - 1 2 h 2 + 1 3 h 3 - 1 4c 4 h 4 , where 1 c 1+ h. 4. 1 10 = (0.00011 0011) 2 . The normalised form = 1.10011001100110011001100 × 2 -100 in binary. This is equivalent to, in base 10, (1+2 -1 +2 -4 +2 -5 +2 -8 + 2 -9 +2 -12 +2 -13 +2 -16 +2 -17 +2 -20 +2 -21 )×2 -4 =0.0999999940394. The relative error = 0.1-0.0999999940394 0.1 6 × 10 -8 . 6. a. x 1, loss of significance occurs. Replace the current by ln(x/e) b. x π 4 . Replace the current by cos 2x. c. x 0. Replace the current by x(1-3x) (1+x)(3x+1) . 7. a. lim x0 f (x) = lim x0 sin x 1 = 0 (L’Hospital) f (0) = 0 for f (x) to be continuous. b. near x 0 the subtractive cancelation occurs. c. There are many: Use Taylor series or Multiply by 1 + cos x up and down or use the identity cos x =1 - 2 sin 2 (x/2). Note that in every strategy we have to simplify, for example in the second case your final formula is sin 2 x x(1+cos x) . 8. f (x)= - 1 3 + x 2 30 -··· 1 6 - x 2 120 + ··· , after simplification using Maclaurin polyno- mial. a. lim x0 f (x)= -2. b. 0.1000×0.9950-0.0998 0.1000-0.0998 = 0.0995-0.0998 0.0002 = -0.0003 0.0002 = -1.5 c. f (0.1) - 1 3 + 0.1 2 30 1 6 - 0.1 2 120 = -0.3333+0.0003 .1667-0.0001 = -1.999, which is closer to the exact solution. d. Percentage absolute relative error for part (c) = -1.99899998-(-1.5) -1.99899998 × 100 = 25%. Percentage absolute relative error for part (d) = -1.99899998-(-1.999) -1.99899998 × 100 10 -6 %. Tutorial 3 1. Notice that f (x) = sin x and both | sin x| and | cos x| are 1 for all real x, we have |R n (x)|≤ x n+1 (n+1)! . With x =0.1 and trial and error, you can find that when n = 4, the error |R n (x)|≤ 8.3 × 10 -8 . 3. The number 0.1 is stored in 9-bit word as 0 1 1 0 0 1 0 0 1 . This is equal to 0.09765625 in base 10. The error in 1 second = (0.1 - 0.09765625) = 0.00234375, and therefore the accumulated error for a day is = 0.00234375 × 24 × 3600 = 202.5. 4. 1 t 1 t 2 1 -f 1 t 1 -f 1 t 2 1 1 t 2 t 2 2 -f 2 t 2 -f 2 t 2 2 1 t 3 t 2 3 -f 3 t 3 -f 3 t 2 3 1 t 4 t 2 4 -f 4 t 4 -f 4 t 2 4 1 t 5 t 2 5 -f 5 t 5 -f 5 t 2 5 c 0 c 1 c 2 d 1 d 2 = f 1 f 2 f 3 f 4 f 5 where t 0 =1,t 2 =2, etc., and f 1 = f (1),f 2 = f (2), etc. 5. Just multiply and see whether it produce the identity matrix. 6. For the system, ( a 11 a 12 a 21 a 22 )( x 1 x 2 ) = ( b 1 b 2 ) after the Gaussian elimination, we have ( a 11 a 12 b 1 0 a 22 - a 21 a 11 a 12 b 2 - a 21 a 11 b 2 ) from which x 2 = b 2 - a 21 a 11 b 2 a 22 - a 21 a 11 a 12 = a 11 b 1 a 21 b 2 a 11 a 12 a 21 a 22 . Similarly you can show that for x 1 as well.

Upload: nephembani

Post on 21-Jul-2016

214 views

Category:

Documents


1 download

DESCRIPTION

b

TRANSCRIPT

Numerical Methods: Math 360 - 2011Hints for Tutorial 2

1. a. 0.0111 b. .10111 c. 0.011011

3. See example 1.7 in lecture notes. ln(1+h) ≈ h− 12h

2+ 13h

3− 14c4

h4,where 1 ≤ c ≤ 1 + h.

4. 110 = (0.000110011)2.The normalised form = 1.10011001100110011001100× 2−100 inbinary. This is equivalent to, in base 10, (1+2−1+2−4+2−5+2−8+2−9+2−12+2−13+2−16+2−17+2−20+2−21)×2−4 = 0.0999999940394.The relative error = 0.1−0.0999999940394

0.1 ≤ 6× 10−8.

6.

a. x ≈ 1, loss of significance occurs. Replace the current by ln(x/e)b. x ≈ π

4 . Replace the current by cos 2x.

c. x ≈ 0. Replace the current by x(1−3x)(1+x)(3x+1) .

7.

a. limx→0 f(x) = limx→0sinx1 = 0 (L’Hospital)

f(0) = 0 for f(x) to be continuous.b. near x ≈ 0 the subtractive cancelation occurs.c. There are many: Use Taylor series or Multiply by 1 + cosx

up and down or use the identity cosx = 1− 2 sin2(x/2).Note that in every strategy we have to simplify, for example in thesecond case your final formula is sin2 x

x(1+cosx) .

8. f(x) =−1

3 + x2

30 − · · ·16 − x2

120 + · · ·, after simplification using Maclaurin polyno-

mial.a. limx→0 f(x) = −2.b. 0.1000×0.9950−0.0998

0.1000−0.0998 = 0.0995−0.09980.0002 = −0.0003

0.0002 = −1.5

c. f(0.1) ≈ − 13+ 0.12

3016− 0.12

120

= −0.3333+0.0003.1667−0.0001 = −1.999,

which is

closer to the exact solution. d. Percentage absolute relative error

for part (c) =∣∣∣−1.99899998−(−1.5)

−1.99899998

∣∣∣×100 = 25%. Percentage absolute

relative error for part (d) =∣∣∣−1.99899998−(−1.999)

−1.99899998

∣∣∣× 100 ≈ 10−6%.

Tutorial 3

1. Notice that f(x) = sinx and both | sinx| and | cosx| are ≤ 1 for all

real x, we have |Rn(x)| ≤ xn+1

(n+1)! . With x = 0.1 and trial and error,

you can find that when n = 4, the error |Rn(x)| ≤ 8.3× 10−8.

3. The number 0.1 is stored in 9-bit word as

0 1 1 0 0 1 0 0 1 .

This is equal to 0.09765625 in base 10. The error in 1 second = (0.1- 0.09765625) = 0.00234375, and therefore the accumulated errorfor a day is = 0.00234375× 24× 3600 = 202.5.

4.

1 t1 t21 −f1t1 −f1t

21

1 t2 t22 −f2t2 −f2t22

1 t3 t23 −f3t3 −f3t23

1 t4 t24 −f4t4 −f4t24

1 t5 t25 −f5t5 −f5t25

c0c1c2d1d2

=

f1f2f3f4f5

where t0 = 1, t2 = 2, etc., and f1 = f(1), f2 = f(2), etc.

5. Just multiply and see whether it produce the identity matrix.

6. For the system,

(a11 a12a21 a22

)(x1x2

)=

(b1b2

)after the Gaussian elimination, we have

(a11 a12 b10 a22 − a21

a11a12 b2 − a21

a11b2

)

from which x2 =b2−a21

a11b2

a22−a21a11

a12=

∣∣∣∣∣∣ a11 b1a21 b2

∣∣∣∣∣∣∣∣∣∣∣∣ a11 a12a21 a22

∣∣∣∣∣∣.

Similarly you can show that for x1 as well.