plz c this fortran code..just a change needed

Numerical methods and mathematical models of Elmer
Post Reply
ahmed145
Posts: 1
Joined: 01 Oct 2010, 06:56

plz c this fortran code..just a change needed

Post by ahmed145 »

hello..this is a general newton forward difference ccode..where and what will change for newtons forward DIVIDED difference?.
.program Divided_Differences_Iterpolation dimension x(20),y(20),d(20,20)
n=7
xx=.7
data (x(i), i=1,7) /0,.5,1,1.4,2,3.2,5.5/
data (y(i), i=1,7)/-1.25,-3.5,6,2.32,1.5,1.27,5.6/
s=y(1)
do i=1,n-1
do j=1,n-i
y(j)=(y(j+1)-y(j))/(x(j+i)-x(j))
d(i,j)=y(j) print*,d(i,j)
enddo
enddo do i=1,n-1
p=1
do j=1,i p=p*(xx-x(j))
enddo s=s+d(i,1)*p
enddo
print*,'Interpolation of(',xx,')=',s
end
please ..a quick reply is needed..thank u
Post Reply