Numerical Propagation
The backbone of numerical propagation in pykep is based on Lagrangian coefficients for Kepler’s dynamics and Taylor numerical integration, as implemented in the Heyoka [BI21] python package, for all other cases. The state transition matrix is also available and provided, in the case of numerical integration, seamlessly via variational equations.
In addition to the Keplerian propagators below, Taylor adaptive integrators are offered in pykep wrapping some of the functionalities of the Heyoka [BI21] python package. Their variational version is also offered (at order one) so as to produce STMs and, where needed, other useful quantities. Higher order variational equations can also be obtained directly using the available dynamics and Heyoka [BI21] syntax.
Some of the Taylor integrators are “zero-order hold” versions of a given dynamics, meaning that they consider a constant thrust vector in some frame and include the mass variation due to said thrust. These are intended to be used to build ZOH trajectory legs and direct methods to optimally control the spacecraft.
Some of the Taylor adaptive integrators are associated to OCPs (Optimal Control Problems) of relevance to interplanetary flight. In particular they are born when applying the Pontryagin principle to dynamics of interest and result in two-point boundary value problems (TPBVP). In these cases, a number of auxiliary functions describing the control, the Hamiltonian, the switching function, etc., are also provided.
Keplerian
pykep.propagate_lagrangian(rv=[[1, 0, 0], [0, 1, 0]], tof=pi / 2, mu=1, stm=False) : Propagates (Keplerian) the state for an assigned time and computes the State Transition Matrix (if requested) using the Lagrangian coefficients.
Args:
: *rv* (2D array-like): Cartesian components of the initial position vector and velocity [[x0, y0, z0], [v0, vy0, vz0]]. Defaults to [[1,0,0], [0,1,0]].
*tof* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): time of flight. Defaults to .
*mu* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): gravitational parameter. Defaults to 1.
*stm* ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)): requests the computations of the State Transition Matrix
Returns:
: [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list), [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)): r and v, that is the final position and velocity after the propagation. (if *stm* is False)
[`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) ([`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list), [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)), [`numpy.ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray) (6,6)): (r,v) and the STM. (if *stm* is True)
Examples:
: ```defaultimport pykep as pk import numpy as np r0 = [1,0,0] v0 = [0,1,0] tof = np.pi/2 mu = 1 [r1,v1], stm = pk.propagate_lagrangian(rv=[r0,v0], tof = tof, mu = mu, stm = True) [r1,v1] = pk.propagate_lagrangian(rv=[r0,v0], tof = tof, mu = mu, stm = False)
pykep.propagate\_lagrangian\_grid(*rv=[[1, 0, 0], [0, 1, 0]]*, *tofs=[pi / 2]*, *mu=1*, *stm=False*)
: This function calls [`pykep.propagate_lagrangian()`](#pykep.propagate_lagrangian) in a loop to provide the results on a time grid containing several epochs.
The main advantage is in the API which is convenient and reminiscent of the `heyoka.propagate_grid()` interface.
Note that this function is not necessarily more efficient than calling
[`pykep.propagate_lagrangian()`](#pykep.propagate_lagrangian) in a loop, since there is no parallelization nor SIMD magic implemented atm.
Nevertheless we offer this interface for convenience as it may allow more compact code.
Args:
: *rv* (2D array-like): Cartesian components of the initial position vector and velocity [[x0, y0, z0], [v0, vy0, vz0]]. Defaults to [[1,0,0], [0,1,0]].
> *tofs* (1D array-like): time of flight. Defaults to [].
*mu* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): gravitational parameter. Defaults to 1.
*stm* ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)): requests the computations of the State Transition Matrix
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) [[`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) ( [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) , [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) ) ]: For each time of flight: [r,v], that is the final position
and velocity after the propagation and the flattened stm (if requested).
Examples:
: ```default
>>> import pykep as pk
>>> import numpy as np
>>> r0 = [1,0,0]
>>> v0 = [0,1,0]
>>> tofs = [np.pi/2, np.pi, 3*np.pi/4]
>>> mu = 1
>>> res = pk.propagate_lagrangian_grid(rv = [r0, v0], tofs = tofs, mu = mu, stm = True)
>>> rs = [it[0][0] for it in res]
>>> vs = [it[0][1] for it in res]
>>> stms = [it[1] for it in res]Two Body Problem (Kepler)
pykep.ta.get_kep(tol) : Returns a Taylor adaptive propagator (Heyoka) for the simple Keplerian dynamics retrieving one from a global cache and making a copy.
If the requested propagator was never created, a call to this function will trigger its creation, else it will
return the one from a global cache, thus avoiding jitting.
In pykep, the simple keplerian dynamics is defined in Cartesian coordinates (thus it is not symplectic as not in a Hamiltonian form).
The specific dynamics used is that returned by [`kep_dyn()`](#pykep.ta.kep_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.
Examples:
: ```defaultimport pykep as pk ta = pk.ta.get_kep(tol = 1e-16) ta.time = 0. ta.state[:] = [1.01238082345234, -0.0423523523454, 0.22634376321, -0.1232623614, 0.123462698209365, 0.123667064622] mu = 0.01215058560962404 tof = 5.7856656782589234 ta.pars[0] = mu ta.propagate_until(tof)
pykep.ta.get\_kep\_var(*tol*)
: Returns a (order 1) variational Taylor adaptive propagator (Heyoka) for the simple Keplerian dynamics retrieving one from a global cache and making a copy.
If the requested propagator was never created, a call to this function will trigger its creation, else it will
return the one from a global cache, thus avoiding jitting.
Note
Variations are only considered with respect to initial conditions.
In pykep, the simple Keplerian dynamics is defined in Cartesian coordinates (thus it is not symplectic as not in a Hamiltonian form).
The specific dynamics used is that returned by [`kep_dyn()`](#pykep.ta.kep_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.
Examples:
: ```default
>>> import pykep as pk
>>> ta = pk.ta.get_kep_var(tol = 1e-16)
>>> ta.time = 0.
>>> ta.state[:] = [1.01238082345234, -0.0423523523454, 0.22634376321, -0.1232623614, 0.123462698209365, 0.123667064622]
>>> mu = 0.01215058560962404
>>> tof = 5.7856656782589234
>>> ta.pars[0] = mu
>>> ta.propagate_until(tof)pykep.ta.kep_dyn() : The dynamics of the simple Keplerian problem (kep).
In pykep, the kep is defined in Cartesian coordinates (thus it is not symplectic as not in a Hamiltonian form).
The parameter is the central body gravitational parameter.
where is the only parameter.
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) [ [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) (`hy::expression`, `hy::expression` )]: The dynamics in the form [(x, dx), …]Circular Restricted Three Body Problem
pykep.ta.get_cr3bp(tol) : Returns a Taylor adaptive propagator (Heyoka) for the CR3BP problem retrieving one from a global cache and making a copy.
If the requested propagator was never created, a call to this function will trigger its creation, else it will
return the one from a global cache, thus avoiding jitting.
In pykep, the CR3BP is defined in Cartesian coordinates (thus it is not symplectic as not in a Hamiltonian form).
The specific dynamics used is that returned by [`cr3bp_dyn()`](#pykep.ta.cr3bp_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.
Examples:
: ```defaultimport pykep as pk ta = pk.ta.get_cr3bp(tol = 1e-16) ta.time = 0. ta.state[:] = [1.01238082345234, -0.0423523523454, 0.22634376321, -0.1232623614, 0.123462698209365, 0.123667064622] mu = 0.01215058560962404 tof = 5.7856656782589234 ta.pars[0] = mu ta.propagate_until(tof)
pykep.ta.get\_cr3bp\_var(*tol*)
: Returns a (order 1) variational Taylor adaptive propagator (Heyoka) for the CR3BP problem retrieving one from a global cache and making a copy.
If the requested propagator was never created, a call to this function will trigger its creation, else it will
return the one from a global cache, thus avoiding jitting.
Note
Variations are only considered with respect to initial conditions.
In pykep, the CR3BP is defined in Cartesian coordinates (thus it is not symplectic as not in a Hamiltonian form).
The specific dynamics used is that returned by [`cr3bp_dyn()`](#pykep.ta.cr3bp_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.
Examples:
: ```default
>>> import pykep as pk
>>> ta = pk.ta.get_cr3bp_var(tol = 1e-16)
>>> ta.time = 0.
>>> ta.state[:] = [1.01238082345234, -0.0423523523454, 0.22634376321, -0.1232623614, 0.123462698209365, 0.123667064622]
>>> mu = 0.01215058560962404
>>> tof = 5.7856656782589234
>>> ta.pars[0] = mu
>>> ta.propagate_until(tof)pykep.ta.cr3bp_dyn() : The dynamics of the Circular Restricted Three Body Problem (CR3BP).
In pykep, the CR3BP is defined in Cartesian coordinates (thus it is not symplectic as not in a Hamiltonian form).
The parameter is defined as where is the mass of the
secondary body (i.e. placed on the positive x axis).
The equations are non-dimensional with units (distance between the primaries), (total system mass) and
(so that the angular velocity of the primaries is
and the period of rotation between the primaries is ).
where is the only parameter.
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) [ [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) (`hy::expression`, `hy::expression` )]: The dynamics in the form [(x, dx), …]pykep.ta.cr3bp_jacobi_C() : Jacobi constant of the CR3BP as a heyoka expression.
The Jacobi constant is a conserved quantity of the CR3BP. It is defined as:
where is the mass ratio of the primaries, and are the distances to the primaries.
Returns:
: `hy::expression`: the Jacobi constant of the CR3BP as a function of .pykep.ta.cr3bp_effective_potential_U() : Effective potential of the CR3BP as a heyoka expression. The effective potential is defined as:
where is the mass ratio of the primaries, and are the distances to the primaries.
Returns:
: `hy::expression`: the effective potential of the CR3BP as a function of .Bicircular Problem
Introduced by Simo’ et al. in his ‘97 paper [SimoGomezJM95].
pykep.ta.get_bcp(tol) : Returns a Taylor adaptive propagator (Heyoka) for the Bicircular Problem (BCP) dynamics retrieving one from a global cache (making a copy).
If the requested propagator was never created, this creates it; otherwise returns cached version
(avoiding re-jitting).
The BCP is defined in Cartesian coordinates (non-symplectic, non-Hamiltonian, time-dependent)
with Sun on the axis at .
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.
Examples:
: Import and setup:
```defaultimport pykep as pk ta = pk.ta.get_bcp(tol=1e-16) ta.time = 0. ta.state[:] = [1.01238082345234, -0.0423523523454, 0.22634376321, -0.1232623614, 0.123462698209365, 0.123667064622] mu = pk.CR3BP_MU_EARTH_MOON mu_s = pk.BCP_MU_S rho_s = pk.BCP_RHO_S rho_p = pk.BCP_RHO_S tof = 5.7856656782589234
Create propagator and propagate:
```default
ta.pars[:] = [mu, mu_s, rho_s, rho_p]
ta.propagate_until(tof)ta.get\_bcp(tol)
Returns a Taylor adaptive propagator (Heyoka) for the Bicircular Problem (BCP) dynamics
retrieving one from a global cache (making a copy).
If the requested propagator was never created, this creates it; otherwise returns cached version
(avoiding re-jitting).
The BCP is defined in Cartesian coordinates (non-symplectic, non-Hamiltonian, time-dependent)
with Sun on the axis at .
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.
Examples:
: Import and setup:
```defaultimport pykep as pk ta = pk.ta.get_bcp(tol=1e-16) ta.time = 0. ta.state[:] = [1.01238082345234, -0.0423523523454, 0.22634376321, -0.1232623614, 0.123462698209365, 0.123667064622] mu = pk.CR3BP_MU_EARTH_MOON mu_s = pk.BCP_MU_S rho_s = pk.BCP_RHO_S rho_p = pk.BCP_RHO_S tof = 5.7856656782589234
Create propagator and propagate:
```default
ta.pars[:] = [mu, mu_s, rho_s, rho_p]
ta.propagate_until(tof)pykep.ta.get_bcp_var(tol: float) : Returns a (order 1) variational Taylor adaptive propagator (Heyoka) for the Bicircular Problem (BCP) dynamics retrieving one from a global cache (making a copy).
If the requested propagator was never created, this creates it; otherwise returns cached version
(avoiding re-jitting).
Note
Variations are only considered with respect to initial conditions.
The BCP is defined in Cartesian coordinates (non-symplectic, non-Hamiltonian, time-dependent)
with Sun on the axis at .
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the variational Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The variational Taylor adaptive propagator.
Examples:
: Import and setup:
```defaultimport pykep as pk ta = pk.ta.get_bcp_var(tol=1e-16) ta.time = 0. ta.state[:6] = [1.01238082345234, -0.0423523523454, 0.22634376321, -0.1232623614, 0.123462698209365, 0.123667064622] mu = pk.CR3BP_MU_EARTH_MOON mu_s = pk.BCP_MU_S rho_s = pk.BCP_RHO_S rho_p = pk.BCP_RHO_S tof = 5.7856656782589234
Create propagator and propagate:
```default
ta.pars[:] = [mu, mu_s, rho_s, rho_p]
ta.propagate_until(tof)ta.get\_bcp\_var(tol:float)
Returns a (order 1) variational Taylor adaptive propagator (Heyoka) for the
Bicircular Problem (BCP) dynamics retrieving one from a global cache (making a copy).
If the requested propagator was never created, this creates it; otherwise returns cached version
(avoiding re-jitting).
Note
Variations are only considered with respect to initial conditions.
The BCP is defined in Cartesian coordinates (non-symplectic, non-Hamiltonian, time-dependent)
with Sun on the axis at .
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the variational Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The variational Taylor adaptive propagator.
Examples:
: Import and setup:
```defaultimport pykep as pk ta = pk.ta.get_bcp_var(tol=1e-16) ta.time = 0. ta.state[:6] = [1.01238082345234, -0.0423523523454, 0.22634376321, -0.1232623614, 0.123462698209365, 0.123667064622] mu = pk.CR3BP_MU_EARTH_MOON mu_s = pk.BCP_MU_S rho_s = pk.BCP_RHO_S rho_p = pk.BCP_RHO_S tof = 5.7856656782589234
Create propagator and propagate:
```default
ta.pars[:] = [mu, mu_s, rho_s, rho_p]
ta.propagate_until(tof)pykep.ta.bcp_dyn() : The dynamics of the Bicircular Problem (BCP).
In pykep, the BCP is defined in Cartesian coordinates (it is not symplectic nor in a Hamiltonian form). It is time-dependent and assumes the Sun
is on the axis at time zero.
The equations are non-dimensional with units (distance between the primaries), (total system mass) and
(so that the angular velocity of the primaries is
and the period of rotation between the primaries is ).
The parameter is defined as where is the mass of the
secondary body (i.e. placed on the positive x axis).
The equations of motion are:
where and are the system parameters. The spacecraft distance from the primaries
is and its distance from the Sun is . The Sun orbits at a distance with
angular velocity :.
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) [ [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) (`hy::expression`, `hy::expression` )]: The dynamics in the form [(x, dx), …]
bcp\_dyn()
The dynamics of the Bicircular Problem (BCP).
In pykep, the BCP is defined in Cartesian coordinates (it is not symplectic nor in a Hamiltonian form). It is time-dependent and assumes the Sun
is on the axis at time zero.
The equations are non-dimensional with units (distance between the primaries), (total system mass) and
(so that the angular velocity of the primaries is
and the period of rotation between the primaries is ).
The parameter is defined as where is the mass of the
secondary body (i.e. placed on the positive x axis).
The equations of motion are:
where and are the system parameters. The spacecraft distance from the primaries
is and its distance from the Sun is . The Sun orbits at a distance with
angular velocity :.
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) [ [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) (`hy::expression`, `hy::expression` )]: The dynamics in the form [(x, dx), …]Zero-Order Hold Keplerian Propagator in Cartesian Coordinates
pykep.ta.get_zoh_kep(tol) : Returns a Taylor adaptive propagator (Heyoka) for the zero-order-hold Keplerian low-thrust dynamics, retrieving one from a global cache and making a copy.
If the requested propagator was never created, this creates it; otherwise returns a copy of the cached
version (avoiding re-jitting while keeping independent runtime state).
The specific dynamics used is that returned by [`zoh_kep_dyn()`](#pykep.ta.zoh_kep_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.
Examples:
: ```defaultimport pykep as pk veff = 1.32 controls = [0.022, 0.023, -0.21, 0.1] ta = pk.ta.get_zoh_kep(tol = 1e-16) ta.time = 0. ta.state[:] = [1.2, 0.1, 0.1, 0.1, 1., 0.123, 1.] ta.pars[:] = controls + [1. / veff] ta.propagate_until(1.23)
pykep.ta.get\_zoh\_kep\_var(*tol*)
: Returns a (order 1) variational Taylor adaptive propagator (Heyoka) for the zero-order-hold
Keplerian low-thrust dynamics, retrieving one from a global cache and making a copy.
If the requested propagator was never created, this creates it; otherwise returns a copy of the cached
version (avoiding re-jitting while keeping independent runtime state).
Note
Variations are only considered with respect to initial conditions and the thrust parameters
.
The specific dynamics used is that returned by [`zoh_kep_dyn()`](#pykep.ta.zoh_kep_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the variational Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The variational Taylor adaptive propagator.
Examples:
: ```default
>>> import pykep as pk
>>> veff = 1.32
>>> controls = [0.022, 0.023, -0.21, 0.1]
>>> ta = pk.ta.get_zoh_kep_var(tol = 1e-16)
>>> ta.time = 0.
>>> ta.state[:7] = [1.2, 0.1, 0.1, 0.1, 1., 0.123, 1.]
>>> ta.pars[:] = controls + [1. / veff]
>>> ta.propagate_until(1.23)pykep.ta.zoh_kep_dyn() : The dynamics in Cartesian coordinates of a constant-thrust mass-varying spacecraft orbiting a central body with unitary gravitational parameter .
The electric propulsion is characterized by its effective exhaust velocity
, with .
The state is:
The system parameters are (in this order): .
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) [ [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) (`hy::expression`, `hy::expression` )]:
The dynamics in the form [(x, dx), …]Zero-Order Hold Keplerian Propagator in Equinoctial Elements
pykep.ta.get_zoh_eq(tol) : Returns a Taylor adaptive propagator (Heyoka) for the zero-order-hold equinoctial low-thrust dynamics, retrieving one from a global cache and making a copy.
If the requested propagator was never created, this creates it; otherwise returns a copy of the cached
version (avoiding re-jitting while keeping independent runtime state).
The specific dynamics used is that returned by [`zoh_eq_dyn()`](#pykep.ta.zoh_eq_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.pykep.ta.get_zoh_eq_var(tol) : Returns a (order 1) variational Taylor adaptive propagator (Heyoka) for the zero-order-hold Equinoctial low-thrust dynamics, retrieving one from a global cache and making a copy.
If the requested propagator was never created, this creates it; otherwise returns a copy of the cached
version (avoiding re-jitting while keeping independent runtime state).
Note
Variations are only considered with respect to initial conditions and the thrust parameters
.
The specific dynamics used is that returned by [`zoh_eq_dyn()`](#pykep.ta.zoh_eq_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the variational Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The variational Taylor adaptive propagator.pykep.ta.zoh_eq_dyn() : The dynamics in equinoctial elements of a constant-thrust mass-varying spacecraft orbiting a central body with unitary gravitational parameter .
The electric propulsion is characterized by its effective exhaust velocity
, with .
The state is:
The system parameters are (in this order): .
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) [ [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) (`hy::expression`, `hy::expression` )]:
The dynamics in the form [(x, dx), …]Zero-Order Hold CR3BP Propagator in Cartesian Coordinates
pykep.ta.get_zoh_cr3bp(tol) : Returns a Taylor adaptive propagator (Heyoka) for the zero-order-hold CR3BP low-thrust dynamics, retrieving one from a global cache and making a copy.
If the requested propagator was never created, this creates it; otherwise returns a copy of the cached
version (avoiding re-jitting while keeping independent runtime state).
The specific dynamics used is that returned by [`zoh_cr3bp_dyn()`](#pykep.ta.zoh_cr3bp_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.pykep.ta.get_zoh_cr3bp_var(tol) : Returns a (order 1) variational Taylor adaptive propagator (Heyoka) for the zero-order-hold CR3BP low-thrust dynamics, retrieving one from a global cache and making a copy.
If the requested propagator was never created, this creates it; otherwise returns a copy of the cached
version (avoiding re-jitting while keeping independent runtime state).
Note
Variations are only considered with respect to initial conditions and the thrust parameters
.
The specific dynamics used is that returned by [`zoh_cr3bp_dyn()`](#pykep.ta.zoh_cr3bp_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the variational Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The variational Taylor adaptive propagator.pykep.ta.zoh_cr3bp_dyn() : The dynamics of a fixed-thrust mass-varying spacecraft in the circular restricted three-body problem (CR3BP), with thrust fixed in the rotating frame.
The state is:
The system parameters are (in this order): .
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) [ [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) (`hy::expression`, `hy::expression` )]:
The dynamics in the form [(x, dx), …]Zero-Order Hold Solar Sail Propagator in Cartesian Coordinates
pykep.ta.get_zoh_ss(tol) : Returns a Taylor adaptive propagator (Heyoka) for the zero-order-hold solar-sail dynamics, retrieving one from a global cache and making a copy.
If the requested propagator was never created, this creates it; otherwise returns a copy of the cached
version (avoiding re-jitting while keeping independent runtime state).
The specific dynamics used is that returned by [`zoh_ss_dyn()`](#pykep.ta.zoh_ss_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.pykep.ta.get_zoh_ss_var(tol) : Returns a (order 1) variational Taylor adaptive propagator (Heyoka) for the zero-order-hold solar-sail dynamics, retrieving one from a global cache and making a copy.
If the requested propagator was never created, this creates it; otherwise returns a copy of the cached
version (avoiding re-jitting while keeping independent runtime state).
Note
Variations are only considered with respect to initial conditions and the sail-angle parameters
.
The specific dynamics used is that returned by [`zoh_ss_dyn()`](#pykep.ta.zoh_ss_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the variational Taylor adaptive propagator.
Returns:
: `hy::taylor_adaptive`: The variational Taylor adaptive propagator.pykep.ta.zoh_ss_dyn() : The dynamics in Cartesian coordinates of a solar-sail spacecraft around a central body with unitary gravitational parameter .
The state is:
The system parameters are (in this order): .
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) [ [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) (`hy::expression`, `hy::expression` )]:
The dynamics in the form [(x, dx), …]Low-Thrust Pontryagin Cartesian TPBVP
pykep.ta.get_pc(tol, optimality)
: Returns a Taylor adaptive propagator (Heyoka) for the TPBVP problem resulting from the application of
Pontryagin Maximum Principle (PMC) to the low-trhust problem (constant maximal thrust) in
Cartesian coordinates. If the requested propagator was never created, a call to this function will
trigger its compilation. Otherwise, it will return the one from a global cache, thus avoiding jitting.
The specific dynamics used is that returned by pc_dyn().
Both time optimal and mass optimal systems can be returned by setting the optimality parameter.
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
*optimality* (`pykep.optimality_type`): the optimality principle to be used.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.
Examples:
: ```defaultimport pykep as pk ta = pk.ta.get_pc(tol = 1e-16, optimality = pk.optimality_type.TIME) ta.time = 0.
We set the initial conditions with some arbitrary values (all costates to 1.)
ta.state[:14] = [1., 0., 0., 0., 1., 0., 10., 1., 1., 1., 1., 1., 1., 1.] ta.pars[:] = [1., 0.01, 1.] # in case of TIME parameters are [mu, Tmax, Isp g0] tof = 1.2345 ta.propagate_until(tof)
pykep.ta.get\_pc\_var(*tol*, *optimality*)
: Returns a (order 1) variational Taylor adaptive propagator (Heyoka) for the TPBVP problem resulting
from the application of Pontryagin Maximum Principle (PMP) to the low-thrust problem
(constant maximal thrust) in Cartesian coordinates. If the requested propagator was never created,
a call to this function will trigger its compilation. Otherwise, it will return the one from
a global cache, thus avoiding jitting.
Note
Variations are considered with respect to the initial conditions on the costates and to the
parameters and . In the time optimal case
is still considered a parameter (for consistency) but it is not used.
The specific dynamics used is that returned by [`pc_dyn()`](#pykep.ta.pc_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
*optimality* (`pykep.optimality_type`): the optimality principle to be used.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.
Examples:
: ```default
>>> import pykep as pk
>>> ta_var = pk.ta.get_pc_var(tol = 1e-16, optimality = pk.optimality_type.TIME))
>>> ta_var.time = 0.
>>> ta_var.state[:14] = [1., 0., 0., 0., 1., 0., 10., 1., 1., 1., 1., 1., 1., 1.]
>>> ta_var.pars[:] = [1., 0.01, 1.] # in case of TIME parameters are [mu, Tmax, Isp g0]
>>> tof = 1.2345
>>> ta_var.propagate_until(tof)pykep.ta.pc_dyn(optimality) : The augmented dynamics of the TPBVP originating when applying an indirect method to the low-thrust transfer problem in Cartesian coordinates.
The (non-augmented) dynamics is,
The state, containing the spacecraft state and the co-states, is:
While the parameters:
describe, respectively, the gravitational parameter, the maximum thrust, the effective velocity
(product of the specific impulse by ),
an homotopy parameter and a factor multiplying the instantaneous cost (in theory this can be any positive number as
the solution of the problem will not change)
The controls, representing magnitude and direction of the spacecraft thrust are:
The final equations of motion (in the case of mass optimality), are derived from the Hamiltonian:
or, in the case of time optimality:
by taking the derivatives:
The equation are then made independent of the controls applying Pontryagin minimum principle which takes the general form:
where is the set of admissible controls, i.e. the set of thrust directions and magnitudes.
and substituting in the equations the optimal controls found as function of the augmented system state.
Note
In the case of time optimality, the dynamics will not depend on neither nor
and the size of the parameter vector will this be three.
Args:
: *optimality* (`pykep.optimality_type`): the optimality principle to be used.
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) [ [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) (`hy::expression`, `hy::expression` )]: The dynamics in the form [(x, dx), …]Low-Thrust Pontryagin Equinoctial TPBVP
pykep.ta.get_peq(tol, optimality)
: Returns a Taylor adaptive propagator (Heyoka) for the TPBVP problem resulting from the application of
Pontryagin Maximum Principle (PMC) to the low-trhust problem (constant maximal thrust) in
Modified Equinoctial elements. If the requested propagator was never created, a call to this function will
trigger its compilation. Otherwise, it will return the one from a global cache, thus avoiding jitting.
The specific dynamics used is that returned by peq_dyn().
Both time optimal and mass optimal systems can be returned by setting the optimality parameter.
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
*optimality* (`pykep.optimality_type`): the optimality principle to be used.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.
Examples:
: ```defaultimport pykep as pk ta = pk.ta.get_peq(tol = 1e-16, optimality = pk.optimality_type.TIME) ta.time = 0.
We set the initial conditions with some arbitrary values (all costates to 1.)
ta.state[:14] = [1., 0., 0., 0., 1., 0., 10., 1., 1., 1., 1., 1., 1., 1.] ta.pars[:] = [1., 0.01, 1.] # in case of TIME parameters are [mu, Tmax, Isp g0] tof = 1.2345 ta.propagate_until(tof)
pykep.ta.get\_peq\_var(*tol*, *optimality*)
: Returns a (order 1) variational Taylor adaptive propagator (Heyoka) for the TPBVP problem resulting
from the application of Pontryagin Maximum Principle (PMP) to the low-thrust problem
(constant maximal thrust) in Modified Equinoctial Elements. If the requested propagator was never created,
a call to this function will trigger its compilation. Otherwise, it will return the one from
a global cache, thus avoiding jitting.
Note
Variations are considered with respect to the initial conditions on the costates and to the
parameters and . In the time optimal case
is still considered a parameter (for consistency) but it is not used.
The specific dynamics used is that returned by [`pc_dyn()`](#pykep.ta.pc_dyn).
Args:
: *tol* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): the tolerance of the Taylor adaptive propagator.
*optimality* (`pykep.optimality_type`): the optimality principle to be used.
Returns:
: `hy::taylor_adaptive`: The Taylor adaptive propagator.
Examples:
: ```default
>>> import pykep as pk
>>> ta_var = pk.ta.get_peq_var(tol = 1e-16, optimality = pk.optimality_type.TIME))
>>> ta_var.time = 0.
>>> ta_var.state[:14] = [1., 0., 0., 0., 1., 0., 10., 1., 1., 1., 1., 1., 1., 1.]
>>> ta_var.pars[:] = [1., 0.01, 1.] # in case of TIME parameters are [mu, Tmax, Isp g0]
>>> tof = 1.2345
>>> ta_var.propagate_until(tof)pykep.ta.peq_dyn(optimality) : The augmented dynamics of the TPBVP originating when applying an indirect method to the low-thrust transfer problem in Modified Equinoctial Elements (MEE).
The (non-augmented) dynamics is:
The auxiliary functions and variables used above are:
Introducing the state, containing both the physical state and the co-states, as:
the parameter vector, containing the gravitational parameter, maximum thrust, effective exhaust velocity, a homotopy continuation parameter,
and a normalizing Lagrange multiplier (see later), as:
and the control vector as:
the dynamics can be rewritten in compact form as:
Where:
As in the Cartesian case, the equations of motion for the TPBVP
are derived from the Hamiltonian, which depends on the chosen optimality:
- **Mass Optimality**:
- **Time Optimality**:
The full augmented dynamics is thus obtained by:
And by applying Pontryagin’s Minimum Principle:
where is the admissible set of control inputs (direction and throttle).
Args:
: *optimality* (`pykep.optimality_type`): the optimality principle to be used.
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) [ [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) (`hy::expression`, `hy::expression` )]: The dynamics in the form [(x, dx), …]