You are on page 1of 1

program Newton

implicit none
real x0,e1,e2,xb,x,f,fl,x1
integer k

print*, 'Insira o x0'


read*, x0
print*, 'Insira os erros'
read*, e1,e1
if (abs(f(x0)).it e1)then
xb=x
print*, xb
go to 2
endif

k=1
1 xa=x0-f(x0)/fl(x0)

if(abs(f(x1)).lt. e1) then


xb=x1
print*, xb
go to 2
endif
if (abs(x1-x0).lt. e2) then
xb=x1
print*, xb
go to 2
endif

x0+x1
k=k+1
go to 1

2 pause
end program

real function f(x)


real x
f=x**3-9*x+3
return
end

real function fl(x)


real x
fl=3*x**2-9
return
end

You might also like