INTRODUCTION

External perturbing accelerations can have a decisive effect on the orbital motion of a spacecraft. Orbits of great applied importance such as sun-synchronous orbits and Molniya-type orbits exist only due to perturbations from non-spherical Earth’s gravitational potential. The gravity of distant celestial bodies determines the existence of points of relative equilibrium—libration points—and allows the spacecraft’s motion around these points, for example, along halo orbits or Lissajous orbits. The perturbing acceleration from the Sun’s gravity makes it possible to implement weak stability boundary trajectories to the Moon (WSB trajectories), which can reduce the required operating fuel costs. Organization of the spacecraft motion along manifolds to quasi-periodic orbits around libration points L1 and L2 (the existence and characteristics of which depend on perturbing accelerations from the gravity of distant celestial bodies) makes it possible to reduce the required costs of the characteristic velocity in interplanetary flights. However, in most cases, perturbing accelerations are a factor that significantly complicates calculations of spacecraft trajectories, especially low-thrust trajectories.

Currently, transport operations in space are often implemented using electric propulsion systems (EPSs) with a high specific impulse of thrust, which significantly reduce the required fuel costs. The main feature of spacecraft flights with an EPS is low thrust. The level of thrust acceleration provided by an EPS in modern spacecraft usually does not exceed tenths of a mm/s2. The perturbing accelerations on the orbit transfers can often be comparable in magnitude with the thrust acceleration or even exceed it significantly. Perturbations from the second zonal harmonic of the geopotential in low orbits have a value of approximately 1 cm/s2, which is more than an order of magnitude higher than a typical thrust acceleration of a spacecraft with an EPS. The main perturbing accelerations for near-Earth spacecraft include accelerations from the non-spherical Earth’s gravitational field, perturbing accelerations from the gravity of the Moon and the Sun, aerodynamic acceleration, and acceleration from the solar radiation pressure. Of course, prevailing types of perturbing accelerations will vary for different spacecraft configurations and regions of the near-Earth space, and their influence on the trajectory and the EPS thrust vector control program can be very complex.

Traditionally, the study of low-thrust spacecraft trajectories begins with the consideration of spacecraft motion in the central Newtonian gravitational field. In most cases, further analysis requires an assessment of the influence of perturbing accelerations on the trajectory and control program, and it is necessary to take into account the main perturbations in the preparation of a flight program. In the simplest cases, for example, during a multi-revolution transfer between intermediate circular orbits of the same inclination with a specified control program (for example, with a circumferential thrust of constant magnitude) taking into account the main perturbing accelerations can be reduced to estimating the secular drift in the right ascension of the ascending node and short-term perturbations in all orbital elements. In this case, the precession of the right ascension of the ascending node can be compensated by appropriately choosing the right ascension of the ascending node of the initial orbit; if the amplitudes of the short-term oscillations of the orbital elements are within the given tolerance, the task of designing a perturbed transfer trajectory can be considered complete.

In more complex problems, especially in the case of trajectory optimization, in order to estimate the influence of perturbing accelerations on the optimal trajectory and optimal control program, it is necessary to take into account the perturbing accelerations in the process of trajectory optimization. Various approaches based on direct or indirect methods are used to optimize low-thrust trajectories.

Direct optimization methods, in a typical version, are reduced to some parameterization and/or discretization of control and further representation of the problem of minimizing a given cost function (for example, the transfer duration or fuel mass) in the form of a high-dimensional nonlinear programming problem. The advantage of the direct approach is the relative simplicity of taking into account the perturbing accelerations; however, the drawback is the high computational complexity (computation time) and the uncertainty of the criterion for the end of the optimization process, which can lead to calculation of solutions that differ significantly from the optimal ones.

Indirect methods are based on the use of necessary and/or sufficient optimality conditions. The most common option is to use the necessary optimality conditions in the form of the maximum principle. The main advantages of indirect methods are their relatively high performance (a significant reduction in the computation time as compared to direct methods) and high accuracy. However, to optimize the perturbed trajectories using the maximum principle, the calculation of the right-hand sides of differential equations for costate variables requires an accurate calculation of the derivatives of perturbing accelerations in state coordinates.

If the mathematical model of the perturbing accelerations is simple (for example, only the zonal harmonics of the geopotential and/or the aerodynamic drag with a static model of the upper atmosphere are taken into account), a reasonably complicated analytical representation of the right-hand sides of the differential equations for costate variables is possible. In the case of complicated mathematical models for high-precision calculation of perturbing accelerations, it is practically not possible to represent their derivatives in closed form. In this case, one can use high-precision numerical differentiation by the complex step method [1] or automatic differentiation using the algebra of dual numbers [2, 3]. The use of the complex step differentiation or automatic differentiation using the algebra of dual numbers significantly simplifies the development of a mathematical model of spacecraft motion for its application in the problem of trajectory optimization, since in this case it is only necessary to calculate the perturbing accelerations in the complex or dual domain. If the programming involves the technique of operator overloading and the correct redefinition of built-in functions in the complex or dual domain (i.e., if specially developed classes or modules for calculations in the complex or dual domain are used), the problem of implementing computations of perturbing accelerations and their derivatives according to the known algorithm for calculating these accelerations in the real domain is reduced to a simple redefinition of real state variables to complex or dual state variables in the program code. With regard to the optimization of low-thrust spacecraft trajectories, this technique has been used for a long period of time and it has already proved itself well [13].

However, there is another problem that significantly limits the stability and convergence rate of optimization of low-thrust trajectories with the considered approach. The maximum principle reduces the optimal control problem to a boundary-value problem for a system of ordinary differential equations for state and costate variables. To solve this boundary-value problem, it is necessary to find the values of the unknown parameters (in the simplest case, the initial values of the costate variables) at which the given boundary conditions and transversality conditions are satisfied (i.e., at which the vector of residuals of the boundary-value problem becomes zero). Formally, it is required to solve a system of nonlinear equations for the residuals with respect to the vector of unknown parameters of the boundary-value problem. It is possible to use various methods for this purpose, for example, various modifications of Newton’s method or gradient methods. In the 1990s, one of the authors of this study proposed [4] to solve the maximum principle boundary-value problem in the problems of optimization of low-thrust trajectories using the continuation method in the form presented in [5, 6]; it was proposed for solving systems of nonlinear equations and by that time had already been successfully applied for solving some other boundary-value problems [7, 8]. After some time, the continuation method, due to its computational stability and speed, began to be applied in problems of optimization of low-thrust spacecraft trajectories by many other authors [911].

The continuation method formally reduces the problem of solving a system of nonlinear equations to the integration of embedded systems of ordinary differential equations; the right-hand sides of the system of differential equations in the continuation method include the partial derivatives of the residuals of the maximum principle boundary-value problem with respect to its unknown parameters. The numerical integration of the system of differential equations of the continuation method requires an exact calculation of these derivatives, which can be easily realized in the case of an unperturbed problem with the aid of the same complex step differentiation or automatic differentiation using the algebra of dual numbers [13]. However, the use of these methods is much less effective in the optimization of perturbed trajectories, since these methods allow high-accuracy calculation of the first derivatives only, which has already been used when calculating the derivatives of perturbing accelerations with respect to state coordinates necessary for calculating the residuals of the boundary-value problem. Under these conditions, the derivatives of the residuals of the boundary-value problem with respect to its unknown parameters were calculated using a less accurate finite difference method, which reduced the computational stability and accuracy of the approach.

To construct effective methods for optimizing perturbed low-thrust trajectories based on the maximum principle and the continuation method, it is necessary to use a method that provides a high-precision calculation of second-order mixed derivatives. A number of authors proposed to use multicomplex or hyperdual numbers for high-precision calculation of the second derivatives [12, 13]. However, this leads to an overly large increase in computational costs due to the need to calculate “extra” second derivatives that are not used in the process of solving the problem. To overcome this circumstance, we propose to use a different mathematical object, complex dual numbers, or dual numbers with complex coefficients [14, 15]. To lower computational costs, complex dual numbers with a vector dual part are used, which make it possible to reduce the number of repeated computations of functions and their first derivatives in comparison with complex dual numbers with a scalar dual part or multicomplex and hyperdual numbers.

This paper presents a method for optimizing multi-revolution trajectories of the orbit transfers of a spacecraft with an EPS using the algebra of complex dual numbers; the method is based on the application of the maximum principle and the continuation method. The developed method sequentially solves the problems of optimizing the unperturbed trajectory of a spacecraft with an ideally controlled engine, so called power limited problem, using a continuation from Keplerian motion and optimizing a perturbed trajectory of a spacecraft with an EPS having bounded thrust magnitude and constant exhaust velocity using a continuation from the unperturbed optimal trajectory of a spacecraft with an ideally controlled engine.

The paper has the following structure. Section 1 presents the mathematical model of motion. In Section 2, an optimal control problem is formulated, to which the considered trajectory optimization problem is reduced. Using the maximum principle, this problem is reduced to a boundary-value problem for a system of ordinary differential equations. Section 3 describes a method for solving this boundary-value problem; in the Conclusion, the main theoretical results and features of the proposed method for optimizing perturbed finite-thrust trajectories are presented. Numerical examples of the trajectory optimization are given in the second part of the article.

1 MATHEMATICAL MODEL OF MOTION

Let us consider a mathematical model for application in the method of optimization of a multi-revolution finite-thrust trajectory taking into account the influence of perturbing accelerations. The use of Cartesian coordinates for optimization of multi-revolution low-thrust trajectories is not really practical, since the coordinates and velocity components of the spacecraft are short-period alternating functions, which leads to the need to reduce the numerical integration step and, therefore, to an increase in the computational complexity and growth of the global integration error at large time intervals. The use of orbital elements can significantly increase the speed and accuracy of numerical integration. We use modified equinoctial orbital elements [16], which have no singularities (in contrast to classical Keplerian elements) in the vicinity of circular and equatorial orbits. The advantages of using the angular independent variable for the mathematical model of spacecraft motion applied to the optimization of multi-revolution trajectories were shown in [17]. Thus, we will write the equations of the perturbed controlled spacecraft motion in modified equinoctial orbital elements using auxiliary anomaly K [17] as an independent variable:

$$\begin{gathered} \frac{{dp}}{{dK}} = \frac{{2{{p}^{3}}}}{{\mu {{q}^{3}}}}{{a}_{t}}, \\ \frac{{d{{e}_{x}}}}{{dK}} = \frac{{{{p}^{2}}}}{{\mu {{q}^{2}}}}\left[ {\sin L{{a}_{r}} + \frac{{\left( {q + 1} \right)\cos L + {{e}_{x}}}}{q}{{a}_{t}} - \frac{{{{e}_{y}}\xi }}{q}{{a}_{n}}} \right], \\ \frac{{d{{e}_{y}}}}{{dK}} = \frac{{{{p}^{2}}}}{{\mu {{q}^{2}}}}\left[ { - \cos L{{a}_{r}} + \frac{{\left( {q + 1} \right)\sin L + {{e}_{y}}}}{q}{{a}_{t}} + \frac{{{{e}_{x}}\xi }}{q}{{a}_{n}}} \right], \\ \frac{{d{{i}_{x}}}}{{dK}} = \frac{{{{p}^{2}}{{s}^{2}}}}{{2\mu {{q}^{3}}}}\cos L{{a}_{n}}, \\ \frac{{d{{i}_{y}}}}{{dK}} = \frac{{{{p}^{2}}{{s}^{2}}}}{{2\mu {{q}^{3}}}}\sin L{{a}_{n}}, \\ \frac{{d{{L}_{K}}}}{{dK}} = \frac{{{{p}^{2}}}}{{\mu {{q}^{3}}}}\xi {{a}_{n}},\,\,\,\frac{{dm}}{{dK}} = - \frac{\delta }{{\sqrt {\mu p} }}{{\left( {\frac{p}{q}} \right)}^{2}}\frac{T}{c}, \\ \frac{{dt}}{{dK}} = \frac{1}{{\sqrt {\mu p} }}{{\left( {\frac{p}{q}} \right)}^{2}}, \\ \end{gathered} $$
(1)

where p is the semi-latus rectum, \({{e}_{x}} = e\cos (\omega + \Omega )\), \({{e}_{y}} = e\sin (\omega + \Omega )\), \({{i}_{x}} = \tan \frac{i}{2}\cos \Omega ,\) \({{i}_{y}} = \tan \frac{i}{2}\sin \Omega \), LK = L – K is the deviation of true longitude \(L = \nu + \omega + \Omega \) from auxiliary longitude K, \({{s}^{2}} = 1 + i_{x}^{2} + i_{y}^{2}\), \(q = 1 + {{e}_{x}}\cos L + {{e}_{y}}\sin L\), \(\xi = \) \({{i}_{x}}\sin L - {{i}_{y}}\cos L\), \({{a}_{t}} = \delta \frac{T}{m}\cos \vartheta \cos \psi + {{a}_{{pt}}}\), ar = \(\delta \frac{T}{m}\sin \vartheta \cos \psi + {{a}_{{pr}}}\), \({{a}_{n}} = \delta \frac{T}{m}\sin \psi + {{a}_{{pn}}}\), μ is the gravitational parameter of the central celestial body; δ is the throttling function of thrust (δ = 1 with the propulsion system turned on, and δ = 0 with the propulsion system turned off); T is the propulsion system thrust; c is the exhaust velocity; m is the spacecraft mass; ϑ is pitch; ψ is yaw; apt, apr, and apn are the components of the perturbing acceleration; e is the eccentricity; ω is the argument of perigee; i is the inclination; Ω is the right ascension of the ascending node; and ν is the true anomaly. In the right-hand parts of system (1), the true longitude should be represented as L = K + LK.

Hereafter, we restrict ourselves to considering the problem of a transfer between given orbits with a fixed angular distance in true longitude ΔL = Lf L0 (where L0 and Lf are the initial and final values of the true longitude, respectively) and free transfer duration. In this case, without loss of generality, the initial conditions of motion for a fixed value of the initial auxiliary longitude K0 are set as

$$\begin{gathered} p\left( {{{K}_{0}}} \right) = {{p}_{0}},\,\,\,{{e}_{x}}\left( {{{K}_{0}}} \right) = {{e}_{{x0}}},\,\,\,{{e}_{y}}\left( {{{K}_{0}}} \right) = {{e}_{{y0}}}, \\ {{i}_{x}}\left( {{{K}_{0}}} \right) = {{i}_{{x0}}},\,\,\,{{i}_{y}}\left( {{{K}_{0}}} \right) = {{i}_{{y0}}}, \\ {{L}_{K}}\left( {{{K}_{0}}} \right) = {{L}_{0}} - {{K}_{0}},\,\,\,m\left( {{{K}_{0}}} \right) = {{m}_{0}}, \\ \end{gathered} $$
(2)

and the final conditions for the free final value of auxiliary longitude Kf = K0 + ΔK are set as

$$\begin{gathered} p\left( {{{K}_{f}}} \right) = {{p}_{f}},{{e}_{x}}\left( {{{K}_{f}}} \right) = {{e}_{{xf}}},\,\,\,{{e}_{y}}\left( {{{K}_{f}}} \right) = {{e}_{{yf}}}, \\ {{i}_{x}}\left( {{{K}_{f}}} \right) = {{i}_{{xf}}},\,\,\,{{i}_{y}}\left( {{{K}_{f}}} \right) = {{i}_{{yf}}},\,\,\,{{L}_{K}}\left( {{{K}_{f}}} \right) = {{L}_{f}} - {{K}_{f}}. \\ \end{gathered} $$
(3)

It should be noted that the initial value of true longitude K0 without loss of generality can be chosen equal to 0, while the initial value of true longitude L0, depending on the formulation of the problem, can be fixed or free.

2 OPTIMAL CONTROL PROBLEM

Let us consider the problem of optimizing an orbit transfer, i.e., the problem of optimal control of a dynamic system described by differential equations (1) in order to transfer it from state (2) to state (3) with minimum fuel consumption mp = m(K0) – m(Kf). Obviously, to solve this problem, we need to find functions (programs) δ(K), ϑ(K), and ψ(K) that minimize the cost function

$$J = \int\limits_{{{t}_{0}}}^{{{t}_{f}}} {\delta \frac{T}{c}dt} = \int\limits_{{{K}_{0}}}^{{{K}_{f}}} {\delta \frac{T}{{{{q}^{2}}c}}\sqrt {\frac{{{{p}^{3}}}}{\mu }} dK} .$$
(4)

The Pontryagin function of the optimal control problem has the following form:

$$H = {{H}_{T}} + {{H}_{p}} + {{H}_{t}},$$
(5)

where

$$\begin{gathered} {{H}_{T}} = \delta T{{k}_{1}}\left[ {\frac{{{{k}_{2}}}}{m}} \right.\left( {{{A}_{r}}\sin \vartheta \cos \psi + } \right.{{A}_{t}}\cos \vartheta \cos \psi \\ \left. { + \,\,\left. {{{A}_{n}}\sin \psi } \right) - \frac{{{{p}_{m}} + 1}}{c}} \right], \\ \end{gathered} $$

\({{H}_{p}} = {{k}_{1}}{{k}_{2}}\left( {{{A}_{r}}{{a}_{{pr}}} + {{A}_{t}}{{a}_{{pt}}} + {{A}_{n}}{{a}_{{pn}}}} \right),\) \({{H}_{t}} = \frac{1}{{\sqrt {\mu p} }}{{\left( {\frac{p}{q}} \right)}^{2}}{{p}_{t}}\) are the parts of the Pontryagin function, which depend, respectively, on the thrust, perturbing accelerations, and the time costate variable pt,

$$\begin{gathered} {{A}_{t}} = 2p{{p}_{p}} + \left[ {\left( {q + 1} \right)\cos L + {{e}_{x}}} \right]{{p}_{{ex}}} \\ + \,\,\left[ {\left( {q + 1} \right)\sin L + {{e}_{y}}} \right]{{p}_{{ey}}}, \\ {{A}_{r}} = q\left( {\sin L{{p}_{{ex}}} - \cos L{{p}_{{ey}}}} \right), \\ {{A}_{n}} = \xi \left( { - {{e}_{y}}{{p}_{{ex}}} + {{e}_{x}}{{p}_{{ey}}} + {{p}_{{LK}}}} \right) \\ + \,\,\frac{{{{s}^{2}}}}{2}\left( {\cos L{{p}_{{ix}}} + \sin L{{p}_{{iy}}}} \right), \\ \end{gathered} $$

pp, pex, pey, pix, piy, pLK, pm, and pt are the costate variables to the corresponding state variables of the system p, ex, ey, ix, iy, LK, m, t, \({{k}_{1}} = \frac{1}{{{{q}^{2}}}}\sqrt {\frac{{{{p}^{3}}}}{\mu }} \), \({{k}_{2}} = \frac{1}{q}\sqrt {\frac{p}{\mu }} \).

