# Three-Dimensional Guidance Laws for Spacecraft Propelled by a SWIFT Propulsion System
## 3 Optimal Guidance Laws
### Spacecraft Dynamics in Terms of Classical Orbital Elements  
In this last part of Section 3, we analyze the optimal control law in the typical case in which the spacecraft dynamics are studied by using the classical orbital elements. The latter set, in fact, describes the characteristics of the spacecraft osculating orbit during the interplanetary transfer in terms of the semimajor axis \(a\), eccentricity \(e\), inclination \(i\) with respect to the ecliptic plane, longitude of the ascending node \(\Omega\), argument of perihelion \(\omega\), and true anomaly \(\
u\), which gives the spacecraft its angular position with respect to the osculating orbit apse line. Paralleling the procedure described in the previous section, we begin the discussion of the optimal control law by writing the time derivative of the spacecraft state variables \(\{a,e,i,\Omega,\omega,\
u\}\). In this context, according to Ref. [41] (see Equation (10.41) at p. 488 of [41]), one has  
\[\dot{a} =\frac{2\,a^{2}}{h}\Big{(}e\,a_{\rm R}\,\sin\
u+\frac{p}{r}\,a_{ \rm T}\Big{)} \tag{42}\] \[\dot{e} =\frac{1}{h}\{p\,a_{\rm R}\,\sin\
u+\big{[}(p+r)\cos\
u+r\,e\big{]} \,a_{\rm T}\}\] (43) \[\dot{i} =\frac{r\,\cos(\omega+\
u)}{h}\,a_{\rm N}\] (44) \[\dot{\Omega} =\frac{r\,\sin(\omega+\
u)}{h\,\sin i}\,a_{\rm N}\] (45) \[\dot{\omega} =\frac{1}{h\,e}\big{[}-p\,a_{\rm R}\,\cos\
u+(p+r)a_{\rm T}\,\sin \
u\big{]}-\frac{r\,\sin(\omega+\
u)\,\cos i}{h\,\sin i}\,a_{\rm N}\] (46) \[\dot{\
u} =\frac{h}{r^{2}}+\frac{1}{e\,h}\big{[}p\,a_{\rm R}\,\cos\
u-(p+ r)\,a_{\rm T}\,\sin\
u\big{]} \tag{47}\]  
where \(\{a_{\rm R},a_{\rm T},a_{\rm N}\}\) are the components of \(\boldsymbol{a}\) in the RTN reference frame, \(h=\sqrt{\mu_{\odot}\,p}\) is the magnitude of the angular momentum vector with \(p=a\,(1-e^{2})\), while the radial distance \(r\) can be expressed through the usual (polar) equation as \(r=p/(1+e\,\cos\
u)\). The time derivatives of \(\{a,e,i,\Omega,\omega,\
u\}\) given by Equations (42)-(47) are rewritten, in a more convenient compact form, as  
\[\big{[}\dot{a},\,\dot{e},\,\dot{i},\,\Omega,\,\dot{\omega},\,\dot{\
u}\big{]}^ {\rm T}=\mathbb{N}\,\boldsymbol{a}+\bigg{[}0,\,0,\,0,\,0,\,\frac{h}{r^{2}} \bigg{]}^{\rm T} \tag{48}\]  
where \(\mathbb{N}\in\mathbb{R}^{6\times 3}\) is a matrix defined as  
\[\mathbb{N}=\left[ \begin{array}{ccc}\frac{2\,a^{2}\,e\,\sin\
u}{h}&\frac{2\, a^{2}\,p}{r\,h}&0\\ \frac{p\,\sin\
u}{h}&\frac{(p+r)\cos\
u+r\,e}{h}&0\\ 0&0&\frac{r\,\cos(\omega+\
u)}{h}\\ 0&0&\frac{r\,\sin(\omega+\
u)}{h\,\sin i}\\ \frac{-p\,\cos\
u}{h\,e}&\frac{(p+r)\sin\
u}{h\,e}&-\frac{r\,\sin(\omega+\
u) \,\cos i}{h\,\sin i}\\ \frac{p\,\cos\
u}{e\,h}&\frac{-(p+r)\sin\
u}{e\,h}&0\end{array} \right] \tag{49}\]  
Introducing the adjoint variables \(\{\lambda_{a},\lambda_{e},\lambda_{i},\lambda_{\Omega},\lambda_{\omega}, \lambda_{\
u}\}\in\mathbb{R}\), the scalar Hamiltonian function in this case is written as  
\[\mathcal{H}=[\lambda_{a},\,\lambda_{e},\,\lambda_{i},\,\lambda_{\Omega},\, \lambda_{\omega},\,\lambda_{\
u}]\,(\mathbb{N}\,\boldsymbol{a})+\frac{\lambda _{\
u}\,h}{r^{2}} \tag{50}\]so that the Euler-Lagrange equations are  
\[\lambda_{a}=-\frac{\partial\mathcal{H}}{\partial a}\,\ \dot{\lambda}_{e}=-\frac{ \partial\mathcal{H}}{\partial e}\,\ \dot{\lambda}_{i}=-\frac{\partial\mathcal{H}}{\partial i}\,\ \dot{\lambda}_{\Omega}=-\frac{ \partial\mathcal{H}}{\partial\Omega}\,\ \dot{\lambda}_{\omega}=-\frac{\partial\mathcal{H}}{ \partial\omega}\,\ \dot{\lambda}_{\
u}=-\frac{\partial\mathcal{H}}{\partial\
u} \tag{51}\]  
Therefore, as discussed in the previous section, one can define an auxiliary vector \(\boldsymbol{\lambda}_{o}\in\mathbb{R}^{3}\) as  
\[\boldsymbol{\lambda}_{o}\triangleq\mathbb{N}^{r} \begin{bmatrix}\lambda_{a}\\ \lambda_{e}\\ \lambda_{i}\\ \lambda_{o}\\ \lambda_{\Omega}\\ \lambda_{v}\end{bmatrix} \equiv