program polint_main integer ntab_max, nplot_max parameter (ntab_max = 20, nplot_max = 200) real x_tab(ntab_max), y_tab(ntab_max), x_min, x_max, delta_x real x_plot(nplot_max), y_plot(nplot_max), dy_plot(nplot_max) integer ntab, i, nplot, m, j, pgopen character*40 filename1 write(*,*)'Please tell me the number of tabulated values:' read(*,*) ntab write(*,*) 'Which filename contains the tabulated value ?' read(*,*) filename1 open(unit=10, file=filename1) 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 c call locate(x_tab,ntab,x_plot(i),j) call hunt(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 pgpt(ntab, x_tab, y_tab, 9) call pgclos end