Maximizing (5) with respect to ϑ, ψ, and δ, we obtain the following expressions for the optimal control:

$$\begin{gathered} \sin \vartheta = {{{{A}_{r}}} \mathord{\left/ {\vphantom {{{{A}_{r}}} {{{A}_{{rt}}},}}} \right. \kern-0em} {{{A}_{{rt}}},}}\,\,\,\cos \vartheta = {{{{A}_{t}}} \mathord{\left/ {\vphantom {{{{A}_{t}}} {{{A}_{{rt}}},}}} \right. \kern-0em} {{{A}_{{rt}}},}} \\ \sin \psi = {{{{A}_{n}}} \mathord{\left/ {\vphantom {{{{A}_{n}}} {A,}}} \right. \kern-0em} {A,}}\,\,\,\cos \psi = {{{{A}_{{rt}}}} \mathord{\left/ {\vphantom {{{{A}_{{rt}}}} {A,}}} \right. \kern-0em} {A,}} \\ \end{gathered} $$
(6)
$$\delta = {{\left( {1 + \operatorname{sign} S} \right)} \mathord{\left/ {\vphantom {{\left( {1 + \operatorname{sign} S} \right)} 2}} \right. \kern-0em} 2},\,\,S \ne 0;\,\,\,\delta \in \left[ {0;1} \right],\,\,\,S = 0,$$
(7)

where \({{A}_{{rt}}} = \sqrt {A_{r}^{2} + A_{t}^{2}} \), \(A = \sqrt {A_{r}^{2} + A_{t}^{2} + A_{n}^{2}} \), \(S = \frac{{{{k}_{2}}A}}{m}\)\(\frac{{{{p}_{m}} + 1}}{c}\).

Substituting (6) and (7) into (5), we obtain the expression for the Hamiltonian of the optimal control problem. The equations of the optimal motion have the form

$$\frac{{d{{{\mathbf{x}}}_{1}}}}{{dK}} = \frac{{\partial H}}{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}1}}}}},\,\,\,\frac{{d{{{\mathbf{p}}}_{{{\mathbf{x}}1}}}}}{{dK}} = - \frac{{\partial H}}{{\partial {{{\mathbf{x}}}_{1}}}},$$
(8)

where \({\mathbf{x}}_{1}^{{\text{T}}}\) = (p, ex, ey, ix, iy, LK, m, t), \({\mathbf{p}}_{{{{{\mathbf{x}}}_{1}}}}^{{\text{T}}}\) = (pp, pex, pey, pix, piy, pLK, pm, pt).

To solve the trajectory optimization problem, it is necessary to calculate eight initial values of costate variables px1 and the final value of auxiliary longitude Kf (a total of nine unknown variables). Boundary conditions (2) and (3) define only six equations for these nine unknown variables and must be supplemented with three transversality conditions. To derive them, we consider the Lagrange endpoint function in the following form [21, 30]:

$$\begin{gathered} l = \left( {{{L}_{K}}\left( {{{K}_{0}}} \right) + {{K}_{0}} - {{L}_{0}}} \right)\lambda _{L}^{0} + \left( {{{L}_{K}}\left( {{{K}_{f}}} \right) + {{K}_{f}} - {{L}_{f}}} \right)\lambda _{L}^{f} \\ + \,\,{{\left( {{\mathbf{x}}\left( {{{K}_{0}}} \right) - {{{\mathbf{x}}}_{0}}\left( {{{L}_{0}}} \right)} \right)}^{\operatorname{T} }}{\boldsymbol{\lambda }}_{{\mathbf{x}}}^{0} + {{\left( {{\mathbf{x}}\left( {{{K}_{f}}} \right) - {{{\mathbf{x}}}_{f}}\left( {{{L}_{f}}} \right)} \right)}^{\operatorname{T} }}{\boldsymbol{\lambda }}_{{\mathbf{x}}}^{f} \\ + \,\,\left( {m\left( {{{K}_{0}}} \right) - {{m}_{0}}} \right)\lambda _{m}^{0} + \left( {t\left( {{{K}_{0}}} \right) - {{t}_{0}}} \right)\lambda _{t}^{0}, \\ \end{gathered} $$

where \(\lambda _{L}^{0},\lambda _{L}^{f},{\boldsymbol{\lambda }}_{{\mathbf{x}}}^{0},{\boldsymbol{\lambda }}_{{\mathbf{x}}}^{f},\lambda _{m}^{0},\lambda _{t}^{0}\) are the Lagrange multipliers, x = (pexeyixiy)T is the part of the vector of modified equinoctial orbital spacecraft elements, x0 = (p0ex0ey0ix0iy0)T and xf = (pf, exf, eyf, ixf, iyf)T are the modified equinoctial elements of the initial and final orbits, respectively. The transversality conditions for this Lagrange endpoint function take the following form:

$$\begin{array}{*{20}{c}} {\begin{array}{*{20}{c}} {{{{\mathbf{p}}}_{{\mathbf{x}}}}\left( {{{K}_{0}}} \right) = \frac{{\partial l}}{{\partial {\mathbf{x}}\left( {{{K}_{0}}} \right)}} = {\boldsymbol{\lambda }}_{{\mathbf{x}}}^{0},}&{{{{\mathbf{p}}}_{{\mathbf{x}}}}\left( {{{K}_{f}}} \right) = - \frac{{\partial l}}{{\partial {\mathbf{x}}\left( {{{K}_{f}}} \right)}} = - {\boldsymbol{\lambda }}_{{\mathbf{x}}}^{f},} \end{array}} \\ \begin{gathered} \begin{array}{*{20}{c}} {{{p}_{{LK}}}\left( {{{K}_{0}}} \right)\, = \,\frac{{\partial l}}{{\partial {{L}_{K}}\left( {{{K}_{0}}} \right)}}\, = \,\lambda _{L}^{0},}&{{{p}_{{LK}}}\left( {{{K}_{f}}} \right)\, = \, - \frac{{\partial l}}{{\partial {{L}_{K}}\left( {{{K}_{f}}} \right)}}\, = \, - \lambda _{L}^{f},} \end{array} \\ {{p}_{m}}\left( {{{K}_{0}}} \right) = \frac{{\partial l}}{{\partial m\left( {{{K}_{0}}} \right)}} = \lambda _{m}^{0},{\text{ }}{{p}_{m}}\left( {{{K}_{f}}} \right) = - \frac{{\partial l}}{{\partial m\left( {{{K}_{f}}} \right)}} = 0, \\ {{p}_{t}}\left( {{{K}_{0}}} \right) = \frac{{\partial l}}{{\partial t\left( {{{K}_{0}}} \right)}} = \lambda _{t}^{0},{\text{ }}{{p}_{t}}\left( {{{K}_{f}}} \right) = - \frac{{\partial l}}{{\partial t\left( {{{K}_{f}}} \right)}} = 0, \\ \end{gathered} \\ {\begin{array}{*{20}{c}} {H\left( {{{K}_{0}}} \right) = - \frac{{\partial l}}{{\partial {{K}_{0}}}} = - \lambda _{L}^{0},}&{H\left( {{{K}_{f}}} \right) = \frac{{\partial l}}{{\partial {{K}_{f}}}} = \lambda _{L}^{f},} \end{array}} \end{array}$$

where px = (pp, pex, pey, pix, piy)T.

These conditions imply the relations pm(Kf) = 0, pt(Kf) = 0, \({{p}_{{LK}}}\left( {{{K}_{0}}} \right) + H\left( {{{K}_{0}}} \right) = 0\) and \({{p}_{{LK}}}\left( {{{K}_{f}}} \right) + \) \(H\left( {{{K}_{f}}} \right) = 0\). Let us show that pLK + H is the first integral of system (8). Indeed, \(\frac{{d{{p}_{{LK}}}}}{{dK}} = - \frac{{\partial H}}{{\partial {{L}_{K}}}} = \) \( - \frac{{\partial H}}{{\partial K}} = - \frac{{dH}}{{dK}}\), since K and LK are included in Hamiltonian (5) only as the sum K + LK and taking into account the known properties of nonautonomous Hamiltonian systems. Hence, it follows that \({{d\left( {{{p}_{{LK}}} + H} \right)} \mathord{\left/ {\vphantom {{d\left( {{{p}_{{LK}}} + H} \right)} {dK = 0}}} \right. \kern-0em} {dK = 0}}\); i.e., pLK + H is the first integral. Therefore, if pLK + H is zero for any K, this implies the identical equality to zero of this expression on the entire trajectory. Taking into account the accepted equality K0 = 0, the additional boundary condition is reduced to \({{p}_{{LK}}}\left( 0 \right) + H\left( 0 \right) = 0\).

This equation can be used to calculate the unknown value of pLK(0), which reduces the number of unknown parameters of the boundary-value problem to eight. Ultimately, the boundary conditions for the problem under consideration, taking into account the possibility of using the equality K0 = 0 in the general case, can be written as

$$\begin{gathered} {{L}_{K}}\left( 0 \right) = {{L}_{0}},\,\,\,{\mathbf{x}}\left( 0 \right) = {{{\mathbf{x}}}_{0}}\left( {{{L}_{0}}} \right),\,\,\,m\left( 0 \right) = {{m}_{0}}, \\ t\left( 0 \right) = {{t}_{0}},\,\,\,{{p}_{{LK}}}\left( 0 \right) + H\left( 0 \right) = 0, \\ \end{gathered} $$
(9)
$$\begin{gathered} {{L}_{K}}\left( {{{K}_{f}}} \right) + {{K}_{f}} = {{L}_{f}},\,\,\,{\mathbf{x}}\left( {{{K}_{f}}} \right) = {{{\mathbf{x}}}_{f}}\left( {{{L}_{f}}} \right), \\ {{p}_{m}}\left( {{{K}_{f}}} \right) = 0,\,\,\,{{p}_{t}}\left( {{{K}_{f}}} \right) = 0, \\ \end{gathered} $$
(10)

