program FindZeroNewton implicit none integer :: maxp real :: eps,xc,xt,f,f1 integer :: i maxp=200 eps=.00001 xt=0.3 do i=1,maxp xc=xt-f(xt)/f1(xt) if(abs(xc-xt) < eps ) exit ! togliere commento per vedere come converge write(6,*)'--->',i,xc,abs(xc-xt) xt=xc enddo if(i <= maxp) then write(6,*)xc else write(6,*) 'nessuna soluzione in ',maxp,' passi' endif end program FindZeroNewton real function f(x) implicit none real , INTENT(IN):: x f=x**2-1 end function f real function f1(x) implicit none real , INTENT(IN):: x f1=2*x end function f1