# Ninguno

Páginas: 3 (626 palabras) Publicado: 24 de julio de 2010
***NEWTON INTERPOLATION***********************************************
* PROGRAM FOR NEWTON'S DIVIDED DFFERENCE INTERPOLATING POLYNOMIAL ***********************************************************************
*
program NEWINT
integer md,nd,n,m,i,j,k,np,jp,sele
parameter(md=20,nd=40)
doubleprecision XM(md),FX(nd,nd),xv,fa,y,er
write(*,*) ' Enter number ofdata points, n:'
write(*,*) ' Enter "X" data:'
write(*,*) ' Enter "FX" data:'
**
* COMPUTE THE FINITE DIVIDED DIFFERENCES
**
m = n - 1
do 20 j = 1,n
k = j + 1
np = n - j
do 10i = 1,np
FX(i,k) = (FX(i+1,j) - FX(i,j))/(XM(i+j)-XM(i))
10 continue
20 continue
**
write(6,*) 'The coefficients of interpolating polynomial,'
write(6,*) ' F(x)= b0 + b1(x-x1) + b2(x-x1)(x-x2) + .... +bn(x-x1
\$)(x-x2)...(x-xn) are:'
write(6,*)
write(6,*) (FX(1,j),j = 1,n)
*
sele = 1
30 if (sele.eq.1) thenwrite(6,*)
write(6,*) 'Enter independent variable, where interpolation is
\$desired, x:'
fa = 1.0
y = 0.0write(6,*)'---------------------------------------------------'
write(6,31) 'PREDICTED VALUE','ERROR'
31 format('0',24x,a15,8x,a5)
do 40 j = 1,n
y = y + FX(1,j) *fa
fa = fa *(xv -XM(j))
if(j.ge.n) go to 50
jp = j + 1
er = fa *FX(1,jp)
write(6,32) j-1,'- Order',y,er
32 format('0',3x,i1,a8,13x,f10.4,12x,f5.4)
40continue
50 write(6,51) j-1,'- Order',y
51 format('0',3x,i1,a8,13x,f10.4)
write(6,*)'---------------------------------------------------'
write(6,*) ' More...

Regístrate para leer el documento completo.