and to solve the boundary-value problem of the maximum principle (8)–(10), it is required to calculate eight components of vector px1(0) and final auxiliary longitude Kf at which the last equation in (9) and eight scalar equations (10) are satisfied. Due to the dependence of the Hamiltonian on pLK, the last equation in (9) is reduced to a quadratic equation with respect to pLK(0). This quadratic equation can be solved for given initial conditions and the current value of other elements of px1(0), after which pLK(0), together with the last equation of (9), can be excluded from the boundary-value problem, reducing its order to 8. It should be noted that only one of the two solutions of the quadratic equation for pLK(0) is a solution to this boundary-value problem.

The main advantage of the considered formulation of the trajectory optimization problem with a fixed angular distance and free transfer duration is that for same-type families of trajectories, judging by the numerical analysis carried out earlier (e.g., in [17, 18]), there is only one solution that satisfies the necessary conditions of optimality. If a more traditional formulation is used—trajectory optimization with a fixed transfer duration and free angular distance—there are many optimal solutions with different numbers of orbits [10, 19, 20], which limits the convergence of numerical methods and complicates the calculation of globally optimal solutions.

It should be noted that, when optimizing unperturbed trajectories or in the case in which the perturbing accelerations do not explicitly depend on time, the differential equation for time can be excluded from the system of differential equations for optimal motion together with the boundary conditions for time and the time costate variable. In this case, the Hamiltonian does not explicitly depend on time; therefore, dpt/dK ≡ 0 and pt(K) ≡ 0 by virtue of the last equation in (10). In this case, the necessary condition for the optimality of the transfer time (transversality condition) is fulfilled automatically.

If it is necessary to optimize initial true longitude L0, we use the Lagrange endpoint function in the following form to derive the transversality conditions [30]:

$$\begin{gathered} l = \left( {{{L}_{K}}\left( {{{K}_{0}}} \right) + {{K}_{0}} - {{L}_{0}}} \right)\lambda _{L}^{0} + \left( {{{L}_{K}}\left( {{{K}_{f}}} \right) + {{K}_{f}} - {{L}_{f}}} \right)\lambda _{L}^{f} \\ + \,\,\left( {{{L}_{K}}\left( {{{K}_{f}}} \right) + {{K}_{f}} - {{L}_{K}}\left( {{{K}_{0}}} \right) - {{K}_{0}} - \Delta L} \right){{\lambda }_{L}} \\ + \,\,{{\left( {{\mathbf{x}}\left( {{{K}_{0}}} \right) - {{{\mathbf{x}}}_{0}}\left( {{{L}_{0}}} \right)} \right)}^{\operatorname{T} }}{\boldsymbol{\lambda }}_{{\mathbf{x}}}^{0} + {{\left( {{\mathbf{x}}\left( {{{K}_{f}}} \right) - {{{\mathbf{x}}}_{f}}\left( {{{L}_{f}}} \right)} \right)}^{\operatorname{T} }}{\boldsymbol{\lambda }}_{{\mathbf{x}}}^{f}, \\ \end{gathered} $$

where λL is an additional Lagrange multiplier. The transversality conditions with this end function will take the form

$$\begin{gathered} \begin{array}{*{20}{c}} {\begin{array}{*{20}{c}} {{{{\mathbf{p}}}_{{\mathbf{x}}}}\left( {{{K}_{0}}} \right) = \frac{{\partial l}}{{\partial {\mathbf{x}}\left( {{{K}_{0}}} \right)}} = {\boldsymbol{\lambda }}_{{\mathbf{x}}}^{0},}&{{{{\mathbf{p}}}_{{\mathbf{x}}}}\left( {{{K}_{f}}} \right) = - \frac{{\partial l}}{{\partial {\mathbf{x}}\left( {{{K}_{f}}} \right)}} = - {\boldsymbol{\lambda }}_{{\mathbf{x}}}^{f},} \end{array}} \\ \begin{gathered} \begin{array}{*{20}{c}} {{{p}_{{LK}}}\left( {{{K}_{0}}} \right)\, = \,\frac{{\partial l}}{{\partial {{L}_{K}}\left( {{{K}_{0}}} \right)}}\, = \,\lambda _{L}^{0},}&{{{p}_{{LK}}}\left( {{{K}_{f}}} \right)\, = \, - \frac{{\partial l}}{{\partial {{L}_{K}}\left( {{{K}_{f}}} \right)}}\, = - \lambda _{L}^{f},} \end{array} \hfill \\ \begin{array}{*{20}{c}} {H\left( {{{K}_{0}}} \right) = - \frac{{\partial l}}{{\partial {{K}_{0}}}} = - \lambda _{L}^{0},}&{H\left( {{{K}_{f}}} \right) = \frac{{\partial l}}{{\partial {{K}_{f}}}} = \lambda _{L}^{f},} \end{array} \hfill \\ \end{gathered} \\ {\frac{{\partial l}}{{\partial {{L}_{0}}}} = - {{\lambda }_{L}} - \lambda _{L}^{0} - {{{\left( {\frac{{d{{{\mathbf{x}}}_{0}}\left( {{{L}_{0}}} \right)}}{{d{{L}_{0}}}}} \right)}}^{\operatorname{T} }}{\boldsymbol{\lambda }}_{{\mathbf{x}}}^{0} = 0,} \end{array} \\ \frac{{\partial l}}{{\partial {{L}_{f}}}} = {{\lambda }_{L}} - \lambda _{L}^{f} - {{\left( {\frac{{d{{{\mathbf{x}}}_{f}}\left( {{{L}_{f}}} \right)}}{{d{{L}_{f}}}}} \right)}^{\operatorname{T} }}{\boldsymbol{\lambda }}_{{\mathbf{x}}}^{f} = 0. \\ \end{gathered} $$

These conditions imply the relations \({{p}_{{LK}}}\left( {{{K}_{0}}} \right) + H\left( {{{K}_{0}}} \right) = 0\), \({{p}_{{LK}}}\left( {{{K}_{f}}} \right) + H\left( {{{K}_{f}}} \right) = 0\), and

$$\begin{gathered} {{p}_{{LK}}}\left( {{{K}_{f}}} \right) + {{\left( {\frac{{d{{{\mathbf{x}}}_{f}}\left( {{{L}_{f}}} \right)}}{{d{{L}_{f}}}}} \right)}^{\operatorname{T} }}{{{\mathbf{p}}}_{{\mathbf{x}}}}\left( {{{K}_{f}}} \right) \\ - \,\,{{p}_{{LK}}}\left( {{{K}_{0}}} \right) - {{\left( {\frac{{d{{{\mathbf{x}}}_{0}}\left( {{{L}_{0}}} \right)}}{{d{{L}_{0}}}}} \right)}^{\operatorname{T} }}{{{\mathbf{p}}}_{{\mathbf{x}}}}\left( {{{K}_{0}}} \right) = 0 \\ \end{gathered} $$
(11)

The first two equations, similar to the case of a transfer with a fixed initial true longitude, are reduced to an additional boundary condition represented by the last equality in (9). Equation (11) for the case of Keplerian initial and final orbits is simplified to \({{p}_{{LK}}}\left( {{{K}_{f}}} \right) - {{p}_{{LK}}}\left( {{{K}_{0}}} \right) = 0\).

Thus, the problem of optimizing the transfer trajectory for a free L0 is reduced to a boundary-value problem for system of differential equations (8) with boundary conditions (9)–(11). Having set K0 = 0 without loss of generality, to solve this problem it is necessary to find eight components of vector px1(0), initial true longitude L0, and final auxiliary longitude Kf, at which condition (11) and nine boundary conditions of the following form are satisfied:

$$\begin{gathered} {{L}_{K}}\left( {{{K}_{f}}} \right) + {{K}_{f}} - {{L}_{0}} = \Delta L,\,\,\,{{p}_{{LK}}}\left( 0 \right) + H\left( 0 \right) = 0, \hfill \\ {\mathbf{x}}\left( {{{K}_{f}}} \right) = {{{\mathbf{x}}}_{f}}\left( {{{L}_{f}}} \right),\,\,\,{{p}_{m}}\left( {{{K}_{f}}} \right) = 0,{{p}_{t}}\left( {{{K}_{f}}} \right) = 0, \hfill \\ \end{gathered} $$
(12)

complementary to the initial conditions at K = 0:

$$\begin{gathered} {{L}_{K}}\left( 0 \right) = {{L}_{0}},\,\,\,{\mathbf{x}}\left( 0 \right) = {{{\mathbf{x}}}_{0}}\left( {{{L}_{0}}} \right), \\ m\left( 0 \right) = {{m}_{0}},\,\,\,t\left( 0 \right) = {{t}_{0}}. \\ \end{gathered} $$
(13)

3 METHOD FOR SOLVING THE OPTIMAL CONTROL PROBLEM USING COMPLEX DUAL NUMBERS

Let us consider the solution of boundary-value problem (8)–(10) using the continuation method by parameter in the form presented in [17, 21]. When using this method, it is necessary to find such vector of unknown parameters z = (\({\mathbf{p}}_{{{\mathbf{x}}1}}^{{\text{T}}}\)(0), Kf)T at which the residual vector becomes zero:

