Numerical Analysis Programs Using Fortran 90 - University of ...
Numerical Analysis Programs Using Fortran 90 - University of ...
Numerical Analysis Programs Using Fortran 90 - University of ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Problem: Write a program to find the interpolated value for x =1. 15,<br />
using Newton forward method, for these tabulated data.<br />
X 1 1.2 1.4 1.6 1.8 2.0<br />
f 2.317 2.425 2.522 2.609 2.689 2.762<br />
dimension f(0:20),diff(0:20)<br />
xo=1<br />
x=1.15<br />
h=0.2<br />
n=5<br />
data (f(i), i=0,5)/2.317,2.425,2.522,2.609,2.689,2.762/<br />
r=(x-xo)/h<br />
do i=0,n-1<br />
diff(i)=f(i+1)-f(i)<br />
enddo<br />
coeff=r<br />
yx=f(0)+coeff*diff(0)<br />
do i=2,n<br />
coeff=coeff*(r-i+1)/(i)<br />
do j=0,n-i<br />
diff(j)=diff(j+1)-diff(j)<br />
enddo<br />
yx=yx+coeff*diff(0)<br />
enddo<br />
print*,yx<br />
end<br />
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br />
Interpolation <strong>of</strong> (1.15)= 2.398955<br />
14