Вы находитесь на странице: 1из 3

Department of Computer Science and Engineering

fe
. mi Awo
lo
. wo
`. University
Oba
CSC 308: Numerical Computation II
Rain 2011/2012 Session

Mid Semester Test Marking Scheme


November 25, 2012

Instructions
(i) Answer all questions (ii) Write your Department of major and Registration number legibly
(iii) Show all computations clearly

Question 1
(a) Discuss three main reasons why interpolation techniques are used in engineering. 3 marks.
(b) List and discuss the main differences between the following interpolation techniques: (i)
Newton Forward Difference and (ii) Lagrangian (3 marks)

Question 2
Given the following dataset {xi , f (xi )} = {(0.20, 0.50), (0.40, 0.25), (0.50, 0.20)} (i) Interpolate a
quadratic function into the data using Newton Forward Divided Difference interpolation technique (8 marks); (ii) Use your function to estimate f (0.25) and f (0.55) (2 marks); (iii) Estimate
the error in your computation.(2 marks) (iv) Design an algorithm to implement your specific
solution.(2 marks)

Solution
Question 1
(a) Interpolation techniques are used in engineering application because of the following reasons
(3 marks for 3 points):
i) Interpolation helps to characterize the relationship between the input and output of a
system.
ii) Interpolation models a set of discrete data into a continuous function which can be used
for prediction.
iii) Some functions are very complex and cannot be easily analysed numerically. Interpolation helps to generate a simpler function which agrees with the complex function at the
base points.
(b) The differences between Lagrangian and Newton Forward Difference (NFD) techniques are
(3 marks for 3 differences):
i) NFD involves preliminary differencing and division on the ordinate data which can
introduce arithmetic error, but Lagrangian technique does not involve preliminary differencing.

ii) Given a polynomial Pn (x), in Lagrangian technique, Pn+1 (x) requires re-computation
while the result of Pn (x) will be used in the computation of Pn+1 (x) in NFD.
iii) NFD interpolation technique requires equispaced base-points while Lagrangian does not
place any restriction on the base points.
iv) To compute the functional error in Lagrangian technique, the original function must be
known and differentiable while this is not required to compute the functional error in
NFD technique.
v) NFD technique requires lesser computational steps than the Lagrangian technique and
thereby reducing arithmetic error in NFD.

Question 2
i) The Newton Forward Divided Difference Formula is given by;
Pk (x) =

n
X

F [xk , xk1 , ..., x0 ]

F [xk , xk1 , ..., x0 ] =

(x xj )

(1 mark)

(1)

j=0

k=0

and

k1
Y

F [xk , xk1 , ..., x1 ] F [xk1 , xk2 , ..., x0 ]


xk x0

1
( mark)
2

(2)

We can then prepare the Newton Forward Divided Difference table


i
0
1
2

F [x1 , x0 ]

=
=
=

F [x2 , x1 ]

=
=
=

F [x2 , x1 , x0 ]

=
=
=

P2 (x)

xi
0.20
0.40
0.50

F(xi )
0.50
0.25
0.20

F[ , ]
F[x1 , x0 ]
F[x2 , x1 ]
-

F[ , , ]
F[x2 , x1 , x0 ] 1
( 2 mark)
-

F [x1 ] F [x0 ]
1
( mark)
x1 x0
2
0.25 0.50
0.4 0.2
1
1.25
( mark)
2
F [x2 ] F [x1 ]
1
( mark)
x2 x1
2
0.20 0.25
0.5 0.4
1
0.50
( mark)
2
F [x2 , x1 ] F [x1 , x0 ]
1
( mark)
x2 x0
2
0.50 (1.25)
0.5 0.2
1
2.5
( mark)
2

(3)

(4)

(5)

1
= F [x0 ] + F [x1 , x0 ](x x0 ) + F [x2 , x1 , x0 ](x x0 )(x x1 ) ( mark)(6)
2
1
= 0.5 1.25(x 0.2) + 2.5(x 0.2)(x 0.4) ( mark)
2
= 0.5 1.25x + 0.25 + 2.5(x2 0.6x + 0.08)
=

2.5x2 2.75x + 0.95(1mark)

This can be written in Horners form as


Pn (x) = 0.95 x(2.75 x(2.5))
2

(1mark)

ii)
f (0.25) = 2.5(0.252 ) 2.75(0.25) + 0.95 = 0.41875

(1 mark)

f (0.55) = 2.5(0.552 ) 2.75(0.55) + 0.95 = 0.19375

(1 mark)

and

iii) The error of Newton Forward Divided Difference formula is the first neglected term, which
is
error = F [x3 , x2 , x1 , x0 ](x x0 )(x x1 )(x x2 )
(1 mark)
Since F [x3 , x2 , x1 , x0 ] cannot be computed because of the available data, thus, the error
cannot be calculated. (1 mark)
iv) Algorithm for Newton Forward Divided Difference technique. (2 marks)
FUNCTION NFDDF(X,Y,N,XINT,YINT)
X[0] = 0.20, X[1] = 0.40, X[2] = 0.50
Y[0] = 0.50, Y[1] = 0.25, Y[2] = 0.20
N = 2, SUM = Y[2]
FOR I = 1 TO N
F[I,1] = (Y[N]-Y[N-1])/(X[N]-X[N-1])
END FOR
F[1,2] = (F[2,1]-F[1,1])/(X[2]-X[0])
FOR J = 1 TO N
PROD = 1
FOR K = 1 TO J
PROD = PROD * (XINT-X[K])
END FOR
SUM = SUM + F[1,J] * PROD
END FOR
YINT = SUM
WRITE YINT
END FUNCTION NFDDF