      FUNCTION rtnewt(funcd,x,xacc,jmax)
      INTEGER JMAX
      REAL rtnewt,xacc
      EXTERNAL funcd
      INTEGER j
      REAL df,dx,f
      rtnewt=x
      do 11 j=1,JMAX
        call funcd(rtnewt,f,df)
	!	write(9,*)j,rtnewt,f
		write(9,*)j,f
        dx=f/df
        if(abs(dx).lt.xacc.or.abs(f).lt.xacc) goto 33
		  rtnewt=rtnewt-dx
11    continue
	write(*,*)'nao convergiu newton, j=',j,'c=',rtnewt,'f(c)=',f
33  continue
      write(*,*)'a solucao newton e =',rtnewt,'f(c)=',f
      return
      END
!****************************************
	subroutine f1(x,f,df)
		f=exp(x)-3*x
		df=exp(x)-3.
		return
		end
!************************************
!****************************************
	subroutine f2(x,f,df)
		f=exp(x)-x*x
		df=exp(x)-2*x
		return
		end
!************************************