$$\begin{gathered} {\mathbf{f}} = \left( {{{p}_{{LK}}}\left( 0 \right) + H\left( 0 \right),{{L}_{K}}\left( {{{K}_{f}}} \right) + {{K}_{f}} - {{L}_{f}},} \right. \\ {{\left. {{{{\left( {{\mathbf{x}}\left( {{{K}_{f}}} \right) - {{{\mathbf{x}}}_{f}}\left( {{{L}_{f}}} \right)} \right)}}^{\operatorname{T} }},{{p}_{m}}\left( {{{K}_{f}}} \right),{{p}_{t}}\left( {{{K}_{f}}} \right)} \right)}^{\operatorname{T} }}. \\ \end{gathered} $$

To solve the problem under consideration, in addition to calculating residual vector f in the boundary conditions by integrating system (8), it is necessary to calculate the partial derivatives of the residual vector with respect to continuation parameter τ and unknown parameters of the boundary-value problem z, which include the initial values of costate variables px10 = px1(0). To calculate these partial derivatives, it is required to calculate the derivatives of the state and costate variables with respect to τ and px10 at the right end of the trajectory. It is convenient to calculate such derivatives by joint integration of differential equations (8) with differential equations for ∂x1/∂τ, ∂px1/∂τ, ∂x1/∂px10, and ∂px1/∂px10:

$$\begin{gathered} \frac{{d{{{\mathbf{x}}}_{1}}}}{{dK}} = \frac{{\partial H}}{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}1}}}}},\,\,\,\frac{{d{{{\mathbf{p}}}_{{{\mathbf{x}}1}}}}}{{dK}} = - \frac{{\partial H}}{{\partial {{{\mathbf{x}}}_{1}}}}, \\ \frac{d}{{dK}}\frac{{\partial {{{\mathbf{x}}}_{1}}}}{{\partial \tau }} = \frac{{{{\partial }^{2}}H}}{{\partial \tau \partial {{{\mathbf{p}}}_{{{\mathbf{x}}1}}}}},\,\,\,\frac{d}{{dK}}\frac{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}1}}}}}{{\partial \tau }} = - \frac{{{{\partial }^{2}}H}}{{\partial \tau \partial {{{\mathbf{x}}}_{1}}}}, \\ \frac{d}{{dK}}\frac{{\partial {{{\mathbf{x}}}_{1}}}}{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}10}}}}} = \frac{{{{\partial }^{2}}H}}{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}10}}}\partial {{{\mathbf{p}}}_{{{\mathbf{x}}1}}}}},\,\,\,\frac{d}{{dK}}\frac{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}1}}}}}{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}10}}}}} = - \frac{{{{\partial }^{2}}H}}{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}10}}}\partial {{{\mathbf{x}}}_{1}}}}, \\ \end{gathered} $$
(14)

in which case initial conditions (9) are supplemented by the obvious relations

$$\frac{{\partial {{{\mathbf{x}}}_{1}}}}{{\partial \tau }} = \frac{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}1}}}}}{{\partial \tau }} = \frac{{\partial {{{\mathbf{x}}}_{1}}}}{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}10}}}}} = 0,\,\,\,\frac{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}1}}}}}{{\partial {{{\mathbf{p}}}_{{{\mathbf{x}}10}}}}} = {\mathbf{E}}$$
(15)

for K = 0, where E is the unit matrix.

In accordance with (5), Hamiltonian H of the perturbed problem can be represented as H = HT + Hp + Ht. Partial derivatives ∂H/∂px1, ∂HT/∂x1, and ∂Ht/∂x1 are easily expressed in the explicit form; thus, the mixed second derivatives ∂2H/∂τ∂px1, ∂2H/∂px10px1, ∂2HT/∂τ∂x1, ∂2HT/∂px10x1, ∂2Ht/∂τ∂x1, and ∂2Ht/∂px10x1, which are necessary for calculating the right-hand parts of system (14), can be easily calculated with a high accuracy using the complex step differentiation [2225] under condition of calculating the first derivatives ∂H/∂px1, ∂HT/∂x1, and ∂Ht/∂x1 in the complex domain using small increments in the imaginary parts of the complex representation of τ and elements of vector px10. The problem of accurately calculating derivatives ∂Hp/∂x1, ∂2Hp/∂τ∂x1, and ∂2Hp/∂px10x1 appears to be significantly more complicated. Indeed, term Hp in the Hamiltonian depends on the perturbing accelerations. The components of the perturbing accelerations depend on x1 and are calculated using complicated algorithms that, in the general case, do not allow one to present an accurate analytical estimate of their derivatives with respect to the components of the state vector. Of course, it is possible to compute with these algorithms using complex or dual numbers to calculate ∂Hp/∂x1 by the complex step differentiation [22–25] or automatic differentiation using the algebra of dual numbers [26, 29]; however, to calculate the required second derivatives ∂Hp/∂τ∂x1 and ∂2Hp/∂px10x1, one will need to use a less accurate and less robust method, for example, the finite difference method. Alternatively, in a number of studies for the accurate calculation of the second derivatives of real functions, it is proposed to use multicomplex [12] or hyperdual [13, 28] numbers. The main disadvantage of methods using multicomplex or hyperdual numbers is the large computational cost, in particular, due to the associated calculation of the second derivatives of the form ∂2Hp/∂τ2, ∂2Hp/∂\({\mathbf{x}}_{1}^{2}\), and ∂2Hp/∂\({\mathbf{p}}_{{{{{\mathbf{x}}}_{{10}}}}}^{2}\) that are not used in the problem under consideration. To implement a high-accuracy calculation of only the required second-order derivatives of the real function Hp, we propose to use complex dual numbers [14, 15].

Since the calculation of derivatives using complex dual numbers is actually a combination of differentiation methods using complex and dual numbers, we present the basic relations for numerical differentiation using the complex step differentiation [2225] and automatic differentiation with dual numbers [26, 27].

The complex step differentiation was discovered in 1967 [22, 23], forgotten, and rediscovered in 1998 [24], and since then it has been used in many applications, for example, [1, 17]. This method is designed to calculate the derivatives of differentiable real functions of a real argument. Obviously, for \(x,h \in \mathbb{R},f\left( \cdot \right):\mathbb{R} \to \mathbb{R}\), we can expand the function f in a Taylor series using a small increment in the imaginary part of the argument, as a result of which we obtain an approximate expression for its derivative:

$$\begin{gathered} f\left( {x + ih} \right) = f\left( x \right) + ih\frac{{df\left( x \right)}}{{dx}} - \frac{1}{2}{{h}^{2}}\frac{{{{d}^{2}}f\left( x \right)}}{{d{{x}^{2}}}} + O\left( {{{h}^{3}}} \right) \\ \Rightarrow \operatorname{Im} \left[ {f\left( {x + ih} \right)} \right] = h\frac{{df\left( x \right)}}{{dx}} + O\left( {{{h}^{3}}} \right) \\ \Rightarrow \frac{{df\left( x \right)}}{{dx}} = \frac{{\operatorname{Im} \left[ {f\left( {x + ih} \right)} \right]}}{h} + O\left( {{{h}^{2}}} \right). \\ \end{gathered} $$

Unlike the finite difference method, the numerator in the last formula does not contain the difference of the functions at close values of the argument; therefore, the differentiation step can be chosen to be sufficiently small to ensure the accuracy of calculating the derivative of the same order as the accuracy of calculating the function.

There is also a well-known method of automatic differentiation based on the Clifford algebra, more precisely, on the use of dual numbers [26]. Let us consider

$$\begin{gathered} z = x + \varepsilon h,\,\,\,{{\varepsilon }^{2}} = 0,\,\,\,x,h \in \mathbb{R},f\left( \cdot \right):\mathbb{R} \to \mathbb{R}, \\ {\text{R}}P\left( z \right) \triangleq x,\,\,\,\operatorname{DP} \left( z \right) \triangleq h. \\ \end{gathered} $$

Expanding f in a Taylor series using the increment in the dual part of the argument, we obtain the exact expression for the derivative of this function:

$$\begin{gathered} f\left( {x + \varepsilon h} \right) = f\left( x \right) + \varepsilon h\frac{{df\left( x \right)}}{{dx}} \\ \Rightarrow \frac{{df\left( x \right)}}{{dx}} = \frac{{\operatorname{DP} \left[ {f\left( {x + \varepsilon h} \right)} \right]}}{h}{\text{ }} \\ {\text{or }}\frac{{df\left( x \right)}}{{dx}} = \operatorname{DP} \left[ {f\left( {x + \varepsilon } \right)} \right]. \\ \end{gathered} $$

The notation DP(⋅) is used here for the operation of isolating the dual part of a number: DP(x + εh) = h.

This method makes it possible to slightly reduce the computational costs in comparison with the complex step differentiation, especially when using dual numbers with a vector dual part [26]. For example, using dual numbers with a two-dimensional vector dual part, one can calculate both partial derivatives of a real function of two variables using single calculation of this function in the dual domain:

