Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program FindingElement
- use bebebe
- implicit none
- real(8)::x0
- real(8)::xn,temp,A,B,C
- integer::n
- real(8) ::eps=1.0e-7
- x0=2.4
- xn=x0
- n=0
- do while (.true.)
- A=fx(xn)
- B=fxp(xn)
- C=fxpp(xn)
- temp=xn
- xn=xn-A/B-C*A**2/(2*B**3)
- n=n+1
- if(ABS(temp-xn)<=eps) then
- write( *,'(a, i3)') 'n= ' ,n
- write( *,'(a, es15.7)') 'xn= ' ,xn
- write( *,'(a,es15.7)') 'f(xn)=' ,fx(xn)
- exit
- end if
- end do
- end program FindingElement
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement