23.10.2014 Views

Numerical Analysis Programs Using Fortran 90 - University of ...

Numerical Analysis Programs Using Fortran 90 - University of ...

Numerical Analysis Programs Using Fortran 90 - University of ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Problem: Write a program to find the interpolated value for x =1. 05 ,<br />

using Stirling Interpolation method, for these tabulated data.<br />

X 0.5 0.7 0.9 1.1 1.3 1.5<br />

y 0.48 0.64 0.78 0.89 0.96 0.99<br />

program Stirling_Formula_Iterpolation<br />

dimension x(20),y(20),d(20,20)<br />

n=6<br />

xx=1.05<br />

data (x(i), i=1,6) /.5,.7,.9,1.1,1.3,1.5/<br />

data (y(i), i=1,6)/.48,.64,.78,.89,.96,.99/<br />

print*,(x(i), i=1,6)<br />

print*,(y(i), i=1,6)<br />

s=y(4)<br />

do i=1,n-1<br />

do j=1,n-i<br />

y(j)=y(j+1)-y(j)<br />

d(i,j)=y(j)<br />

print*,d(i,j)<br />

enddo<br />

enddo<br />

r=(xx-x(4))/(x(2)-x(1))<br />

p1=r*(d(1,3)+d(1,4))/2<br />

p2=r**2/2*d(2,3)<br />

p3=r*(r**2-1)/6*(d(3,2)+d(3,3))/2<br />

p4=r**2*(r**2-1)/24*d(4,2)<br />

s=s+p1+p2+p3+p4<br />

print*,'Interpolation <strong>of</strong>(',xx,')=',s<br />

end<br />

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br />

Interpolation <strong>of</strong>(1.05)=8.660302 E-01<br />

18

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!