Final Exam - Solution
Final Exam - Solution
INSTRUCTIONS:
Closed Books, Closed Notes,
No E-Dictionaries, No Mobiles.
Marking Scheme:
Score Weight Part
8 Q. 1
6 Q. 2
7 Q. 3
17 Q. 4
7 Q. 5
45 Total
Outcomes:
Score Weight Questions Outcome
Analyze the propagation of errors in numerically
8 Q. 1 A.
calculated solutions.
Use different numerical techniques to solve
7 Q. 3 B.
mathematical problems.
Solve systems of linear and non-linear equations using
6 Q. 2 C.
both direct methods and iterative methods.
ㄱ Find 0, where c 0.
ㄴ Find the order of convergence.
α =3 α −3 c α 2 +c 2 α 3
c 2 α 3−3 c α 2+ 2α =0
α ( c 2 α 2−3 c α +2 ) =0
α ( c α −1 ) ( c α−2 ) =0
Since α ≠ 0, then α =1/c or α =2/c.
3(3−1) 3 (3−1)(3−2)
P3 ( x3 ) =f ( x 0 ) +3 [ f ( x 1) −f ( x 0 ) ]+ f ( x )−2 f ( x1 ) + f ( x 0 ) ] + [ f ( x 3 )−3 f ( x 2 ) +3 f ( x1 ) −f ( x 0 ) ]
2! [ 2 3!
Q.3 Use the principle of least-squares to find the constant A if the curve of y(x) = A x1.5 is used to
approximate the following data:
xi 1 2 3 4 5
f(xi) -1 0 6 11 17
Find f(2.3).
The principle of least-squares minimizes the sum of errors square at all the given points, i.e.
4
2
minimize E ( A )=∑ [ f ( x i )− A x 1.5
i ]
i=0
4
dE
0= =2 ∑ [ f ( xi ) − A x 1.5 1.5
i ] [−x i ]
dA i=0
4 4
A ∑ x 3i =∑ x 1.5
i f ( xi )
i=0 i=0
∑ x 1.5
i f (xi )
A= i=0 4
=1.369967523
3
∑x i
i=0
y ( x ) =1.369967523 x 1.5
Q.4 Derive a formula to approximate f(xi), using f(xi-1), f(xi), and f(xi+2) where the points xi-1, xi, xi+1,
and xi+2 are equally spaced. Find the error in your formula.
Let
f ' ( x i )= Af ( xi−1 ) + B f ( x i ) +C f ( xi +2 ) +error
35 /
Using Taylor’s series expansion around x0
2 3
' ( x −x0 ) ( x−x 0 ) (3 )
f ( x )=f ( x 0 ) + ( x−x 0 ) f ( x 0 )+ f ( x0 )+ f ( x 0 )+ …
2! 3!
Replacing x by x0 - h, gives
' h2
f ( x 0 −h ) =f ( x 0 )−h f ( x 0 ) + f ( { x } rsub {0 } ) - {{h } ^ {3 }} over {3 ! } {f} ^ {left (3 right )} ( {x} rsub {0} )+
2!
and replacing x by x0 - h, gives
' 4 h2
f ( x 0 +2 h ) =f ( x 0 ) +2 h f ( x 0 ) + f ( { x } rsub { 0} ) + {{ 8 h } ^ {3 }} over {3 ! } {f} ^ {left (3 right )} ( {x} rsub {0
2!
A f ( x 0−h ) + B f ( x 0 ) +C f ( x 0 +2 h ) =¿
h2
{ '
A f ( x 0 )−h f ( x 0 ) +
2!
f ( { x } rsub {0 } ) - {{h } ^ {3 }} over {3 ! } {f} ^ {left (3 right )} ( {x} rsub {0} )+… right
2
' h (
¿ ( A+ B+C ) f ( x0 ) + h (−A +2C ) f ( x 0 ) + A +4 C ) f ( {x} rsub {0} )+ {{h} ^ {3}} over {3!} (-A+8C) {f} ^ {(3)} ( {x
2!
The constants A, B, and C in the right hand side of the equation can be chosen such that the coefficient
of f(x0) is zero, the coefficient of f (x0) is one and the coefficient of f (x0) to be zero, then
A+B+C=0
-A + 2C = 1/h
A + 4C = 0
−4 3 1
Producing the constants A= , B= , C= and so
6h 6h 6h
1 −h2 (3)
f ' ( x 0 )=
6h
[ −4 f ( x 0 −h ) +3 f ( x 0 ) + f ( x 0 +2 [
h ) ] 3 ! f ( x 0 ) +…
+ ]
Put in another form as
1
f ' ( x 0 )= −4 f ( x 0−h ) +3 f ( x 0 ) + f ( x 0 +2 h ) ]+ error
6h [
−h2 ( 3)
error = f (), x0 – h < < x0 + 2h
3!
Q.5 Integrate the function f(x) along the interval [2, 2.4], using the Simpsons rule and the
following data:
45 /
x2
h
∫ f ( x ) dx ≈ 3 [ f ( x 0 ) + 4 f ( x 1 ) + f ( x 2)]
x0
2.4
∫ f ( x ) dx ≈ 0.1
3
( 0.12306+ 4∗0.105706+2∗0.089584+ 4∗0.074764+ 0.061277 )
2
2.4
∫ f ( x ) dx ≈ 0.0361795
2
55 /