Skip to content

Instantly share code, notes, and snippets.

@astrojuanlu
Created June 21, 2019 13:17
Show Gist options
  • Save astrojuanlu/278940d8ac2cd6b1baa26e178afcd4d4 to your computer and use it in GitHub Desktop.
Save astrojuanlu/278940d8ac2cd6b1baa26e178afcd4d4 to your computer and use it in GitHub Desktop.
PyKep experiments
Python 3.7.3 | packaged by conda-forge | (default, Mar 27 2019, 23:01:00)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pykep import lambert_problem
>>> from math import pi
>>> l = lambert_problem([1., 0., 0.], [0., 1., 0.], 5 * pi / 2.)
>>> l
Lambert's problem:
mu = 1
r1 = [1, 0, 0]
r2 = [0, 1, 0]
Time of flight: 7.8539816339745
chord = 1.4142135623731
semiperimeter = 1.7071067811865
lambda = 0.41421356237309
non dimensional time of flight = 4.9798223260205
Maximum number of revolutions: 1
Solutions:
0 revs, Iters: 3, x: -0.58644325543794, a: 1.3009812610796
v1= [0.90230487720848529, 0.64590659483860502, 0] v2= [-0.64590659483860502, -0.90230487720848529, 0]
1 revs, left. Iters: 4, x: -0.11188837995933, a: 0.86437450327173
v1= [0.45213333668550759, 0.79916800651739384, 0] v2= [-0.79916800651739384, -0.45213333668550759, 0]
1 revs, right. Iters: 4, a: 0.38268343236509, a: 1
v1= [1.0257123289739564e-16, 0.99999999999999978, 0] v2= [-0.99999999999999978, -1.0257123289739564e-16, 0]
>>> l.get_iters()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: No to_python (by-value) converter found for C++ type: std::vector<int, std::allocator<int> >
>>> l = lambert_problem([1.0001, 0.0001, 0.0001], [0.0001, 1.0001, 0.00001], 5 * pi / 2.)
>>> l
Lambert's problem:
mu = 1
r1 = [1.0001, 0.0001, 0.0001]
r2 = [0.0001, 1.0001, 1.0000000000000001e-05]
Time of flight: 7.8539816339745
chord = 1.4142135652369
semiperimeter = 1.7072067901427
lambda = 0.41427213666497
non dimensional time of flight = 4.9793847520179
Maximum number of revolutions: 1
Solutions:
0 revs, Iters: 3, x: -0.58641808361264, a: 1.3009989341246
v1= [0.90219671389791434, 0.64591093990950621, 9.6661755009850417e-05] v2= [-0.64591093991027215, -0.90219672155874819, -7.3596035427494358e-05]
1 revs, left. Iters: 4, x: -0.11177712481321, a: 0.86440335923796
v1= [0.4519570329407957, 0.79916676280745691, 5.3173611312322879e-05] v2= [-0.79916676280807564, -0.45195703913200069, -8.4422487062228236e-05]
1 revs, right. Iters: 4, a: 0.38258941011596, a: 0.99997428825661
v1= [2.5732593140190884e-05, 0.99988713704973886, 9.9904477876137778e-06] v2= [-0.99988713705023335, -2.5737541224102957e-05, -9.997797423818353e-05]
>>> l.get_iters()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: No to_python (by-value) converter found for C++ type: std::vector<int, std::allocator<int> >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment