mirror of
https://github.com/quantum5/punyverse.git
synced 2025-04-24 13:11:57 -04:00
Use the faster Newton's method for eccentric anomaly.
Newton's method also converges quickly for highly eccentric orbits.
This commit is contained in:
parent
2aed23c4ae
commit
a862302408
|
@ -66,10 +66,11 @@ class KeplerOrbit(object):
|
||||||
self.__cos_argument = cos(self._argument)
|
self.__cos_argument = cos(self._argument)
|
||||||
|
|
||||||
def eccentric_anomaly(self, mean_anomaly):
|
def eccentric_anomaly(self, mean_anomaly):
|
||||||
e1 = mean_anomaly
|
e1 = 0
|
||||||
e2 = mean_anomaly + self.eccentricity * sin(e1)
|
e2 = mean_anomaly
|
||||||
while abs(e1 - e2) > 0.000001:
|
while abs(e1 - e2) > 0.000001:
|
||||||
e1, e2 = e2, mean_anomaly + self.eccentricity * sin(e2)
|
e1, e2 = e2, e2 - ((e2 - mean_anomaly - self.eccentricity * sin(e2)) /
|
||||||
|
(1 - self.eccentricity * cos(e2)))
|
||||||
return e2
|
return e2
|
||||||
|
|
||||||
def true_anomaly(self, mean_anomaly):
|
def true_anomaly(self, mean_anomaly):
|
||||||
|
|
Loading…
Reference in a new issue