The data table is given as below :

 i   X(i)   F(X(i))

--- ------ -------------
 0   0.5   0.2803817
 1   1.0   0.5000000
 2   1.5   0.5356465
 3   2.0   0.4406083
 4   2.5   0.2530506
 5   3.0   0.2597737
 6   3.5   0.3303348
 7   4.0   0.1967699
 8   4.5   0.2192214
 9   5.0   0.1897230

We will approximate the value of F(X) for X1=2.75 by using natural cubic spline interpolation method. We can not approximate the values of F(X) for X<0.5 and X>5.0 since these places are out of our data range. Because of this reason, we are not able to find an approximate value for F(5.25).
For the first interpolation we will use the points of
i=0,2,4,6,9 and N=4 and for the second one we will use all the data points :

i=0,1,2,3,4,5,6,7,8,9 and N=9

to make approximation for F(2.75) then compare the results with the real value

F(2.75)= 0.2137557

by interpolating error and make a comment on them.

 
The program of following pseudocode will satisfy the above condition :
 

INPUTs : N ; X(0),X(1),..X(N) ;
        A(0)=F(X(0)), A(1)=F(X(1)), .., A(N)=F(X(N)) .

OUTPUTs : A(I),B(I),C(I),D(I) for I=0,1,..,N-1 .

Step1 : for I=0,1,..,N-1
        set H(I) = X(I+1) - X(I) .

Step2 : for I=1,2,..,N-1
        set ALF(I) = 3*(A(I+1)-A(I))/H(I) - 3*(A(I)-A(I-1))/H(I-1) .

Step3 : set L(0)=1 ;
        M(0)=0 ;
        Z(0)=0 .

Step4 : for I=1,2,..,N-1
        set L(I) = 2*(X(I+1)-X(I-1)) - H(I-1) * M(I-1) ;
        M(I) = H(I)/L(I) ;
        Z(I) = (ALF(I)-H(I-1)*Z(I-1)) / L(I) .

Step5 : set L(N) = 1 ;
        set Z(N) = 0 ;
        set C(N) = 0 .

Step6 : for I=N-1,N-2,..,0
        set C(I) = Z(I) - M(I) * C(I+1) ;
        set B(I) = (A(I+1)-A(I))/H(I) - H(I)*(C(I+1)-2*C(I)) ;
        set D(I) = (C(I+1)-C(I)) / (3*H(I)) .

Step7 : OUTPUT (A(I),B(I),C(I),D(I) for I=0,1,..,N-1) ;

STOP .

 

After running the program we will get the coeficients of Si(X) functions :

A(I),B(I),C(I),D(I) such that :

Si(X) = A(I) + B(I) * (X-Xi) + C(I) * (X-Xi)^2 + D(I) * (X-Xi)^3

For the first trial (N=4), to find F(2.75) we should use S2 ;

and for the second trial (N=9), to find F(2.75) we should use S4 .

The results of the computer program are as follows for N=4

I        A(I)              B(I)             C(I)              D(I)
-- ----------------- ----------------- ----------------- -----------------
0   0.28038170000000  0.42695183098592  0.00000000000000  -0.17168703098592
1   0.53564650000000 -0.08810926197183 -0.51506109295775   0.32057445492958
2   0.25305060000000 -0.15650808309859  0.44666227183099  -0.21286998873239
3   0.33033480000000  0.09820649436620 -0.19194769436620   0.04265504319249

F(2.75) = .3395635991197183

The results of the computer program are as follows for N=4

I         A(I)              B(I)             C(I)              D(I)
-- ----------------- ----------------- ----------------- -----------------
0   0.28038170000000  0.52426328823283  0.00000000000000  -0.34010675293131
1   0.50000000000000  0.26918322353434 -0.51016012939697   0.22875936465655
2   0.53564650000000 -0.06940738237021 -0.16702108241213  -0.14863390569491
3   0.44060830000000 -0.34790389405352 -0.38997194095450   0.67109785812307
4   0.25305060000000 -0.23455244141571  0.61667484623011  -0.24135512679739
5   0.25977370000000  0.20110605971636  0.25464215603404  -0.74921975093353
6   0.33033480000000 -0.10616659744975 -0.86918747036626   1.09452213053151
7   0.19676990000000 -0.15446246991738  0.77259572543100  -0.74772957119250
8   0.21922140000000  0.05733607711925 -0.34899863135775   0.23266575423850

F(2.75) = .2291834936792453

The correspondind errors are :

For N=4 ; %err =|(F(2.75)-S2(2.75))*100/F(2.75)|

=|(0.2137557-0.3395636)*100/0.2137557|

-->%err =58.9 %
 
 

For N=9 ; %err =|(F(2.75)-S4(2.75))*100/F(2.75)|

=|(0.2137557-0.2291835)*100/0.2137557|

-->%err =07.2 %

 

CONCLUSION

As it is seen clearly, we get higher error in the firts trial than theother. The reason is that in the second trial we have more data points so have more accurary in approximation than the second one. Since cubic spline approximation method joins the points of the curve smoothly, more points provides more approximate curve to the exact or original one.