The equation of eccentric anomaly is given by
Using simple iteration which can be written as
, in which I iterate over and over until the difference between
!========================================================
! Purpose: Solve Kepler eccentric anomaly
!
! Methods: Simple iteration (E=M+e*sinE)
!
! Date Programer Description of change
! ==== ========= =====================
! 9/30/20 Morris Original Code
!========================================================
PROGRAM kepler
IMPLICIT NONE
REAL(16), PARAMETER :: pi = 3.1415926535898D0
REAL(16) :: phi, e, M, tmp
INTEGER :: i
open(1, file='kepler_2.dat', status='unknown')
e = 0.2D0
do i = 1, 100
M = pi * dble(i) / 50.D0
do
tmp = phi
phi = M + e * sin(phi)
write(*, *) abs(tmp-phi)
if (abs(tmp - phi) <= 1D-8) then
EXIT
end if
end do
write(1, '(3F20.17)') M, phi
end do
END PROGRAM kepler
In this program, it tries to find