!------------------------------------------------------------------ 
	function tf(x)
	parameter (nmax=100)
	dimension tp(nmax)
	external tfcn,rkqc
	common /noeqt/ n
	common /flag/ iflag
	common /const/ ht2

	common /param/ eta0,deta,etaend,f10,f20
	common /param1/ t10

!
!	initial values
!
	eta=eta0
	tp(1)=t10
	tp(2)=x
!
	k=0 
	if (iflag.eq.1) then
	write(5,*)eta,tp(1)
	write(6,*)eta,tp(2)
	write(8,*)'--------------------------------------------'

	write(8,*)'Nr do passo   eta     t1     t2 '

	write(8,*)'--------------------------------------------'

	write(8,*)k,eta,(tp(l),l=1,n)
	endif



!
	ht2=deta/1
	nd=nmax
!
!	beginning of time loop
!
 50	k=k+1 
	tendi=eta+deta
!      	write(*,*)'-------------eta=',tendi
!
!     call odeint(tp,n,eta,tendi,1.e-6,ht2,1.e-20,id1,id2,nmax,tfcn,rkqc)
	call  rk4ord(tp,n,eta,deta,tfcn,nd)
!    call fore(n,tfcn,eta,tp,tendi,nmax)
	if (iflag.eq.1) then
	if (k.eq.100.or.k.eq.200.or.k.eq.300.or.k.eq.400.or.k.eq.500.or.k.eq.600.or.k.eq.700.or.k.eq.800.or.k.eq.900.or.k.eq.1000) write(8,*)k,tendi,(tp(l),l=1,n)
	write(5,*)tendi,tp(1)
	write(6,*)tendi,tp(2)
	endif
!
     	if (tendi.lt.etaend) then
			eta=tendi
			goto 50 
		endif

	aux=tp(1)-1.
	tf=aux


      return 
      end 
!------------------------------------------------------