$$\begin{gathered} x = {{x}_{0}} + {{\varepsilon }_{1}}{{x}_{1}} + {{\varepsilon }_{2}}{{x}_{2}},\,\,\,y = {{y}_{0}} + {{\varepsilon }_{1}}{{y}_{1}} + {{\varepsilon }_{2}}{{y}_{2}}, \\ \varepsilon _{1}^{2} = \varepsilon _{2}^{2} = {{\varepsilon }_{1}}{{\varepsilon }_{2}} = 0,\,\,\,\,{{x}_{i}},{{y}_{i}} \in R,\,\,\,\,i = 0 \ldots 2, \\ \operatorname{RP} \left( x \right) \triangleq {{x}_{0}},\,\,\,\,{{\operatorname{DP} }_{i}}\left( x \right) \triangleq {{x}_{i}}, \\ z = f(x,y):{\text{ }}z = {{z}_{0}} + {{\varepsilon }_{1}}{{z}_{1}} + {{\varepsilon }_{2}}{{z}_{2}} \\ = f\left( {{{x}_{0}} + {{\varepsilon }_{1}} \cdot 1 + {{\varepsilon }_{2}} \cdot 0,{{y}_{0}} + {{\varepsilon }_{1}} \cdot 0 + {{\varepsilon }_{2}} \cdot 1} \right) \\ = f({{x}_{0}},{{y}_{0}}) + {{\varepsilon }_{1}}\frac{{\partial f({{x}_{0}},{{y}_{0}})}}{{\partial {{x}_{0}}}} + {{\varepsilon }_{2}}\frac{{\partial f({{x}_{0}},{{y}_{0}})}}{{\partial {{y}_{0}}}} \\ \Rightarrow \frac{{\partial f(x,y)}}{{\partial x}} = {{\operatorname{DP} }_{1}}\left[ {f\left( {x + {{\varepsilon }_{1}},y + {{\varepsilon }_{2}}} \right)} \right], \\ \frac{{\partial f(x,y)}}{{\partial y}} = {{\operatorname{DP} }_{2}}\left[ {f\left( {x + {{\varepsilon }_{1}},y + {{\varepsilon }_{2}}} \right)} \right]. \\ \end{gathered} $$

Here, we use the notation DPi(⋅) for the operation of isolating the ith dual part of the number and RP(⋅) for isolating the real part of the number.

In the general case, both methods are approximately equally good for high-precision computation of the first derivatives. However, none of these methods can accurately calculate the second derivatives. We propose to use complex dual numbers to calculate the second derivatives [14, 15]. Complex dual numbers are dual numbers with complex coefficients:

$$\begin{gathered} z = x + \varepsilon x{\kern 1pt} ',\,\,\,\,{{\varepsilon }^{2}} = 0,\,\,\,\,x,x{\kern 1pt} ' \in \mathbb{C}, \\ \operatorname{CP} \left( z \right) \triangleq x,\,\,\,\operatorname{CDP} \left( z \right) \triangleq x{\kern 1pt} '. \\ \end{gathered} $$

The notation CDP(⋅) is used here for the operation of isolation of the complex dual part of the number, while CP(⋅) is used for the isolation of the complex part of the number.

To calculate the mixed second derivative of a real function f with respect to x and y, one can supplement x with the unit dual part (x = x0 + ε) and y with the small imaginary part (y = y0 + ih, h ⪡ 1), where x0, y0, and h are real numbers. The analysis of the expansion of this function f in a Taylor series in the vicinity of the point (x0, y0) allows us to show that the calculation of the complex-dual representation of the function leads to a simple expression for the mixed second derivative:

$$\begin{gathered} f\left( {x,y} \right) = f\left( {{{x}_{0}},{{y}_{0}}} \right) + ih\frac{{\partial f\left( {{{x}_{0}},{{y}_{0}}} \right)}}{{\partial {{y}_{0}}}} - \frac{1}{2}{{h}^{2}}\frac{{{{\partial }^{2}}f\left( {{{x}_{0}},{{y}_{0}}} \right)}}{{\partial y_{0}^{2}}} \\ + \,\,\varepsilon \left\{ {\frac{\partial }{{\partial {{x}_{0}}}}\left[ {f\left( {{{x}_{0}},{{y}_{0}}} \right) + } \right.} \right.ih\frac{{\partial f\left( {{{x}_{0}},{{y}_{0}}} \right)}}{{\partial {{y}_{0}}}} - \left. {\left. {\frac{1}{2}{{h}^{2}}\frac{{{{\partial }^{2}}f\left( {{{x}_{0}},{{y}_{0}}} \right)}}{{\partial y_{0}^{2}}}} \right]} \right\} \\ + \,\,O\left( {{{h}^{3}}} \right) \Rightarrow \frac{{\partial f\left( {{{x}_{0}},{{y}_{0}}} \right)}}{{\partial {{y}_{0}}}} = \frac{{\operatorname{Im} \left\{ {\operatorname{CP} \left[ {f\left( {x,y} \right)} \right]} \right\}}}{h} + O\left( {{{h}^{2}}} \right), \\ \frac{{\partial f\left( {{{x}_{0}},{{y}_{0}}} \right)}}{{\partial {{x}_{0}}}} = \operatorname{Re} \left\{ {\operatorname{CDP} \left[ {f\left( {x,y} \right)} \right]} \right\} + O\left( {{{h}^{2}}} \right), \\ \frac{{{{\partial }^{2}}f\left( {{{x}_{0}},{{y}_{0}}} \right)}}{{\partial {{x}_{0}}\partial {{y}_{0}}}} = \frac{{\operatorname{Im} \left\{ {\operatorname{CDP} \left[ {f\left( {x,y} \right)} \right]} \right\}}}{h} + O\left( {{{h}^{2}}} \right). \\ \end{gathered} $$

