Newton’s Method
See also ..\optimization\solving\Newton.htm or Bracketing.htm
Of course, you would not often want to solve such an equation by hand. Note that
The last approximation works best if you can arrange to have one value of S<0 and one > 0. Press’s method for this are discussed in the section on Bracketing and Bisection 9.1 in the 1986 edition. I illustrate this in the section below.
print*,’ enter E, deltaE’
c *** first find a negative value
E1=E
call shoot(E1,UP1)
if(up1.lt.0)goto 20
ep=e1
up=up1
10 E2=Ep+deltaE
call shoot(E2,UP2)
if(up2.lt.0)then
en=e2
un=up2
goto 30
else
ep=e2
up=up2
if(up2.lt.up1)deltaE=2*deltaE keep doubling the
goto 10 interval in the hopes of finally finding a
endif negative value
20 continue In this part we are trying to find a value >0
en=e1
un=up1
25 E2=Ep+deltaE
call shoot(E2,UP2)
if(up2.gt.0)then
ep=e2
up=up2
goto 30
else
en=e2
un=up2
if(up2.gt.up1)deltaE=2*deltaE keep doubling the interval in the hopes of
goto 25 of finally finding a positive value
endif
30 continue This part is easy since we have now bracketed 0
C*** we have un<0 and up>0
fp=(up-un)/(ep-en)
e=ep-up/fp note that ep and up go together
if(e.eq.ep.or.e.eq.en)then
print*,’ the eigenvalue is’,e
stop or return if this is a subroutine
endif
call shoot(e,u)
if(u.gt.0)then Always keep a pos and neg value
up=u
ep=e
else
un=u
en=e
endif
goto 30 The idea is to replace the value that is the same sign as the current one with one that is closer to zero.