Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   plz c this fortran code (http://www.mac-forums.com/forums/os-x-development-darwin/216128-plz-c-fortran-code.html)

ahmed45 10-01-2010 12:10 AM

plz c this fortran code
 
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*,'Inte
rpolation of(',xx,')=',s
end

please ..a quick reply is needed..thank u

xstep 10-01-2010 04:23 PM

First, what is the question? We don't do peoples homework for them here.

Second, if you are going to post code, use the CODE tag to wrap it. Also make it cleanly formatted. Yours is messy and difficult to follow in a few places.


All times are GMT -4. The time now is 04:51 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.