In the general case, the data structure considered below, which represents complex dual number X with a vector dual part, contains a scalar value of complex part x and an array of n numbers \(x_{i}^{'}\) representing the complex-dual part:

$$X\, = \,x\, + \,\sum\limits_{i = 1}^n {x_{i}^{'}} {{\varepsilon }_{i}},\,\,\,{\text{where}}\,\,x,x_{i}^{'} \in \mathbb{C},\,\,\,\,\varepsilon _{i}^{2} = {{\varepsilon }_{i}}{{\varepsilon }_{j}} = 0\forall i,j.$$

The assignment operation X = U, \(U = u + \sum\nolimits_{i = 1}^n {{{u}_{i}}} {{\varepsilon }_{i}}\) is equivalent to assigning the corresponding values to the complex and complex-dual parts: x = u, \(x_{i}^{'}\) = \(u_{i}^{'}\), i = 1–n. If U is a complex or real number, the complex-dual part of X is assigned a zero value. In the general case, complex numbers are viewed as complex dual numbers with a zero complex-dual part, just as real numbers can be viewed as complex numbers with a zero imaginary part.

The operation of isolating the complex part of a complex dual number is

CP(Х) = x,

and the operation of isolating the ith complex-dual part is

CDPi(X) = \(x_{i}^{'}\).

The comparison operations (>, <, =, ≥, ≤) are performed using only real parts from the complex parts of complex dual numbers:

X ~ U if Re(x) ~ Re(u) (~ is one of the comparison operations: >, <, =, ≠, ≥ or ≤).

Arithmetic operations on complex dual numbers are defined as follows: \(X \pm U = x \pm u + \sum {\left( {x_{i}^{'} \pm u_{i}^{'}} \right)} {{d}_{i}}\), \( - X\, = - x\, - \,\sum\nolimits_{i = 1}^n {x_{i}^{'}} {{d}_{i}}\), \(XU = xu + \sum\nolimits_{i = 1}^n {\left( {x_{i}^{'}{{u}_{i}} + {{x}_{i}}u_{i}^{'}} \right){{d}_{i}}} \), \(X{\text{/}}U = \frac{{xu}}{{{{u}^{2}}}} + \sum\nolimits_{i = 1}^n {\frac{{x_{i}^{'}{{u}_{i}} - {{x}_{i}}u_{i}^{'}}}{{{{{\left( {u_{i}^{'}} \right)}}^{2}}}}{{d}_{i}}} \). Complex dual representation of elementary functions φ(X) has the form \(\varphi \left( X \right) = \varphi \left( x \right) + \sum\nolimits_{i = 1}^n {x_{i}^{'}{{\varepsilon }_{i}}{{d\varphi \left( x \right)} \mathord{\left/ {\vphantom {{d\varphi \left( x \right)} {dx}}} \right. \kern-0em} {dx}}} \).

If we consider a scalar real function f(x, y) with a real vector argument x and a scalar argument y, its value, the first and second mixed partial derivatives can be calculated using single calculation of the function in the complex dual domain f(x + ε, y + ih) using the following expressions:

$$\begin{gathered} f\left( {{\mathbf{x}},y} \right) = \operatorname{Re} \left\{ {\operatorname{CP} \left[ {f\left( {{\mathbf{x}} + {\boldsymbol{\varepsilon }},y + ih} \right)} \right]} \right\} + O\left( {{{h}^{2}}} \right), \\ \frac{{\partial f\left( {{\mathbf{x}},y} \right)}}{{\partial y}} = \frac{1}{h}\operatorname{Im} \left\{ {\operatorname{CP} \left[ {f\left( {{\mathbf{x}} + {\boldsymbol{\varepsilon }},y + ih} \right)} \right]} \right\} + O\left( {{{h}^{2}}} \right), \\ \frac{{\partial f\left( {{\mathbf{x}},y} \right)}}{{\partial {\mathbf{x}}}} = \operatorname{Re} \left\{ {{\mathbf{CDP}}\left[ {f\left( {{\mathbf{x}} + {\boldsymbol{\varepsilon }},y + ih} \right)} \right]} \right\} + O\left( {{{h}^{2}}} \right), \\ \frac{{{{\partial }^{2}}f\left( {{\mathbf{x}},y} \right)}}{{\partial {\mathbf{x}}\partial y}} = \frac{1}{h}\operatorname{Im} \left\{ {{\mathbf{CDP}}\left[ {f\left( {{\mathbf{x}} + {\boldsymbol{\varepsilon }},y + ih} \right)} \right]} \right\} + O\left( {{{h}^{2}}} \right), \\ \end{gathered} $$

where \({\boldsymbol{\varepsilon }}\, = \,\left( {\begin{array}{*{20}{c}} {{{\varepsilon }_{1}}} \\ \vdots \\ {{{\varepsilon }_{n}}} \end{array}} \right),{\mathbf{CDP}}\left( \cdot \right)\, = \,\left( {\begin{array}{*{20}{c}} {{{{\operatorname{CDP} }}_{1}}\left( \cdot \right)} \\ \vdots \\ {{{{\operatorname{CDP} }}_{n}}\left( \cdot \right)} \end{array}} \right),\dim {\mathbf{x}}\, = \,\dim {\boldsymbol{\varepsilon }}\, = \,n.\)

The following scheme is proposed for solving the problem of optimizing a perturbed trajectory with a finite thrust.

(1) The initial data are set, including the elements of the initial orbit \({{{\mathbf{x}}}_{0}} = {{\left( {{{p}_{0}},{{e}_{{x0}}},{{e}_{{y0}}},{{i}_{{x0}}},{{i}_{{y0}}}} \right)}^{\operatorname{T} }}\), initial true longitude L0, elements of the final orbit \({{{\mathbf{x}}}_{f}} = {{\left( {{{p}_{f}},{{e}_{{xf}}},{{e}_{{yf}}},{{i}_{{xf}}},{{i}_{{yf}}}} \right)}^{\operatorname{T} }}\), transfer angular distance ΔL (the final true longitude is determined by the relation Lf = L0 + ΔL), initial spacecraft mass m0, thrust T, and exhaust velocity c of the propulsion system.

(2) The continuation method is used to solve the boundary-value problem for optimizing the unperturbed trajectory of a spacecraft with an ideally controlled engine of limited power (LP trajectories, see [21, 30]). Zero values pp(0) = pex(0) = pey(0) = pix(0) = piy(0) = pLK(0) = 0 are used as an initial guess values for costate variables (which corresponds to spacecraft coasting along the initial orbit); the initial guess for the unknown final value of the auxiliary longitude is set equal to the transfer angular distance: Kf = ΔL.

(3) The continuation method is used to solve boundary-value problem of the maximum principle (8)–(10) to optimize a limited-thrust trajectory (LT trajectory). The values obtained during the optimization of the LP trajectory are used as an initial guess for the unknown initial values of the costate variables pp, pex, pey, pix, piy, and pLK and final auxiliary longitude Kf. The initial guess values for pm(0) and pt(0) are set equal to 0. To implement the homotopy between LP and CEV trajectories, the following system of differential equations is used:

$$\begin{gathered} \frac{{d{\mathbf{x}}}}{{dK}} = \frac{{\left( {1 - \tau } \right)k + \tau \delta \frac{T}{m}{{k}_{1}}{{k}_{2}}}}{{1 - \tau + \tau A}}\frac{{\partial {{{\mathbf{A}}}^{{\text{T}}}}}}{{\partial {\mathbf{p}}}}{\mathbf{A}} + \tau {{k}_{1}}{{k}_{2}}\frac{{\partial {{{\mathbf{A}}}^{{\text{T}}}}}}{{\partial {\mathbf{p}}}}{{{\mathbf{a}}}_{p}}, \\ \frac{{d{{L}_{K}}}}{{dK}} = \frac{{\left( {1 - \tau } \right)k + \tau \delta \frac{T}{m}{{k}_{1}}{{k}_{2}}}}{{1 - \tau + \tau A}}\frac{{\partial {{{\mathbf{A}}}^{{\text{T}}}}}}{{\partial {{p}_{{LK}}}}}{\mathbf{A}} + \tau {{k}_{1}}{{k}_{2}}\frac{{\partial {{{\mathbf{A}}}^{{\text{T}}}}}}{{\partial {{p}_{{LK}}}}}{{{\mathbf{a}}}_{p}},\,\,\,\frac{{dt}}{{dK}} = {{k}_{1}},\,\,\,\frac{{dm}}{{dK}} = - \tau \delta {{k}_{1}}\frac{T}{c}, \\ \frac{{d{\mathbf{p}}}}{{dK}} = - \frac{{\left( {1 - \tau } \right)\frac{\partial }{{\partial {\mathbf{x}}}}k{{A}^{2}} + \tau \delta T\left[ {\frac{{\partial {{k}_{1}}}}{{\partial {\mathbf{x}}}}SA + \frac{{{{k}_{1}}}}{m}\left( {\frac{{\partial {{k}_{2}}}}{{\partial {\mathbf{x}}}}{{A}^{2}} - {{k}_{2}}\frac{{\partial {{{\mathbf{A}}}^{{\text{T}}}}}}{{\partial {\mathbf{x}}}}{\mathbf{A}}} \right)} \right]}}{{1 - \tau + \tau A}} - \tau \frac{{\partial {{H}_{p}}}}{{\partial {\mathbf{x}}}}, \\ \frac{{d{{p}_{{LK}}}}}{{dK}} = - \frac{{\left( {1 - \tau } \right)\frac{\partial }{{\partial {\mathbf{x}}}}k{{A}^{2}} + \tau \delta T\left[ {\frac{{\partial {{k}_{1}}}}{{\partial {{L}_{K}}}}SA + \frac{{{{k}_{1}}}}{m}\left( {\frac{{\partial {{k}_{2}}}}{{\partial {{L}_{K}}}}{{A}^{2}} - {{k}_{2}}\frac{{\partial {{{\mathbf{A}}}^{{\text{T}}}}}}{{\partial {{L}_{K}}}}{\mathbf{A}}} \right)} \right]}}{{1 - \tau + \tau A}} - \tau \frac{{\partial {{H}_{p}}}}{{\partial {{L}_{K}}}}, \\ \frac{{d{{p}_{t}}}}{{dK}} = - \tau \frac{{\partial {{H}_{p}}}}{{\partial t}},\,\,\,\frac{{d{{p}_{m}}}}{{dK}} = \tau \delta T{{k}_{1}}{{k}_{2}}\frac{A}{{{{m}^{2}}}}, \\ \end{gathered} $$
(16)

where \(k = \frac{1}{{2{{q}^{4}}}}\sqrt {\frac{{{{p}^{5}}}}{{{{\mu }^{3}}}}} \).

This system at τ = 0 coincides with the system of differential equations for unperturbed transfer with an ideally controlled engine, and at τ = 1 it coincides with system (8). The choice of this type of differential equations ensures the time independence of the right-hand sides of system (8) at τ = 0, which allows using pt(K) ≡ 0.

The proposed method uses the simultaneous integration of the equations of motion (16) and partial derivatives of the state and costate vectors with respect to unknown parameters of the boundary-value problem z and continuation parameter τ (for further calculation of ∂f/∂z and ∂f/∂τ). For this purpose, the unperturbed right-hand sides of the differential equations for ∂x1/∂z, ∂px1/∂z, ∂x1/∂τ, and ∂px1/∂τ are calculated using the complex step differentiation. The required mixed derivatives of the form ∂2Hp/∂x1z and ∂2Hp/∂x1∂τ are calculated using automatic differentiation with respect to x1 in the complex-dual domain followed by the differentiation with respect to z or τ using the complex step differentiation. There is no necessity to include the derivatives of the state and costate vectors with respect to the final value of auxiliary longitude Kf in the integrated variables, since they are calculated after the integration of system (16) from K0 to Kf by one additional call of the function for calculating the right-hand sides of system (16).

Thus, the system of equations for eight state variables, eight costate variables. and their derivatives with respect to the initial values of eight costate variables and the continuation parameter τ is integrated simultaneously: 8 + 8 + (8 + 8)(8 + 1) = 160 equations in total. The indices of the variables used in the joint integration of the system of differential equations (16) and partial derivatives of the state and costate vectors with respect to the unknown parameters of the boundary-value problem and the continuation parameter are given in Table 1. This table uses the notation yi for the elements of the vector y = \({{\left( {{\mathbf{x}}_{1}^{{\text{T}}},{\mathbf{p}}_{{x1}}^{{\text{T}}}} \right)}^{{\text{T}}}}\).

Table 1.   The indices of the variables used in the joint integration of system of differential equations (16) and partial derivatives of the state and costate vectors with respect to the unknown parameters of the boundary-value problem and the continuation parameter

A scheme is given below for calculating the right-hand sides of the differential equations of the perturbed optimal motion, including the calculation of the second mixed derivatives of the perturbed part of the Hamiltonian with respect to the orbital elements and the initial values of the costate variables (we consider the case of taking into account perturbations from the geopotential harmonics up to given degree and order, as well as lunisolar perturbations).

1. Calculate the ephemeris data necessary for further computation of the perturbing accelerations (matrix M of transition from the geocentric inertial coordinate system ICRS to the geocentric equatorial rotating coordinate system ITRS [31] and its time derivative, vectors of position rpj and velocity vpj of the Moon (l = 1) and the Sun (l = 2) in the ICRS). To further calculate the required time derivatives, their complex-dual representation is used in the form Mc = M + ε7dM/dt, rpcl = rpl + ε7vpl, l = 1, 2.

2. Set j = 1.

3. If j < 9, then calculate the complex representation of vector y: yk = yk + ihdiffyk/∂zj, or otherwise calculate the complex representation of continuation parameter τ: τ =τ + ihdiff, where hdiff ⪡ 1 is the size of the differentiation step in the complex step differentiation, k = 1–16, j = 1–8.

4. The unperturbed terms of the right-hand sides of the differential equations for the state and costate variables are calculated in the complex representation using the complex representation of y (j < 9) or τ (j = 9). The smoothing of the step-like throttling function δ(S) is used in the form \(\delta \left( S \right) \approx {{\left( {1 + {S \mathord{\left/ {\vphantom {S {\sqrt {{{S}^{2}} + c{{\varepsilon }^{2}}\left( \tau \right)} }}} \right. \kern-0em} {\sqrt {{{S}^{2}} + c{{\varepsilon }^{2}}\left( \tau \right)} }}} \right)} \mathord{\left/ {\vphantom {{\left( {1 + {S \mathord{\left/ {\vphantom {S {\sqrt {{{S}^{2}} + c{{\varepsilon }^{2}}\left( \tau \right)} }}} \right. \kern-0em} {\sqrt {{{S}^{2}} + c{{\varepsilon }^{2}}\left( \tau \right)} }}} \right)} 2}} \right. \kern-0em} 2}\), where \(c = 2\left( {\sqrt 2 + 1} \right) \approx 4.828427\) and ε(τ) is a positive regularizing term that regulates the degree of closeness of the approximation to the step-like throttling function: the smaller ε, the closer the approximation is to the step function. The ε value itself is a linear function of the continuation parameter τ: at the beginning of the continuation, at τ = 0, ε is rather large; as a result, the dδ/dS value remains sufficiently small in the vicinity of S = 0. At the end of the continuation, at τ = 1, ε becomes sufficiently small for an acceptable approximation of the throttling step-like function of thrust. In this study, we used the dependence ε(τ) = 1 – τ + εfτ, where εf = 10–4–10–5.

5. Copies of the state variables in a complex-dual representation with a unit vector dual part are created: p + ε1, ex + ε2, ey + ε3, ix + ε4, iy + ε5, LK + ε6, t + ε7, and m + ε8.

6. State coordinates r, v are calculated from those copies using the complex-dual algebra.

7. The complex-dual representation of the basis vectors of the local-vertical-local-horizontal (LVLH) reference frame in ICRS is calculated.

8. The complex-dual representation of the perturbing accelerations in ICRS is calculated using the real representations of the planetary positions and the transformation matrix between ITRS and ICRS if j ≠ 7; and otherwise, their complex-dual representations are used.

9. The complex-dual representation of the perturbing accelerations in the LVLH reference frame is calculated.

10. The perturbed part of Hamiltonian Hp is calculated in the complex-dual representation.

11. The derivatives of Hp with respect to the state variables (terms of the right-hand sides of differential equations for costate variables) are calculated. In this case, the complex representation of the derivative of Hp with respect to the kth state variable turns out to be equal to the kth complex-dual part of the complex-dual representation of Hp.

12. Right-hand sides g of the perturbed system (16) are calculated in the complex representation.

13. The derivatives of the right-hand sides of the differential equations with respect to the initial values of the costate variables are calculated using the complex step method: ∂g/∂zj = Im(g)/hdiff (j < 9) or ∂g/∂τ = Im(g)/hdiff (j = 9). As a result, the right-hand sides of the differential equations are calculated for ∂yk/∂zj (j < 9) or ∂yk/∂τ (j = 9).

14. If necessary, Hamiltonian H (5) is calculated in the complex representation. If j < 9, the derivatives ∂H/∂zj = Im(H)/hdiff are calculated by the complex step differentiation; otherwise, the derivatives ∂H/∂τ = Im(H)/hdiff, ∂H/∂K = ∂H/∂LK and the real representation of the Hamiltonian H = Re(H) are calculated by the complex step differentiation.

15. If j = 9, then go to step 16; else, set j = j +1 and go to step 3.

16. The right-hand sides of the differential equations for y are calculated in the real representation: dy/dK = Re(g).

17. Return to the calling program.

Matrix M of transition from ICRS to ITRS and its derivative are calculated using the SOFA library of the International Astronomical Union [31], and the position and velocity vectors of the Moon and the Sun are calculated using the JPL ephemeris software [32].

The input parameters for calculating the right-hand sides of the differential system for vector y and its derivatives are the current value of auxiliary longitude K, the current value of vector y and its derivatives ∂y/∂zj (j = 1–8), ∂y/∂τ set by a real array in the order specified by Table 1. The output parameters are the right-hand sides of system of differential equations (16)g and their derivatives ∂g/∂zj (j = 1–8), ∂g/∂τ represented as a real array in the same order.

The vector of residuals of the boundary-value problem f, matrix ∂f/∂z, and vector ∂f/∂τ necessary for calculating the right-hand sides of the differential equations of the continuation method [15, 17, 21, 30] are calculated after integrating the differential equations for y, ∂y/∂zj (j = 1–8), and ∂y/∂τ. To calculate them, it is necessary to specify the current continuation parameter τ and the current values of the vector of unknown parameters of the boundary-value problem z. All the input and output parameters are real type variables. To calculate the right-hand sides of the system of differential equations of the continuation method, it is first needed to determine the initial conditions for integrating system of differential equations (16) for y extended by the equations for the derivatives ∂y/∂zj (j = 1–8), ∂y/∂τ:

y1 = p0, y2 = ex0, y3 = ey0, y4 = ix0, y5 = iy0, y6 = LK0 = L0, y7 = t0 = 0, y8 = m0,

y9 = z1 = pp0, y10 = z2 = pex0, y11z3 = pey0, y12 = z4 = pix0, y13 = z5 = piy0,

y14 = z6 = pLK0, y15 = z7 = pt0, y16 = z8 = pm0,

y17i+8 = ∂yi+8/∂zi = 1, i = 1–8,

and the remaining the array values (corresponding to the initial values of the derivatives ∂yi+8/∂zj, ij) are set to zero.

The initial auxiliary longitude is set to zero: K0 = 0. The final auxiliary longitude is equal to the current value of the final auxiliary longitude: Kf = z9.

After setting the initial conditions, the boundaries of the integration interval of K0, Kf and the settings of the integration method, the Hamiltonian and its derivatives are calculated at the initial point of the trajectory, the residual determined by the last equation (9) is calculated. Next, we numerically integrate the joint system of differential equations (16) and equations for the required partial derivatives using the previously described scheme for calculating the right-hand sides of the differential equations of the perturbed optimal motion, fill in the arrays representing the vector of residuals of the boundary value problem f, matrix ∂f/∂z, and vector ∂f/∂τ using the results of numerical integration and use them to calculate the right-hand sides of the differential equations of the continuation method [15]. The system of differential equations of the continuation method is numerically integrated over the continuation parameter τ from 0 to 1. For numerical integration, the Gragg–Bulirsch–Stoer method with an adaptive step and order is used [33]. After each successful step of numerical integration, the accumulated computational error is corrected using a limited number of iterations of Newton’s method for the equation f = (1 – τ)b. After successful completion of the numerical integration over τ, the vector of unknown parameters of the boundary-value problem z (the state vector of the system of differential equations of continuation) contains the desired solution to the problem of optimizing the perturbed trajectory.

CONCLUSIONS

Theoretical foundations and a method for optimizing perturbed finite-thrust trajectories using complex dual numbers are presented. The problem of optimization of a transfer with a fixed angular distance and free duration is considered. In such a setting, judging by the available computational experience, there is only one value of the transfer duration that satisfies the necessary optimality conditions within one family of optimal solutions (for example, C- or E-trajectories). This allows avoiding some of the computational difficulties associated with the existence of multiple locally optimal values of the transfer angular distance in a more traditional formulation of the trajectory optimization problem, in which the transfer duration is fixed and the angular distance is taken as free [18, 20, 21, 30]. To simplify the formulation of the problem, an auxiliary longitude is used as an independent variable instead of time [21, 30]. A complete system of necessary optimality conditions for variants with a fixed and free value of the initial true longitude of the spacecraft is presented.

One difficulty in optimizing perturbed trajectories using the maximum principle is the need to accurately calculate the derivatives of perturbing accelerations with respect to state coordinates. In high-precision models of motion, the perturbing accelerations are calculated using complicated algorithms; therefore, it is practically impossible to represent expressions for their derivatives in a closed form. The situation is complicated by the fact that in order to solve the maximum-principle boundary-value problem, it is necessary to calculate the derivatives of the residuals of the boundary-value problem with respect to the initial values of the costate variables. These residuals depend on the final values of the state variables and costate variables, which, in turn, depend on the derivatives of the perturbing accelerations with respect to the state vector through the differential equations of optimal motion. Thus, in fact, to calculate the derivatives of the residuals with respect to the initial values of the costate variables, it is required to calculate the second-order mixed derivatives of the perturbing accelerations with respect to the state vector and initial values of costate variables. To solve the problem of calculating those second derivatives with high accuracy, in this study we develop a method based on the use of complex-dual numbers, which was previously proposed in [15]. The proposed method makes it possible to automate the preparation of the mathematical model necessary to optimize the perturbed trajectory when using the maximum principle and the continuation method, by automating the calculation of the derivatives of the perturbing accelerations with respect to the state vector using complex dual numbers, followed by the calculation of the required derivatives of the residual vector of the boundary value problem using the complex step differentiation. To overcome the computational instability associated with the presence of corner points in the dependence of the residuals of the boundary-value problem on its unknown parameters with simultaneous vanishing of the switching function and its time derivative, smoothing of the thrust step function is used. The proposed method was implemented in the form of experimental software, on which a series of numerical experiments were carried out. The numerical results obtained using the developed method are presented in the second part of the paper.