program polint_main real x_tab(20), y_tab(20), x_min, x_max, x_plot(200), y_plot(200) real delta_x, dy_plot(200) integer ntab, i, nplot, m, j, pgopen write(*,*)'Please tell me the number of tabulated values:' read(*,*) ntab open(unit=10, file='input_value.dat') do i=1,ntab read(10,*) x_tab(i), y_tab(i) end do close(10) write(*,*) 'Type in min and max of x:' read(*,*) x_min, x_max write(*,*) 'How many points to draw ?' read(*,*) nplot write(*,*) 'How many point to form polynomial ?' read(*,*) m delta_x = (x_max - x_min) / (nplot - 1) do i=1, nplot x_plot(i) = x_min + (i-1) * delta_x call locate(x_tab,ntab,x_plot(i),j) k = min( max(j-(m-1)/2,1) , ntab+1-m ) call polint(x_tab(k), y_tab(k), m, x_plot(i), y_plot(i), & dy_plot(i)) end do do i=1,nplot,10 write(*,*) 'x_plot and y_plot,', x_plot(i), y_plot(i) end do if ( pgopen('?') .le. 0 ) stop call pgenv(2.0, 6.0, 0.0, 40.0, 0, 1) call pgline(nplot, x_plot, y_plot) call pgclos end