Advertisement
Oppaceted

Untitled

Apr 5th, 2023
1,093
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program FindingElement
  2.     use bebebe
  3.     implicit none
  4.     real(8)::x0
  5.     real(8)::xn,temp,A,B,C
  6.     integer::n
  7.     real(8) ::eps=1.0e-7
  8.     x0=2.4
  9.     xn=x0
  10.     n=0
  11.     do while (.true.)
  12.       A=fx(xn)
  13.       B=fxp(xn)
  14.       C=fxpp(xn)
  15.       temp=xn
  16.       xn=xn-A/B-C*A**2/(2*B**3)
  17.       n=n+1
  18.       if(ABS(temp-xn)<=eps) then
  19.         write( *,'(a, i3)') 'n= ' ,n
  20.         write( *,'(a, es15.7)') 'xn= ' ,xn
  21.         write( *,'(a,es15.7)') 'f(xn)=' ,fx(xn)
  22.         exit
  23.       end if
  24.     end do
  25. end program FindingElement
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement