esa / pykep

PyKEP is a scientific library providing basic tools for research in interplanetary trajectory design.
http://esa.github.io/pykep/
GNU General Public License v3.0
339 stars 96 forks source link

ic2par bug? #157

Closed Sceki closed 2 years ago

Sceki commented 2 years ago

It seems that pykep.ic2par returns the mean anomaly instead of the eccentric one:

import pykep
r=(-1322756.9200525356, -3353314.2849302134, 6087211.963478714)
v=(-127.4601321873357, 6523.747363692638, 3639.143742903858)
my_planet=pykep.planet.keplerian(pykep.epoch(58991.90384230018,'mjd'),r, v, pykep.MU_EARTH, 0., 0., 0., 'bo')
print(my_planet.osculating_elements(pykep.epoch(58991.90384230018,'mjd')))
print(pykep.ic2par(r,v,pykep.MU_EARTH))

returns:

(7009266.600500946, 0.012545359517058553, 1.7430029365898319, 4.634767059869722, 4.930255082528969, 2.3982064680030963)
(7009266.600500946, 0.012545359517058338, 1.743002936589832, 4.634767059869722, 4.930255082528977, 2.4066189799480373)

but I believe that the last element should be different, since osculating_elements returns the mean anomaly, right?

Sceki commented 2 years ago

By trying out more examples it actually seems that the above might be a numerical issue, in general it seems to return the eccentric anomaly, so closing this !