! Last change: G 25 Feb 2003 1:56 pm PROGRAM padeex1 USE pade IMPLICIT NONE CHARACTER(1)::test REAL(KIND=8)::endpt, h ,ans, begtime, endtime, total INTEGER:: n, eqs=1, cauchy=1, steps, i, jj REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE ::y, p DO WRITE(*,*)"Would you like to continue enter y or n " READ(*,*) test WRITE(*,*) IF (test=='n') EXIT WRITE(*,*)"please input end point " READ(*,*) endpt WRITE(*,*)"please input number of steps " READ(*,*) steps WRITE(*,*)"please input an even degree " READ(*,*) n ALLOCATE(y(1:eqs,0:n)) ALLOCATE(p(1:cauchy,0:n)) h=endpt/REAL(steps) !SET BEG INTIAL CONDITIONS y=0.0D0 y(1,0)=0.0D0 CALL CPU_TIME(begtime) ! MARCHING PICARD-PADE DO jj=1,steps ! PICARD p=0.0 p(1,0)=y(1,0)*y(1,0) y(1,1)=1.0D0 + p(1,0) DO i=1,n-1 !Cauchy Products p(1,i)=cp(y,1,y,1,i) !Setting the next term in the Taylor Series y(1,i+1)=p(1,i)/(i+1) !WRITE(*,*) y(1,i+1) END DO DO i=1,1 y(i,0)=padterm(y,h,i) END DO !DO i=1,1 ! y(i,0)=picterm(y,h,i) !END DO !MARCH ON END DO DO i=0,0 WRITE(*,*) "y(1,",i,")=",y(1,i) END DO ans=(TAN(endpt)) WRITE(*,*) "answer=",ans WRITE(*,*) "error=",ABS(ans-y(1,0)) WRITE(*,*) "relerror=",ABS((ans-y(1,0))/ans) CALL CPU_TIME(endtime) total=endtime-begtime WRITE(*,*) "total_CPU time=",total DEALLOCATE (y,p) END DO STOP END PROGRAM padeex1