CHAPTER 4
4.1 (a) For this case xi = 0 and h = x. Thus, ⋅⋅ ⋅ + + + = 2 ) 0 ( " ) 0 ( ' ) 0 ( ) (x f f x f x2 f 1 ) 0 ( " ) 0 ( ' ) 0 ( = f = f =e0 = f ⋅⋅ ⋅ + + + = 2 1 ) ( 2 x x x f (b) ⋅⋅ ⋅ + − + − = − − − − + ) 2 6 (x 1 e e h e h2 e h3 f xi xi xi xi i
for xi = 0.2, xi+1 = 1 and h = 0.8. True value = e–1 = 0.367879. zero order: 818731 . 0 ) 1 ( =e−0.2 = f % 55 . 122 % 100 367879 . 0 818731 . 0 367879 . 0 − × = = t ε first order: 163746 . 0 ) 8 . 0 ( 818731 . 0 818731 . 0 ) 1 ( = − = f % 49 . 55 % 100 367879 . 0 163746 . 0 367879 . 0 − × = = t ε second order: 42574 . 0 2 8 . 0 818731 . 0 ) 8 . 0 ( 818731 . 0 818731 . 0 ) 1 ( 2 = + − = f % 73 . 15 % 100 367879 . 0 42574 . 0 367879 . 0 = × − = t ε third order: 355875 . 0 6 8 . 0 818731 . 0 2 8 . 0 818731 . 0 ) 8 . 0 ( 818731 . 0 818731 . 0 ) 1 ( = − + 2 − 3 = f % 26 . 3 % 100 355875 . 0 367879 . 0 − × = = t ε
4.2 Use the stopping criterion % 5 . 0 % 10 5 . 0 × 2 2 = = − s ε
True value: cos(π/3) = 0.5 zero order: 1 3 cos = π % 100 % 100 0.5 1 0.5− × = = t ε first order:
(
)
0.451689 2 3 / 1 3 cos 2 = − = π π % 66 . 9 = t ε 100% 121.4% 0.451689 1 0.451689− × = = a ε second order:(
)
0.501796 24 3 / 451689 . 0 3 cos 4 = + = π π % 359 . 0 = t ε 100% 9.986% 501796 . 0 451689 . 0 501796 . 0 = × − = a ε third order:(
)
0.499965 720 3 / 501796 . 0 3 cos 6 = − = π π % 00709 . 0 = t ε 100% 0.366% 499965 . 0 501796 . 0 499965 . 0 − × = = a εSince the approximate error is below 0.5%, the computation can be terminated.
4.3 Use the stopping criterion: =0.5×102−2%=0.5%
s
ε
zero order: 047198 . 1 3 3 sin = = π π % 92 . 20 % 100 0.866025 047198 . 1 0.866025 = × − = t ε first order:
(
)
0.855801 6 3 / 047198 . 1 3 sin 3 = − = π π % 18 . 1 = t ε 100% 22.36% 855801 . 0 047198 . 1 855801 . 0 = × − = a ε second order:(
)
0.866295 120 3 / 855801 . 0 3 sin 5 = + = π π % 031 . 0 = t ε 100% 1.211% 866295 . 0 855801 . 0 866295 . 0 − × = = a ε third order:(
)
0.866021 5040 3 / 866295 . 0 3 sin 7 = − = π π % 000477 . 0 = t ε 100% 0.0316% 866021 . 0 866295 . 0 866021 . 0 = × − = a εSince the approximate error is below 0.5%, the computation can be terminated.
4.4 True value: f(3) = 554. zero order: 62 ) 1 ( ) 3 ( = f =− f % 191 . 111 % 100 554 62) ( 554 = × − − = t ε
first order: 78 ) 2 ( 70 62 ) 1 3 )( 1 ( ' 62 ) 3 ( =− + f − =− + = f εt =85.921% second order: 354 4 2 138 78 ) 1 3 ( 2 ) 1 ( " 78 ) 3 ( = + f − 2 = + = f εt =36.101% third order: 554 8 6 150 354 ) 1 3 ( 6 ) 1 ( 354 ) 3 ( = + f(3) − 3 = + = f εt =0%
Thus, the third-order result is perfect because the original function is a third-order polynomial. 4.5 True value: f(2.5) = ln(2.5) = 0.916291... zero order: 0 ) 1 ( ) 5 . 2 ( = f = f % 100 % 100 0.916291 0 0.916291 = × − = t ε first order: 5 . 1 ) 5 . 1 ( 1 0 ) 1 5 . 2 )( 1 ( ' ) 1 ( ) 5 . 2 ( = f + f − = + = f % 704 . 63 % 100 0.916291 5 . 1 0.916291− × = = t ε second order: 375 . 0 5 . 1 2 1 5 . 1 ) 1 5 . 2 ( 2 ) 1 ( " 5 . 1 ) 5 . 2 ( = + f − 2 = + − 2 = f % 074 . 59 % 100 0.916291 375 . 0 0.916291− × = = t ε third order: 5 . 1 5 . 1 6 2 375 . 0 ) 1 5 . 2 ( 6 ) 1 ( 375 . 0 ) 5 . 2 ( = + f(3) − 3 = + 3 = f
% 704 . 63 % 100 0.916291 5 . 1 0.916291 = × − = t ε fourth order: 234375 . 0 5 . 1 24 6 5 . 1 ) 1 5 . 2 ( 24 ) 1 ( 5 . 1 ) 5 . 2 ( = + f(4) − 4 = + − 4 = f % 421 . 74 % 100 0.916291 234375 . 0 0.916291− × = = t ε
Thus, the process seems to be diverging suggesting that a smaller step would be required for convergence. 4.6 True value: 283 7 ) 2 ( 12 ) 2 ( 75 ) 2 ( ' 7 12 75 ) ( ' 2 2 = + − = + − = f x x x f function values: xi–1 = 1.8 f(xi–1) = 50.96 xi = 2 f(xi) = 102 xi+1 = 2.2 f(xi+1) = 164.56 forward: 8 . 312 2 . 0 102 56 . 164 ) 2 ( ' = − = f % 53 . 10 % 100 283 312.8 283− × = = t ε backward: 2 . 255 2 . 0 96 . 50 102 ) 2 ( ' = − = f % 823 . 9 % 100 283 255.2 283− × = = t ε centered:
284 ) 2 . 0 ( 2 96 . 50 56 . 164 ) 2 ( ' = − = f % 353 . 0 % 100 283 284 283 = × − = t ε
Both the forward and backward have errors that can be approximated by (recall Eq. 4.15),
h x f E i t 2 ) ( " ≈ 288 12 ) 2 ( 150 12 150 ) 2 ( " = x− = − = f 8 . 28 2 . 0 2 288 = ≈ t E
This is very close to the actual error that occurred in the approximations forward: Et ≈ 283−312.8 =29.8
backward: Et ≈ 283−255.2 =27.8
The centered approximation has an error that can be approximated by,
1 2 . 0 6 150 6 ) ( 2 2 ) 3 ( − = − = − ≈ f x h E i t
which is exact: Et = 283 – 284 = –1. This result occurs because the original function is a cubic equation which has zero fourth and higher derivatives.
4.7 True value: 288 12 ) 2 ( 150 ) 2 ( " 12 150 ) ( " = − = − = f x x f h = 0.25: 288 25 . 0 85938 . 39 ) 102 ( 2 1406 . 182 25 . 0 ) 75 . 1 ( ) 2 ( 2 ) 25 . 2 ( ) 2 ( " = f − f 2 + f = − 2 + = f h = 0.125: 288 125 . 0 82617 . 68 ) 102 ( 2 6738 . 139 125 . 0 ) 875 . 1 ( ) 2 ( 2 ) 125 . 2 ( ) 2 ( " = f − f 2+ f = − 2+ = f
Both results are exact because the errors are a function of 4th and higher derivatives which are zero for a 3rd-order polynomial.
4.8
(
1)
1.38666 2 ) / ( ) / ( − = − − = ∂ ∂ − − c e gm cgte c v c mt c mt 079989 . 2 ) 5 . 1 ( 38666 . 1 ~ ) ~ ( ∆ = = ∂ ∂ = ∆ c c v c v(
1)
30.4533 5 . 12 ) 50 ( 8 . 9 ) 5 . 12 ( = −e−12.5(6)/50 = v 079989 . 2 4533 . 30 ± = vThus, the bounds computed with the first-order analysis range from 28.3733 to 32.5333. This result can be verified by computing the exact values as
(
1)
32.6458 11 ) 50 ( 8 . 9 ) (c−∆c = −e−(11/50)6 = v(
1)
28.4769 14 ) 50 ( 8 . 9 ) (c+∆c = −e−(14/50)6 = vThus, the range of ±2.0844 is close to the first-order estimate.
4.9
(
1)
30.4533 5 . 12 ) 50 ( 8 . 9 ) 5 . 12 ( = −e−12.5(6)/50 = v m m v c c v m c v(~,~) ~ ∆~ ∂ ∂ + ∆ ∂ ∂ = ∆(
1)
1.38666 2 ) / ( ) / ( − = − − = ∂ ∂ − − c e gm cgte c v c mt c mt(
1 ( / ))
0.871467 ) / ( + − = = ∂ ∂ −c mt e−c mt c g e m gt m v 822923 . 3 742934 . 1 079989 . 2 ) 2 ( 871467 . 0 ) 5 . 1 ( 38666 . 1 ) ~ , ~ ( = − + = + = ∆v c m 822923 . 3 4533 . 30 ± = v4.10 For T~∆ =20, T T H T H(~) ∆~ ∂ ∂ = ∆ 408 . 8 650 ) 10 67 . 5 ( 9 . 0 ) 15 . 0 ( 4 4 3 = × 8 3 = = ∂ ∂ Ae T − T H σ 169 . 168 ) 20 ( 408 . 8 ) ~ ( = = ∆H T Exact error: 3286 . 168 2 81 . 1205 468 . 1542 2 ) 630 ( ) 670 ( true = − = − = ∆H H H
Thus, the first-order approximation is close to the exact result. For T~∆ =40, 3387 . 336 ) 40 ( 408 . 8 ) ~ ( = = ∆H T Exact error: 6124 . 337 2 83 . 1059 055 . 1735 2 ) 610 ( ) 690 ( true = − = − = ∆H H H
Again, the first-order approximation is close to the exact result. The results are good because H(T) is nearly linear over the ranges we are examining. This is illustrated by the following plot. 800 1200 1600 2000 550 600 650 700 750
4.11 For a sphere, A = 4πr2. Therefore, 4
2 4 r e T H = π σ
288 . 1320 ) 550 )( 10 67 . 5 ( 90 . 0 ) 15 . 0 ( 4 ) 550 , 9 . 0 , 15 . 0 ( = π 2 × −8 4 = H T T H e e H r r H H ~ ~ ∆~ ∂ ∂ + ∆ ∂ ∂ + ∆ ∂ ∂ = ∆ 84 . 603 , 17 8 4 = = ∂ ∂ re T r H σ π 987 . 1466 4 2 4 = = ∂ ∂ T r e H σ π 6021 . 9 16 2 3 = = ∂ ∂ r e T T H σ π 4297 . 441 ) 20 ( 6021 . 9 ) 05 . 0 ( 987 . 1466 ) 01 . 0 ( 84 . 17603 + + = = ∆H
To check this result, we can compute
6372 . 936 ) 530 )( 10 67 . 5 ( 85 . 0 ) 14 . 0 ( 4 ) 530 , 85 . 0 , 14 . 0 ( = π 2 × −8 4 = H 178 . 1829 ) 570 )( 10 67 . 5 ( 95 . 0 ) 16 . 0 ( 4 ) 570 , 95 . 0 , 16 . 0 ( = π 2 × −8 4 = H 2703 . 446 2 6372 . 936 178 . 1829 true = − = ∆H
4.12 The condition number is computed as
) ~ ( ) ~ ( ' ~ x f x f x CN = (a) 617 . 157 003162 . 1 ) 1139 . 158 ( 00001 . 1 1 1 00001 . 1 1 00001 . 1 2 1 00001 . 1 = = + − − = CN
The result is ill-conditioned because the derivative is large near x = 1.
(b) 10 10 54 . 4 ) 10 54 . 4 ( 10 ) ( 10 5 5 10 10 − = × × − = − = − − − − e e CN
(c) 99999444 . 0 0016667 . 0 ) 10 555556 . 5 ( 300 300 1 300 1 1 300 300 300 6 2 2 − = × − = − + − + = − CN
The result is well-conditioned.
(d) 0.001(00..9995499667) 0.0005 1 1 2 − = − = − + − − = − − − x e x e xe x CN x x x
The result is well-conditioned.
(e) 10,001 2 . 6366 ) 237 , 264 , 20 ( 141907 . 3 cos 1 sin ) cos 1 ( ) (sin sin cos ) cos 1 ( 2 − = − = + + + + = x x x x x x x x CN
The result is ill-conditioned because, as in the following plot, the function has a singularity at x = π. -2000 -1000 0 1000 2000 3.08 3.1 3.12 3.14 3.16 3.18 3.2
4.13 Addition and subtraction:
v u v u f( , )= + v v f u u f f ~ ∆~ ∂ ∂ + ∆ ∂ ∂ = ∆ 1 1 = ∂ ∂ = ∂ ∂ v f u f v u v u f(~,~)=∆~+∆~ Multiplication:
v u v u f( , )= ⋅ u v f v u f = ∂ ∂ = ∂ ∂ v u u v v u f(~,~)= ~∆~+ ~∆~ Division: v u v u f( , )= / 2 1 v u v f v u f = ∂ ∂ = ∂ ∂ v v u u v v u f(~,~) 1 ~ ~ 2 ∆ + ∆ = 2 ~ ~ ) ~ , ~ ( v v u u v v u f = ∆ + ∆ 4.14 a x f b ax x f c bx ax x f 2 ) ( " 2 ) ( ' ) ( 2 = + = + + =
Substitute these relationships into Eq. (4.4),
) 2 ( ! 2 2 ) )( 2 ( 2 1 2 1 1 2 1 2 1 i i i i i i i i i i i x x x x a x x b ax c bx ax c bx ax+ + + + = + + + + + − + + − + + Collect terms c x x b bx x x x x a x x ax ax c bx axi+ + i+ + = i +2 i( i+ − i)+ ( i+ −2 i+ i + i2)+ i + ( i+1 − i)+ 1 2 1 1 2 1 2 1 c bx bx bx ax x ax ax ax x ax ax c bx axi+ + i+ + = i + i i+ − i + i+ − i+ i + i2 + i + i+1 − i + 1 2 1 2 1 2 1 2 1 2 2 2 c bx bx bx x ax x ax ax ax ax ax c bx axi+ + i+ + = i − i + i + i2+ + i i+1− i+1 i + i − i + i+1+ 1 2 2 2 1 2 1 ( 2 ) (2 2 ) ( ) c bx ax c bx axi+ + i+ + = i2+ + i+1+ 1 1 2 1
4.15 The first-order error analysis can be written as S S Q n n Q Q ∆ ∂ ∂ + ∆ ∂ ∂ = ∆ 74 . 50 ) 2 ( ) ( 1 0.5 3 / 2 3 / 5 2 + =− − = ∂ ∂ S H B BH n n Q 2536.9 2 1 ) 2 ( ) ( 1 5 . 0 3 / 2 3 / 5 = + = ∂ ∂ S H B BH n S Q 228 . 0 076 . 0 152 . 0 00003 . 0 9 . 2536 003 . 0 74 . 50 + = + = − = ∆Q
The error from the roughness is about 2 times the error caused by the uncertainty in the slope. Thus, improving the precision of the roughness measurement would be the best strategy.
4.16 Use the stopping criterion
% 5 . 0 % 10 5 . 0 × 2 2 = = − s ε True value: 1/(1 – 0.1) = 1.111111…. zero order: 1 1 1 = −x % 10 % 100 1.11111 1 1.11111 = × − = t ε first order: 1 . 1 1 . 0 1 1 1 = + = −x % 1 = t ε 100% 9.0909% 1.1 1 1 . 1 − × = = a ε second order: 11 . 1 01 . 0 1 . 0 1 1 1 = + + = −x % 1 . 0 = t ε 100% 0.9009009% 1.11 1 . 1 11 . 1 − × = = a ε third order:
111 . 1 001 . 0 01 . 0 1 . 0 1 1 1 = + + + = −x % 01 . 0 = t ε 100% 0.090009% 1.111 11 . 1 111 . 1 − × = = a ε
Since the approximate error is below 0.5%, the computation can be terminated.
4.17
(
)
α α φ φ = ∆ ∆ d d 0 0 sin sin α αβ αβ α α β α φ + − + − + + − = 1 1 ) 1 )( 1 ( 2 sin 0 d dwhere β = (ve/v0)2 = 4 and α = 0.25 to give,
1305 . 3 25 . 0 1 ) 4 ( 25 . 0 1 )) 4 ( 25 . 0 25 . 0 1 )( 25 . 0 1 ( 2 4 sin 0 − = + − + − + + − = α φ d d
(
φ)
= ∆α ∆sin 0 3.1305 For ∆α = 0.25(0.02) = 0.005,(
sin 0)
=3.1305(0.005)=0.015652 ∆ φ 559017 . 0 4 25 . 0 1 25 . 0 1 ) 25 . 0 1 ( sin 0 = + − + = φ Therefore, 574669 . 0 015652 . 0 559017 . 0 sin max φ0 = + = 543365 . 0 015652 . 0 559017 . 0 sin min φ0 = − = ° = × =arcsin(0.574669) 180 35.076 max 0 π φ ° = × =arcsin(0.543365) 180 32.913 min 0 π φx x x f( )= −1−0.5sin x x f'( )=1−0.5cos x x f"( )=0.5sin x x f(3)( )=0.5cos x x f(4)( )=−0.5sin
The first through fourth-order Taylor series expansions can be computed based on Eq. 4.5 as First-order: ) )( ( ' ) ( ) ( 1 x f a f a x a f = + − 5 . 1 2 2 cos 5 . 0 1 2 sin 5 . 0 1 2 ) ( 1 = − − − + − − = x x x f π π π π Second-order: 2 1 2 2 ( ) ) ( " ) ( ) (x f x f a x a f = + − 2 2(x)=x−1.5+0.25sin(π /2)(x−π/2) f Third-order: 3 ) 3 ( 2 3 ( ) 6 ) ( ) ( ) (x f x f a x a f = + − 3 2 3 6 ( ) ) 2 / cos( 5 . 0 ) 2 / )( 2 / sin( 25 . 0 5 . 1 ) (x x x x a f = − + π −π + π − 2 3(x)=x−1.5+0.25sin(π/2)(x−π/2) f Fourth-order: 4 ) 4 ( 3 4 24 ( ) ) ( ) ( ) (x f x f a x a f = + − 4 2 4 ( /2) 24 ) 2 / sin( 5 . 0 ) 2 / )( 2 / sin( 25 . 0 5 . 1 ) (x =x− + π x−π − π x−π f
4 2 4 48( /2) 1 ) 2 / )( 2 / sin( 25 . 0 5 . 1 ) (x =x− + π x−π − x−π f
Note the 2nd and 3rd Order Taylor Series functions are the same. The following MATLAB script file which implements and plots each of the functions indicates that the 4th-order expansion satisfies the problem requirements.
x=0:0.001:3.2; f=x-1-0.5*sin(x); subplot(2,2,1);
plot(x,f);grid;title('f(x)=x-1-0.5*sin(x)');hold on f1=x-1.5;
e1=abs(f-f1); %Calculates the absolute value of the
difference/error subplot(2,2,2);
plot(x,e1);grid;title('1st Order Taylor Series Error'); f2=x-1.5+0.25.*((x-0.5*pi).^2);
e2=abs(f-f2); subplot(2,2,3);
plot(x,e2);grid;title('2nd/3rd Order Taylor Series Error'); f4=x-1.5+0.25.*((x-0.5*pi).^2)-(1/48)*((x-0.5*pi).^4); e4=abs(f4-f);
subplot(2,2,4);
plot(x,e4);grid;title('4th Order Taylor Series Error');hold off
-4 0 4 8 12 -2 0 2 exact backward centered forward
-4 0 4 8 12 -2 0 2 exact backward centered forward