


\newpage

%------------------------------------------------------------------------
%       PART 1 : DEFINITIONS AND MATHEMATICAL FORMULAS
%-----------------------------------------------------------------------

\part{DEFINITIONS AND MATHEMATICAL FORMULAS}
\label{part:definitions and mathematical formulas}

%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%------------------------------------------------------------------------
\chapter{DESCRIPTION OF COORDINATE SYSTEMS}
\label{chapter:description of coordinate systems}

Most of the coordinate systems described are geocentric, with any exceptions as the dipole meridian system and the VDH system, 
which are local coordinate systems and thus depend of the position of the point of observation. 

%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Geocentric Equatorial Inertial system (GEI) 
%------------------------------------------------------------------------
\section{Geocentric Equatorial Inertial System (GEI)}
\label{sect:geocentric equatorail system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_GEI}
\includegraphics[width=9 cm,height=6. cm]{./FIGURES/Coordinate_system_GEI.eps}
\caption{GEI system definition }
\end{center}
\end{figure}

The Z-axis is parallel to the rotation axis of the Earth.\\
The X-axis is defined by the intersection of the equator plane and the ecliptic plane, and is pointing towards the first point of Aries
(Sun position at the vernal equinox).
\\

one can define the \emph{right ascension} $\alpha$  and the \emph{declination}  $\theta$ as:
\\

\emph{right ascension} $\alpha = \tan^{-1} (V_Y/V_X)$

\begin{displaymath}
  \begin{array}{rrrr}
   \textrm{with} & \alpha \textrm{~in } &[ ~~~0^\circ, & 180^\circ ~] \textrm{~~~for } V_Y>0\\
     & \alpha \textrm{ in } &[ 180^\circ, & 360^\circ ~] \textrm{~~~for } V_Y<0\\
  \end{array}  
\end{displaymath}

\emph{declination}\hspace{0.5 cm} $ \theta = \sin^{-1} (V_Z/V)$

\begin{displaymath}
  \begin{array}{rrrr}
    \hspace{-1.3 cm}\textrm{with} & \theta \textrm{~in} &[~-90^\circ,&+90^\circ ~] \\
  \end{array}
\end{displaymath}  

\pagebreak

%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Geographic system (GEO)
%------------------------------------------------------------------------
\section{Geographic System (GEO)}
\label{sect:geographic system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_GEO}
\includegraphics[height=6.0 cm, width=8. cm]{./FIGURES/Coordinate_system_GEO.eps}
\caption{GEO system definition }
\end{center}
\end{figure}


The Z-axis is parallel to the rotation axis of the Earth.\\
The X and Y axis are included in the equator plane.\\
The X axis is pointing from the centre of the Earth to the Greenwich meridian ($0^\circ$ longitude).

\bigskip
The GEO system is fixed with the rotating Earth. Longitude L and latitude $\lambda$ are defined in this system 
in the same way as right ascension and declination in GEI system.

%------------------------------------------------------------------------
%		CHAPTER: DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION: Geomagnetic system (MAG)
%------------------------------------------------------------------------
\section{Geomagnetic system (MAG)}
\label{sect:geomagnetic system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_MAG}
\includegraphics[height=5.0 cm, width=9. cm]{./FIGURES/Coordinate_system_MAG.eps}
\caption{MAG system definition }
\end{center}
\end{figure}


The Z-axis is parallel to the magnetic dipole axis.
\\
If $\vec{N}$ is the North geographic pole, the $\vec{N}$,$\vec{Z}$ and $\vec{X}$ vector are in the same plane.\\
 The Y-axis is defined as $\vec{Y}=-\vec{Z}\times\vec{N}$\\

The MAG system is fixed with the rotating Earth. The magnetic longitude L and magnetic latitude $\lambda$ 
are defined in this system in the same way as right ascension and declination in GEI system.

\newpage
%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Geocentric Solar Ecliptic system (GSE)
%------------------------------------------------------------------------
\section{Geocentric Solar Ecliptic system (GSE)}
\label{sect:Geocentric Solar Ecliptic system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_GSE}
\includegraphics[height=5.5 cm]{./FIGURES/Coordinate_system_GSE.eps}
\caption{GSE system definition }
\end{center}
\end{figure}


The X-axis is pointing from the Earth towards the Sun.\\
The X-axis and the Y-axis are include in the ecliptic plane.\\
The Y-axis is pointing toward the dusk, opposing to the planetary motion.

\bigskip
The Z-axis is parallel to the ecliptic pole. The GSE system has a yearly rotation with respect to the inertial system.

%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Geocentric Solar Equatorial system (GSEQ)
%------------------------------------------------------------------------
\section{Geocentric Solar Equatorial system (GSEQ)}
\label{sect:Geocentric Solar Equatorial system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_GSEQ}
\includegraphics[height=5.5 cm]{./FIGURES/Coordinate_system_GSEQ.eps}
\caption{GSEQ system definition }
\end{center}
\end{figure}


The X-axis is pointing toward the Sun and include in the ecliptic plane.\\
The Y-axis is parallel to the Sun's equatorial plane (inclined to the ecliptic)
\\

X-axis is not necessarily in the Sun's equatorial plane;\\
Z-axis is not necessarily be parallel to the Sun's axis of rotation (which is perpendicular to Y, and thus in the X-Z plane);\\
Z-axis is chosen to be in the same sense as the ecliptic pole, i.e. northwards.

\newpage
%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Geocentric Solar Magnetospheric system (GSM)
%------------------------------------------------------------------------
\section{Geocentric Solar Magnetospheric system (GSM)}
\label{sect:Geocentric Solar Magnetospheric system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_GSM}
\includegraphics[height=5. cm]{./FIGURES/Coordinate_system_GSM.eps}
\caption{GSM system definition }
\end{center}
\end{figure}


The X-axis is pointing from the Earth towards the Sun.\\
The X-Z plane contains the dipole axis.\\
The Y-axis is perpendicular to the Earth's magnetic dipole, towards the dusk and include in the magnetic equator plane.
\\

The positive Z-axis is chosen to be in the same sense as the northern magnetic pole; the dipole tilt angle i is positive 
when the north magnetic pole is tilted towards the Sun. In addition to a yearly period due to the motion of the Earth about the Sun, 
the GSM system rocks about the Solar direction with a 24 h period.

%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Solar Magnetic system (SM)
%------------------------------------------------------------------------
\section{Solar Magnetic system (SM)}
\label{sect:Solar Magnetic system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_SM}
\includegraphics[height=5.0 cm]{./FIGURES/Coordinate_system_SM.eps}
\caption{SM system definition }
\end{center}
\end{figure}


The  Z-axis is parallel to the North magnetic dipole.\\
The X-Z plane contains the direction of the Sun.\\
The Y-axis is perpendicular to the Earth-Sun line toward dusk.
\\

The SM system rotates with both a yearly and a daily period with respect to the inertial system.

\newpage

%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Dipole Meridian system (DM)
%------------------------------------------------------------------------
\section{Dipole Meridian system (DM)}
\label{sect:Dipole Meridian system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_DM}
\includegraphics[height=5.2 cm]{./FIGURES/Coordinate_system_DM.eps}
\caption{DM system definition }
\end{center}
\end{figure}

The Z-axis is parallel to the North magnetic dipole axis.\\
The X-Z plane contains the direction $\vec{R}$ of the point of observation, from the Earth, 
and is a dipole magnetic meridian plane.\\

The Y-axis is perpendicular to the $\vec{R}$ vector, eastwards.\\

This system is a local coordinate system, which is dependent of the position of the point of observation from the Earth.


%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Vertical Dusk Horizontal system (VDH)
%------------------------------------------------------------------------
\section{Vertical Dusk Horizontal system (VDH)}
\label{sect:Vertical Dusk Horizontal system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_VDH}
\includegraphics[height=5.2 cm]{./FIGURES/Coordinate_system_VDH.eps}
\caption{VDH system definition }
\end{center}
\end{figure}

The V-axis is the outwards local vertical, to the point of observation.\\
The H-axis is parallel to the horizontal local plane, positive to the North.\\
The V-H plane is a geographic meridian plane. The D-axis is azimuthal, eastwards.\\

As DM system, this system is a local coordinate system, which is dependent of the position of the point 
of observation from the Earth.

\newpage

%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Spin Reference system (SR)
%------------------------------------------------------------------------
\section{Spin Reference system (SR)}
\label{sect:Spin Reference system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_SR}
\includegraphics[height=4.8 cm]{./FIGURES/Coordinate_system_SR.eps}
\caption{SR system definition }
\end{center}
\end{figure}


This is a spinning local system close to the measurement antenna of a spacecraft.\\
The  Z-axis is the spin axis of the spacecraft.\\
The X-axis and Y-axis are perpendicular to the spin axis, and rotate at the spin frequency of the spacecraft.\\

The definition of the SR system need the knowledge of the spin axis in a fixed frame of reference as the GEI 
inertial system, and the value of the spin phase $\phi$ at a given time.

%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Spin Reference 2 system (SR2)
%------------------------------------------------------------------------
\section{Spin Reference 2 system (SR2)}
\label{sect:Spin Reference 2 system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_SR2}
\includegraphics[height=4.8 cm]{./FIGURES/Coordinate_system_SR2.eps}
\caption{SR2 system definition }
\end{center}
\end{figure}


This is a fixed system usefull for the spacecraft data processing. It is also called SCS, 
as "Spacecraft-Sun system", or DS system (Despun Satellite).\\
The  Z-axis is the spin axis of the spacecraft.\\
The X-Z plane contains the direction of the Sun.\\
The X-axis is towards the day side.\\
The Y-axis is perpendicular to the spacecraft-Sun line.\\

The SR2 system rotates with the same period than the orbital period of the spacecraft with respect to the inertial system, 
while the declination $\theta$ varies continously.


\newpage

%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Inverse SR2 system (ISR2)
%------------------------------------------------------------------------
\section{Inverse SR2 system (ISR2)}
\label{sect:Inverse SR2 system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_ISR2}
\includegraphics[height=4.7 cm]{./FIGURES/Coordinate_system_ISR2.eps}
\caption{ISR2 system definition }
\end{center}
\end{figure}


This system is equivalent to the SR2 system where the Z and Y axis has inverse sign. This system is useful for CLUSTER, where the Z axis of ISR2 system is close to the Z axis of the GSE system, so ISR2 is a rather good approximation of the GSE system, and does not requires knowledge of spin direction in GSE system.

%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Magnetic Field Aligned system (MFA)
%------------------------------------------------------------------------
\section{Magnetic Field Aligned system (MFA)}
\label{sect:Magnetic Field Aligned system}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_MFA}
\includegraphics[height=4.0 cm]{./FIGURES/Coordinate_system_MFA.eps}
\caption{MFA system definition }
\end{center}
\end{figure}


This is a system useful for physic, but the meaning of the Bo DC magnetic filed must be knew, 
as its time variation (see ref. [2] ). \\
The  Z-axis is the DC magnetic field vector.\\
The X-Z plane contains the direction of the Sun.\\
The X-axis is towards the day side.\\
The Y-axis is perpendicular to the spacecraft-Sun line.\\

The MFA system move continuously with the time variation of the DC magnetic field (see \cite{Robert00}).


\newpage


%------------------------------------------------------------------------
%		CHAPTER : DESCRIPTION OF COORDINATE SYSTEMS
%		SECTION : Tangent Paraboloid Normal (TPN)
%------------------------------------------------------------------------
\section{Tangent Paraboloid Normal system (TPN)}
\label{sect:Tangent Paraboloid Normal}

\begin{figure}[!h]
\begin{center}
\label{Coordinate_system_TPN}
\includegraphics[height=8.0 cm]{./FIGURES/Coordinate_system_TPN_a.eps} \\~\\
\includegraphics[height=6.0 cm]{./FIGURES/Coordinate_system_TPN_b.eps}
\caption{TPN system definition }
\end{center}
\end{figure}

The TPN system has been introduced by the author in 2005, for magnetopause studies. 
When the spacecraft cross the magnetopause, this one is modelized by a paraboloide around the Sun-Earth direction. 
The $\vec{N}$ vector is the output normal to the plane tengant to the paraboloid, at the local point of observation. 
The $\vec{T}$ vector is the tangent in the X-N plane, toward the submit of the parabole, 
while the $\vec{P}$ vector is the tangent perpendicular to the X-N or T-N plane, in the direct sens $\vec{T,P,N}$.
\\ \\
When magnetopause crossing data are analysed by the Minimum Variance Analysis method, the $\vec{N}$ vector of 
the TPN system is often close the MVA eigen vector corresponding to the minimum eigenvalue. 


%------------------------------------------------------------------------
%       PART    : DEFINITIONS AND MATHEMATICAL FORMULAS
%	    CHAPTER : DIAGRAM OF TRANSFORMATIONS
%------------------------------------------------------------------------
\chapter{DIAGRAM OF TRANSFORMATIONS}
\label{chapter:diagram of transformations}


%------------------------------------------------------------------------	
%	     CHAPTER : DIAGRAM OF TRANSFORMATIONS
%		 SECTION : General remarks
%------------------------------------------------------------------------

\section{General remarks}
\label{sect:General remarks DOT }

Among all coordinates systems described in section I, we have single out two particular systems more frequently 
encountered: the Geographic system (GEO) and the Geocentric Equatorial Inertial system (GEI). 
From these two system, we have computed all transformations to directly convert theses coordinates into any else other. 
Similarly GSE system has been added in version 3.0 as a starting point for other coordinates.
Furthermore, other direct "circular" transformations between the other system are also given, as explained on the 
schematic diagram below.

%------------------------------------------------------------------------
%	      CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		  SECTION : Schematic diagram of transformations
%------------------------------------------------------------------------
\vspace{-0.5cm}
\section{Schematic diagram of transformations}
\label{sect:schematic diagram of transformations}

\begin{figure}[!h]
\begin{center}
\vspace{-0.3cm}
\includegraphics[height=12.6 cm]{./FIGURES/diagram_transformation.eps}
\vspace{-0.3cm}
\caption{Diagram of available transformations }
\label{diagram transformation}\vspace{-0.3cm}
\end{center}
\end{figure}

\newpage

%------------------------------------------------------------------------
%	    CHAPTER : DIAGRAM OF TRANSFORMATIONS
%		SECTION : List of transformations
%------------------------------------------------------------------------

\section{List of transformations}
\label{sect:list of transformations}

All different coordinate transformations are listed below; number correspond to number 
given in the above schematic diagram, and detailled in the same order in 
section \ref{chapter:mathematicals form of transformation matrix}. 
Name corresponds to the corresponding subroutines described in Part II.

\footnotesize {
%\begin{tabular}{rllll}
%    \vspace{0.3 cm}\\
%	~~~  &\textit{name} 	& \hspace{1. cm}\textit{input coordinates}		 & \hspace{2.4 cm}	&\textit{output coordinates} \\
%	\vspace{0.3 cm}
%\end{tabular}

\vspace{0.5 cm}
{\bf AROUND GEI} \\

\begin{tabular}{rllll}	
	
~~1)	& t\_gei\_geo	 & Geocentric Equatorial Inertial   & $\longrightarrow$	& Geographical  \\
  	    & t\_geo\_gei	 & Geographical 			        & $\longrightarrow$	& Geocentric Equatorial Inertial 
	    \vspace{0.2 cm}\\
	
~~2) 	& t\_gei\_mag	 & Geocentric Equatorial Inertial   & $\longrightarrow$	& Magnetic dipole\\ 
    	& t\_mag\_gei  & Magnetic dipole 			        & $\longrightarrow$	& Geocentric Equatorial Inertial 
	    \vspace{0.2 cm}\\
	
~~3)	& t\_gei\_sm	 & Geocentric Equatorial Inertial   & $\longrightarrow$	& Solar Magnetic \\
	    & t\_sm\_gei	 & Solar Magnetic 		            & $\longrightarrow$	& Geocentric Equatorial Inertial 
	    \vspace{0.2 cm}\\
		
~~4)	& t\_gei\_gsm	 & Geocentric Equatorial Inertial 	& $\longrightarrow$	& Geocentric Solar Magnetospheric \\
	    & t\_gsm\_gei  & Geocentric Solar Magnetospheric 	& $\longrightarrow$	& Geocentric Equatorial Inertial 
	    \vspace{0.2 cm}\\	
	
~~5)	& t\_gei\_gse	 & Geocentric Equatorial Inertial 	& $\longrightarrow$	& Geocentric Solar Ecliptic \\
	    & t\_gse\_gei	 & Geocentric Solar Ecliptic 	    & $\longrightarrow$	& Geocentric Equatorial Inertial 
	    \vspace{0.2 cm}\\
			
~~6)	& t\_gei\_gseq & Geocentric Equatorial Inertial 	& $\longrightarrow$	& Geocentric Solar Equatorial \\
	    & t\_gseq\_gei & Geocentric Solar Equatorial 	    & $\longrightarrow$	& Geocentric Equatorial Inertial 
	    \vspace{0.2 cm}\\
\end{tabular}	

\vspace{0.5 cm}	
{\bf AROUND GEO} \\

\begin{tabular}{rllll}	
		
7)	& t\_geo\_mag	  & Geographical  		& $\longrightarrow$	& Magnetic dipole \\
	& t\_mag\_geo	  & Magnetic dipole 	& $\longrightarrow$	& Geographical  
	\vspace{0.2 cm}\\
		
8)	& t\_geo\_sm	  & Geographical  		& $\longrightarrow$	& Solar Magnetic \\
	& t\_sm\_geo	  & Solar Magnetic 		& $\longrightarrow$	& Geographical   
	\vspace{0.2 cm}\\
		
9)	& t\_geo\_gsm	  & Geographical   		            & $\longrightarrow$	& Geocentric Solar Magnetospheric \\ 
	& t\_gsm\_geo	  & Geocentric Solar Magnetospheric & $\longrightarrow$	& Geographical   
	\vspace{0.2 cm}\\
		
10)	& t\_geo\_gse	  & Geographical   		      &	$\longrightarrow$	& Geocentric Solar Ecliptic \\
	& t\_gse\_geo	  & Geocentric Solar Ecliptic & $\longrightarrow$	& Geographical   
	\vspace{0.2 cm}\\
		
11)	& t\_geo\_gseq   & Geographical  		        & $\longrightarrow$	& Geocentric Solar Equatorial \\
	& t\_gseq\_geo    & Geocentric Solar Equatorial & $\longrightarrow$	& Geographical   
	\vspace{0.2 cm}\\
		
12)	& t\_geo\_vdh	  & Geographical 		  	 & $\longrightarrow$	& Vertical Dusk Horizontal \\
	& t\_vdh\_geo	  & Vertical Dusk Horizontal & $\longrightarrow$	& Geographical 
	\vspace{0.2 cm}\\
		
13)	& t\_geo\_dm      & Geographical 			&	$\longrightarrow$	& Dipole Meridian \\
	& t\_dm\_geo	  & Dipole Meridian 		&	$\longrightarrow$	& Geographical 
	\vspace{0.2 cm}\\
\end{tabular}

\vspace{0.5 cm}
{\bf AROUND GSE} \\

\begin{tabular}{rllll}	
	
14)	& t\_gse\_sm	  & Geocentric Solar Ecliptic 	&	$\longrightarrow$	& Solar Magnetic \\
	& t\_sm\_gse	  & Solar Magnetic 	            &	$\longrightarrow$	& Geocentric Solar Ecliptic 
	\vspace{0.2 cm}\\
	
15)	& t\_gse\_gsm	  & Geocentric Solar Ecliptic 	    &	$\longrightarrow$	& Geocentric Solar Magnetospheric \\
	& t\_gsm\_gse	  & Geocentric Solar Magnetospheric &	$\longrightarrow$	& Geocentric Solar Ecliptic 
	\vspace{0.2 cm}\\	
		
16)	& t\_gse\_tpn	  & Geocentric Solar Ecliptic 	& $\longrightarrow$	& Tangent Paraboloid Normal 
	\vspace{0.2 cm}\\	
	
17)	& t\_gse\_isr2	  & Geocentric Solar Ecliptic 	& $\longrightarrow$	& Inverse SR2  \\
	& t\_isr2\_gse	  & Inverse SR2 system      	& $\longrightarrow$	& Geocentric Solar Ecliptic 
	\vspace{0.2 cm}\\		
	
18)	& t\_gse\_sr2	  & Geocentric Solar Ecliptic 	& $\longrightarrow$	& Spin Reference 2 \\
	& t\_sr2\_gse	  & Spin Reference 2         	& $\longrightarrow$	& Geocentric Solar Ecliptic 
	\vspace{0.2 cm}\\	
		
19)	& t\_gse\_mfa	  & Geocentric Solar Ecliptic	& $\longrightarrow$	& Magnetic Field Aligned
	\vspace{0.2 cm}\\	
		
20)	& t\_gse\_gseq	  & Geocentric Solar Ecliptic 	& $\longrightarrow$	& Geocentric Solar Equatorial \\
	& t\_gseq\_gse	  & Geocentric Solar Equatorial & $\longrightarrow$	& Geocentric Solar Ecliptic 
	\vspace{0.2 cm}\\
	
\end{tabular}

\vspace{0.5 cm}
{\bf AROUND GSM} \\

\begin{tabular}{rllll}	
		
21)	& t\_gsm\_gseq	  & Geocentric Solar Magnetospheric & $\longrightarrow$	& Geocentric Solar Equatorial \\
	& t\_gseq\_gsm 	  & Geocentric Solar Equatorial		& $\longrightarrow$	& Geocentric Solar Magnetospheric 
	\vspace{0.2 cm}\\	
		
22)	& t\_gsm\_mag	  & Geocentric Solar Magnetospheric  & $\longrightarrow$	& Magnetic dipole \\
	& t\_mag\_gsm 	  & Magnetic dipole 	         & $\longrightarrow$	& Geocentric Solar Magnetospheric 
	\vspace{0.2 cm}\\	
		
23)	& t\_gsm\_sm	  & Geocentric Solar Magnetospheric  & $\longrightarrow$	& Solar Magnetic \\
	& t\_sm\_gsm 	  & Solar Magnetic 		             & $\longrightarrow$	& Geocentric Solar Magnetospheric 
	\vspace{0.2 cm}\\
		
24)	& t\_gsm\_tpn     & Geocentric Solar Magnetospheric  & $\longrightarrow$	& Tangent Paraboloid Normal \\
	\vspace{0.2 cm}	
\end{tabular}

\vspace{0.5 cm}
{\bf AROUND SM} \\

\begin{tabular}{rllll}	
		
25)	& t\_sm\_to\_mag~	  & Solar Magnetic       & $\longrightarrow$	& Magnetic dipole \\
	& t\_mag\_to\_sm~ 	  & Magnetic dipole 	 & $\longrightarrow$	& Solar Magnetic
	\vspace{0.2 cm}\\
\end{tabular}

\vspace{0.5 cm}
{\bf AROUND SR2} \\

\begin{tabular}{rllll}	

26) & t\_sr2\_isr2	     & Spin Reference 2 	& $\longrightarrow$	& Inverse SR2	\\
	& t\_isr2\_sr2	     & Inverse SR2 		    & $\longrightarrow$	& Spin Reference 2 	
	\vspace{0.2 cm}\\
		
27) & t\_sr2\_sr	     & Spin Reference 2 	& $\longrightarrow$	& Spin Reference 	\\
	& t\_sr\_sr2	     & Spin Reference 	    & $\longrightarrow$	& Spin Reference 2 			
	\vspace{0.2 cm}\\
			
28)	& t\_sr2\_mfa	     & Spin Reference 2 (SR2)& $\longrightarrow$	& Magnetic Field Aligned
	\vspace{0.2 cm}\\		
	
\end{tabular}

} % end footnotesize
\normalsize

\pagebreak

%------------------------------------------------------------------------
%       PART    : DEFINITIONS AND MATHEMATICAL FORMULAS
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%------------------------------------------------------------------------
\chapter{MATHEMATICAL FORM OF TRANSFORMATIONS}
\label{chapter:mathematicals form of transformation matrix}
 
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : General remarks on transformation matrix
%------------------------------------------------------------------------
\section{General remarks on transformation matrix}
\label{sect:General remarks on transformation matrix}

To obtain the matrix to transform a vector expressed in a coordinate system A into another system B, 
the simplest way is to express the directions of the 3 axis of system B in the coordinate system A.\\

 Indeed, if we notes the coordinates of these 3 unit axes $\vec{X}_B$, $\vec{Y}_B$, $\vec{Z}_B$  in coordinate system A as:\\
% --------------------------------------
\begin{displaymath}
\begin{array}{ccc}
\vec{X}_B = \left( \begin{array}{c}
X_1 \\
X_2 \\
X_3 
\end{array}\right)_{(A)}
& 
 \vec{Y}_B = \left( \begin{array}{c}
Y_1 \\
Y_2 \\
Y_3 
\end{array}\right)_{(A)}
&
\vec{Z}_B = \left( \begin{array}{c}
Z_1 \\
Z_2 \\
Z_3 
\end{array}\right)_{(A)}
\end{array}
\end{displaymath}
% --------------   
~ \\
Any vector $\vec{V}$ can be expressed in system B as:

\begin{eqnarray}
V_1^{(B)} = \vec{X}_B\cdot\vec{V} & = & X_1^{(A)}V_1^{(A)} + X_2^{(A)}V_2^{(A)} + X_3^{(A)}V_3^{(A)} \\
V_2^{(B)} = \vec{Y}_B\cdot\vec{V} & = & Y_1^{(A)}V_1^{(A)} + Y_2^{(A)}V_2^{(A)} + Y_3^{(A)}V_3^{(A)} \\
V_3^{(B)} = \vec{Z}_B\cdot\vec{V} & = & Z_1^{(A)}V_1^{(A)} + Z_2^{(A)}V_2^{(A)} + Z_3^{(A)}V_3^{(A)}
\end{eqnarray} 

~ \\
 Thus the transform matrix of any vector $\vec{V}$ is:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{8 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}
\right)_{(B)} = 
\left(\begin{array}{ccc}
X_1 & X_2 & X_3 \\
Y_1 & Y_2 & Y_3 \\
Z_1 & Z_2 & Z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}
\right)_{(A)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~ \\
 Similarly the transformation from system B to A is:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{8 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}
\right)_{(A)} = 
\left(\begin{array}{ccc}
X_1 & Y_1 & Z_1 \\
X_2 & Y_2 & Z_2 \\
X_3 & Y_3 & Z_3 \end{array}
\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(B)}
\end{displaymath}
\end{boxedminipage}
\end{center}

\bigskip
All transformation matrix have the following properties, useful for error checking:\\ 

1) Each row and column is a unit vector;\\
2) The dot products of any two rows or any two columns is zero;\\ 
3) The cross product of any two rows or columns equals the third row or column or its negative 
(Row 1 cross row 2 equals row3; row 2 cross row 1 equal minus row3).
 
\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GEI to GEO transformation
%------------------------------------------------------------------------

\section{GEI ~~to GEO transformation}
\label{sect:gei to geo transformation}

\begin{figure}[!h]
\begin{center}
\begin{tabular}{lc}
\emph{\textbf{Geocentric Equatorial Inertial system}} & \emph{\textbf{Geographic system}}\\ 
\includegraphics[height=4.8 cm]{./FIGURES/Coordinate_system_GEI.eps} &
\includegraphics[height=4.8 cm]{./FIGURES/Coordinate_system_GEO.eps} \\
\end{tabular}
\end{center}
\end{figure}

GEO and GEI system have their Z-axis in common, so the only difference is a rotation around Z-axis 
of $\theta$ angle, thus the matrix transformation is: \\


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
\cos\theta & -\sin\theta & 0 \\
\sin\theta & ~\cos\theta & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEO)}
\end{displaymath}
\end{boxedminipage} \\
\end{center} 

~\\~\\
  and the inverse transformation is obviously: 

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
~\cos\theta & \sin\theta & 0 \\
-\sin\theta & \cos\theta & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{boxedminipage}\\
\end{center} 

\bigskip \bigskip
The $\theta$ angle is the angle between the Greenwich meridian and the first point in Aries, 
measured Eastward, in the Earth's equator, from the first point in Aries.\\

$\theta$ is called Greenwich Mean Sideral Time; GMST is a function of the time of the day and the time of year, 
since the sideral day (duration of a day relative to inertial space) is less than 24h.\\

Practically, GMST is computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine.

\newpage

%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GEI to MAG transformation
%------------------------------------------------------------------------

\section{GEI ~~to MAG transformation}
\label{sect:gei to mag transformation}

\begin{figure}[!h]
\begin{center}
\begin{tabular}{lc}
\emph{\textbf{Geocentric Equatorial Inertial}} & \emph{\textbf{Geomagnetic system}}\\ \\
\includegraphics[height=5.3 cm]{./FIGURES/Coordinate_system_GEI.eps} &
\includegraphics[height=4.5 cm]{./FIGURES/Coordinate_system_MAG.eps}
\end{tabular}
\end{center}
\end{figure}

Transformation from GEI to MAG system requires a knowledge of the dipole direction in GEI system, noted as $\vec{M}$.\\

The geographic coordinates of the dipole axis can be known, for instance for IGRF epoch 1965, as 11.435$^\circ$ 
colatitude and -69.761$^\circ$ east longitude, thus:

\begin{displaymath}
\vec{D}=(D_1, D_2, D_3)=(0. 06859,-0.18602, 0. 98015)
\end{displaymath}


Practically, $\vec{D}$ is computed for a given time and year from \textbf{\textit{cp\_geo\_dipole\_dir}} subroutine.\\

To know the $\vec{M}=\vec{D}$ vector in GEI system, which is the Z-axis of MAG system, we use the GEO to GEI 
transformation computed   \S \ref{sect:gei to geo transformation}, so:


\begin{displaymath}
\vec{Z} = \vec{M} = \vec{D}_{GEI} = \left(\begin{array}{c}
D_1\cos\theta - D_2\sin\theta\\
D_1\sin\theta+D_2\cos\theta\\
D_3\end{array}\right)
\end{displaymath} 

where $\theta$ is the Greenwich Mean Sideral Time computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine.\\

We can deduce then the Y-axis of SM system in GEI coordinates from the cross product between North 
geographic pole ($\vec{N}$) and North magnetic pole ($\vec{M}$) :

\begin{center}
$\vec{Y}= \displaystyle\frac{\vec{N}\times\vec{M}}{|\vec{N}\times \vec{M}|}$
\end{center}

Normalizing factors occurs because $\vec{N}$ and $\vec{M}$ are not necessarily perpendicular; 
since $\vec{N}$ has two components equal to zero, cross product is easy and we found: 

 \begin{center}

$\vec{Y} = \displaystyle\frac{1}{\left(M_1^2+M_2^2\right)^{1/2}} \cdot \left(\begin{array}{c}
-M_1 \\
~M_2\\
~0\end{array}\right)
 $
\end{center} 
~ \\ \\
 X-axis is deduced from:	$\vec{X} = \vec{Y}\times\vec{M}$ , so:

\begin{center}
 $\vec{X} =  \displaystyle\frac{1}{\left(M_1^2+M_2^2\right)^{1/2}}  \cdot \left(\begin{array}{c}
M_1M_3 \\
M_2M_3\\
-\left(M_1^2+M_2^2\right)\end{array}\right)$
\end{center} 

All coordinates of X-Y-Z axis of MAG system in GEI coordinates being known, the transform matrix of any vector
$\vec{V}$ is: \\ 

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
X_1 & X_2 & X_3 \\
Y_1 & Y_2 & Y_3 \\
M_1 & M_2 & M_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}  

~\\ ~\\
Similarly the transformation from system MAG to GEI is:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
X_1 & Y_1 & M_1 \\
X_2 & Y_2 & M_2 \\
X_3 & Y_3 & M_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(MAG)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}  

~\\ ~\\
By replacing corresponding values, with $Q=\left(M_1^2 + M_2^2\right)^{1/2}$ , we obtain the expression 
of all terms of the transformation matrix: \\


\begin{center}
$\begin{array}{llll}

\left( \begin{array}{c}
X_1 \\
X_2\\
X_3 \end{array}\right) & = 
\left(\begin{array}{c}
(D_{1}D_{3}\cos\theta-D_2D_3\sin\theta)/Q \\
 (D_1D_3\sin\theta+D_2D_3\cos\theta)/Q \\
  -Q 
   \end{array}\right) \\ \\
%\end{displaymath}


%\begin{displaymath}
\left( \begin{array}{c}
Y_1 \\
Y_2\\
Y_3 \end{array}\right) & =   
\left(\begin{array}{c}
-(D_2\cos\theta+D_1\sin\theta)/Q \\
 (-D_2\sin\theta+D_1\cos\theta)/Q \\
  0
  \end{array}\right)\\ \\
%\end{displaymath}


%\begin{displaymath}
\left( \begin{array}{c}
M_1 \\
M_2\\
M_3 \end{array}\right) & = 
\left(\begin{array}{c}
D_1\cos\theta-D_2\sin\theta \\
 D_1\sin\theta+D_2\cos\theta \\
 D_3
 \end{array}\right) \\ \\
%\end{displaymath}

%\begin{displaymath}

\end{array}$
\end{center}

 
Remember that  $\theta$ is the Greenwich Mean Sideral Time computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine, 
and  $\vec{D}$ is the direction of the dipole axis  in the geographic system. 
$\vec{M}$ is the direction of the dipole axis in the GEI system, allowing computation of the Q factor.

%\end{footnotesize}
%\end{minipage}
 
 \newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GEI to SM transformation
%------------------------------------------------------------------------

\section{GEI to ~~SM transformation}
\label{sect:gei to sm transformation}

%Geocentric Equatorial Inertial				Solar Magnetic

\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Equatorial Inertial}} & \emph{\textbf{Solar Magnetic}}\\
~\\
\includegraphics[height=5.5 cm]{./FIGURES/Coordinate_system_GEI.eps} &
\includegraphics[height=4.8 cm]{./FIGURES/Coordinate_system_SM.eps}
\end{tabular}
\end{center}
\end{figure}

Transformation from GEI system to SM system requires a knowledge of Sun direction and magnetic dipole 
direction in GEI system.\\

In GEI system, the direction of the Sun is computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine:

\begin{displaymath} 
\vec{S}=(S_1, S_2, S_3)
\end{displaymath}

The geographic coordinates of the dipole axis can be known, for instance for IGRF epoch 1965, 
as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude, thus:

\begin{displaymath}
\vec{D}=(D_1, D_2, D_3)=(0.06 859,-0.18 602, 0.98 015)
\end{displaymath}

Practically, $\vec{D}$ is computed for a given time and year from \textbf{\textit{cp\_geo\_dipole\_dir}} subroutine.\\

To know the $\vec{M}=\vec{D}$ vector in GEI system, which is the Z-axis of SM system, 
we use the GEO to GEI transformation computed \S \ref{sect:gei to geo transformation}, so:


\begin{displaymath}
\vec{Z}=\vec{M}=\vec{D}_{GEI}=\left(\begin{array}{c}
D_1\cos\theta-D_2\sin\theta\\
D_1\sin\theta+D_2\cos\theta\\
D_3\end{array}\right)
\end{displaymath}


where $\theta$ is the Greenwich Mean Sideral Time computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine.\\

We can deduce then the Y-axis of SM system in GEI coordinates as:
\vspace{-6pt}
\begin{center}
\begin{displaymath}
\vec{Y}= \frac{\vec{M}\times\vec{S}}{|\vec{M}\times\vec{S}|}
\end{displaymath}
\end{center}
~\\
Normalizing factors occurs because $\vec{M}$ and $\vec{S}$ are not necessarily perpendicular.\\

X-axis is deduced from: $\vec{X}= \vec{Y}\times\vec{M}$ 

\newpage 
All coordinates of X-Y-Z axis of SM system in GEI coordinates being known, the transform matrix of any vector $\vec{V}$ is: \\


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
X_1 & X_2 & X_3 \\
Y_1 & Y_2 & Y_3 \\
Z_1 & Z_2 & Z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{boxedminipage}\\
\end{center} 

~\\
Similarly the transformation from system SM to GEI is:
 
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
X_1 & Y_1 & Z_1 \\
X_2 & Y_2 & Z_2 \\
X_3 & Y_3 & Z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SM)}
\end{displaymath}
\end{boxedminipage}\\
\end{center} 

~\\
with respectively: 

\begin{center}
$\begin{array}{llll}

\left( \begin{array}{c}
Z_1 \\
Z_2\\
Z_3 \end{array}\right) & = 
\left(\begin{array}{c}
M_1 \\
M_2 \\
M_3 \end{array}\right) \\ \\
%\end{displaymath}


%\begin{displaymath}
\left( \begin{array}{c}
Y_1 \\
Y_2\\
Y_3 \end{array}\right) & = 
 \displaystyle\frac{1}{Q} \cdot\left(\begin{array}{c}
M_2S_3-M_3S_2 \\
M_3S_1-M_1S_3 \\
M_1S_2-M_2S_1 \end{array}\right) \\ \\
%\end{displaymath}


%\begin{displaymath}
\left( \begin{array}{c}
X_1 \\
X_2\\
X_3 \end{array}\right) & = 
\left(\begin{array}{c}
Y_2M_3-Y_3M_2 \\
Y_3M_1-Y_1M_3 \\
Y_1M_2-Y_2M_1 \end{array}\right) \\ \\
%\end{displaymath}

%\begin{displaymath}
\left( \begin{array}{c}
M_1 \\
M_2\\
M_3 \end{array}\right) & = 
\left(\begin{array}{c}
D_1\cos\theta-D_2\sin\theta \\
D_1\cos\theta+D_2\sin\theta \\
D_3 \end{array}\right)
\end{array}$
\end{center}

~\\
with 
$Q = \left[(M_2S_3-M_3S_2)^2 + (M_3S_1-M_1S_3)^2+(M_1S_2-M_2S_1)^2\right]^{1/2}$

\newpage

%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTion : GEI to GSM transformation
%------------------------------------------------------------------------

\section{GEI to ~~GSM transformation}
\label{sect:gei to gsm transformation}

%Geocentric Equatorial Inertial			Geocentric Solar Magnetospheric

\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Equatorial Inertial}} & \emph{\textbf{Geocentric Solar Magnetospheric}}\\
~\\
\includegraphics[height=5.3 cm]{./FIGURES/Coordinate_system_GEI.eps} &
\includegraphics[height=4.8 cm]{./FIGURES/Coordinate_system_GSM.eps}
\end{tabular}
\end{center}
\end{figure}


Transformation from GEI system to GSM system requires a knowledge of Sun direction and magnetic dipole direction in GEI system.\\

In GEI system, the direction of X-axis of GSM system is the direction of the Sun computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine:
\begin{displaymath}
\vec{X}=\vec{S}=(S_1, S_2, S_3)
\end{displaymath}

The geographic coordinates of the dipole axis can be known, for instance for IGRF epoch 1965, 
as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude, thus:

\begin{displaymath}
\vec{D}=(D_1, D_2, D_3)=(0.06859,-0.18602, 0.98015) 
\end{displaymath}

Practically, $\vec{D}$ is computed for a given time and year from \textbf{\textit{cp\_geo\_dipole\_dir}} subroutine.\\

To know the  $\vec{M}=\vec{D}$ vector in GEI system, we use the GEO to GEI transformation computed 
in \S \ref{sect:gei to geo transformation}, so:

\begin{displaymath}
\vec{M}=\vec{D}_{GEI} = \left(\begin{array}{c}
D_1\cos\theta - D_2\sin\theta\\
D_1\sin\theta + D_2\cos\theta\\
D_3\end{array}\right)
\end{displaymath}

where $\theta$ is the Greenwich Mean Sideral Time computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine.\\

We can deduce then the Y-axis and Z-axis of GSM system in GEI coordinates as:
\vspace{-6pt}
\begin{center}
\begin{displaymath}
\vec{Y}= \frac{\vec{M}\times\vec{S}}{|\vec{M}\times\vec{S}|}
\end{displaymath}
\end{center}
~\\
Normalizing factors occurs because $\vec{M}$ and $\vec{S}$ are not necessarily perpendicular,
and Z is obtained by:
\vspace{-12pt}
\begin{center}
\begin{displaymath}
\vec{Z}= \vec{S}\times\vec {Y}
\end{displaymath}
\end{center}

\newpage

All coordinates of X-Y-Z axis of GSM system in GEI coordinates being known, the transform matrix of any vector $\vec{V}$ is:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
S_1 & S_2 & S_3 \\
Y_1 & Y_2 & Y_3 \\
Z_1 & Z_2 & Z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\~\\
 Similarly the transformation from system GSM to GEI is:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
S_1 & Y_1 & Z_1 \\
S_2 & Y_2 & Z_2 \\
S_3 & Y_3 & Z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\
with respectively:
 
\begin{displaymath}
\left(\begin{array}{c}
Y_1\\
Y_2\\
Y_3\end{array}\right) = 
\displaystyle\frac{1}{Q} \cdot \left(\begin{array}{c}
M_2S_3 - M_3S_2\\
M_3S_1 - M_1S_3\\
M_1S_2 - M_2S_1\end{array}\right)\\ \\
\end{displaymath}

~\\
\begin{displaymath}
\left(\begin{array}{c}
Z_1\\
Z_2\\
Z_3\end{array}\right) = 
\left(\begin{array}{c}
S_2Y_3-S_3Y_2\\
S_3Y_1-S_1Y_3\\
S_1Y_2-S_2Y_1 \end{array}\right) 
\end{displaymath}

~\\
\begin{displaymath}
\left(\begin{array}{c}
M_1\\
M_2\\
M_3\end{array}\right) = 
\left(\begin{array}{c}
D_1\cos\theta - D_2 \sin\theta\\
D_1\sin\theta + D_2 \cos\theta\\
D_3\end{array}\right)
\end{displaymath}

 ~\\~\\
 with
$Q = \left[(M_2S_3-M_3S_2)^2+(M_3S_1-M_1S_3)^2+(M_1S_2-M_2S_1)^2\right]^{1/2}$

\newpage

%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GEI to GSE transformation
%------------------------------------------------------------------------

\section{GEI to GSE transformation}
\label{sect:gei to gse transformation}


%Geocentric Equatorial Inertial			Geocentric Solar Ecliptic

\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Equatorial Inertial}} & \emph{\textbf{Geocentric Solar Ecliptic}}\\
~\\
\includegraphics[height=4.8 cm]{./FIGURES/Coordinate_system_GEI.eps} &
\includegraphics[height=3.8 cm]{./FIGURES/Coordinate_system_GSE.eps} ~\\~
\end{tabular}
\end{center}
\end{figure}

In GEI system, the direction of X-axis of GSE system is the direction $\vec{S}$ of the SUN , 
computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine:
\begin{displaymath}
\vec{X}=\vec{S}=(S_1, S_2, S_3)
\end{displaymath}

The direction of the Z-axis of GSE is the direction of ecliptic pole, which is a known constant value:
\begin{displaymath}
\vec{Z}=\vec{E}=(E_1, E_2, E_3) = (0, -0.398, 0.917)
\end{displaymath}

The third axis, $\vec{Y}$ is deduced from $\vec{Y}= \vec{Z}\times\vec{X} = \vec{E}\times\vec{S}$, thus:
\begin{displaymath}
\vec{Y} = \vec{E}\times \vec{S}= 
\left(\begin{array}{c}
E_2S_3-S_3E_2\\
E_3S_1-E_1S_3\\
E_1S_2-E_2S_1\end{array}\right)
\end{displaymath}

~\\
  Thus the transform matrix of any vector $\vec{V}$ is:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
S_1 & S_2 & S_3 \\
Y_1 & Y_2 & Y_3 \\
E_1 & E_2 & E_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{boxedminipage}\\
\end{center} 

~\\ ~\\
Similarly the transformation from system GSE to GEI is:
 

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
S_1 & Y_1 & E_1 \\
S_2 & Y_2 & E_2 \\
S_3 & Y_3 & E_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSE)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}
\newpage

%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTion : GEI to GSEQ transformation
%------------------------------------------------------------------------

\section{GEI to GSEQ transformation}
\label{sect:gei to gseq transformation}

%Geocentric Equatorial Inertial			Geocentric Solar Equatorial

\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Equatorial Inertial}} & \emph{\textbf{Geocentric Solar Equatorial}}\\
~\\
\includegraphics[height=4.8 cm]{./FIGURES/Coordinate_system_GEI.eps} &
\includegraphics[height=3.8 cm]{./FIGURES/Coordinate_system_GSEQ.eps} ~\\~
\end{tabular}
\end{center}
\end{figure}

In GEI system, the direction of X-axis of GSEQ system is the direction of the SUN computed from
\textbf{\textit{cp\_gei\_sun\_dir}} subroutine:
\begin{displaymath}
\vec{X}=\vec{S}=(S_1, S_2, S_3)
\end{displaymath}

The direction of the rotation axis of the SUN in GEI system is a known constant value:

\begin{displaymath}
\vec{R}=(R_1, R_2, R_3) = (0.122, -0.424, 0.899)
\end{displaymath}

Since Y-axis of GSEQ is parallel to the Sun's equatorial plane, the direction of Y-axis in GEI is $\vec{R}\times\vec{S}$ ; 
nevertheless the cross product must be normalized to have a Y unit axis, 
because $\vec{R}$ and $\vec{S}$ are not necessarily perpendicular, so:
\vspace{-6pt}
\begin{center}
\[ \scalebox{1.1}{
$\vec{Y}= \dfrac{\vec{R}\times\vec{S}}{|\vec{R}\times\vec{S}|}$
 } \]
\\~\\
and $\vec{Z}= \vec{S}\times\vec{Y}$ 
\end{center}

~\\
  Thus the transform matrix of any vector $\vec{V}$ is: 

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSEQ)} = 
\left(\begin{array}{ccc}
S_1 & S_2 & S_3 \\
Y_1 & Y_2 & Y_3 \\
Z_1 & Z_2 & Z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\~\\
  Similarly the transformation from system GSEQ to GEI is:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
S_1 & Y_1 & Z_1 \\
S_2 & Y_2 & Z_2 \\
S_3 & Y_3 & Z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSEQ)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GEO to MAG transformation
%------------------------------------------------------------------------

\section{GEO to MAG transformation}
\label{sect:geo to mag transformation}

%	Geographic						Geomagnetic

\begin{figure}[!h]
\begin{center}
\begin{tabular}{ll}
\emph{\textbf{Geographic}} & \emph{\textbf{Geomagnetic}}\\
~\\
\includegraphics[height=5.0 cm]{./FIGURES/Coordinate_system_GEO.eps} &
\includegraphics[height=4.5 cm]{./FIGURES/Coordinate_system_MAG.eps}
\end{tabular}
\end{center}
\end{figure}

In geomagnetic coordinates, Z-axis is parallel to the magnetic dipole axis D, 
and the Y-axis is perpendicular to the North geographic pole N, then we have in geographic system: 

\begin{displaymath}
\left \{
\begin{aligned}
  \vec{Z} & = \vec{D}\\
  \vec{Y} & = (\vec{N}\times\vec{D})/|\vec{N}\times\vec{D}|\\
  \vec{X} & = \vec{Y}\times\vec{D}
 \end{aligned} \\
  \right.
\end{displaymath}
 
 ~\\
The geographic coordinates of the dipole axis can be known, for instance for IGRF 
epoch 1965, as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude.\\ 
Practically, geographic dipole direction $\vec{D}$ is computed for a given time 
and year from \textbf{\textit{cp\_geo\_dipole\_dir}} subroutine; value for 1965.0 is:

\begin{displaymath}
\vec{D}=(D_1, D_2, D_3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

\begin{center}
  we deduce:		$\vec{Y}=(-D_2, D_1, 0 )/(D_1^2+D_2^2)^{1/2} $
\end{center}

\begin{center}
  and:	$\vec{X}=(Y_2D_3, -Y_1D_3, Y_1D_2-Y_2D_1)$
\end{center}  

~\\
 Thus the transform matrix of any vector $\vec{V}$ is:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
X_1 & X_2 & X_3 \\
Y_1 & Y_2 & Y_3 \\
D_1 & D_2 & D_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEO)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\
Similarly the transformation from system MAG to GEO is:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt} 
\begin{displaymath}
\left( \begin{array}{c}
 V_1 \\
 V_2\\
 V_3 \end{array}\right)_{(GEO)} = 
 \left(\begin{array}{ccc}
 X_1 & Y_1 & D_1 \\
 X_2 & Y_2 & D_2 \\
 X_3 & Y_3 & D_3 \end{array}\right)
 \left(\begin{array}{c}
 V_1 \\
 V_2 \\
 V_3 \end{array}\right)_{(MAG)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}


\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GEO to SM transformation
%------------------------------------------------------------------------

\section{GEO to SM~~transformation}
\label{sect:geo to sm transformation}

%	Geographic						Solar Magnetic

\begin{figure}[!h]
\begin{center}
\begin{tabular}{lc}
\emph{\textbf{Geographic}} & \emph{\textbf{Solar Magnetic}}\\
~\\
\includegraphics[height=5.0 cm]{./FIGURES/Coordinate_system_GEO.eps} &
\includegraphics[height=4.5 cm]{./FIGURES/Coordinate_system_SM.eps}
\end{tabular}
\end{center}
\end{figure}


In GEO system, the direction of the Z-axis of SM system is the dipole direction $\vec{D}$. 
The geographic coordinates of the dipole axis can be known, for instance for IGRF epoch 1965, as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude, thus:

\begin{displaymath}
\vec{D}=(D_1, D_2, D_3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

Practically, D is computed for a given time and year from \textbf{\textit{cp\_geo\_dipole\_dir}} subroutine.\\

We can then deduce in GEO system the Y-axis of SM system as:

\begin{displaymath}
\vec{y}= \displaystyle\frac{\vec{D}\times\vec{\mathscr{S}}}{| \vec{D}\times\vec{\mathscr{S}}|}
\end{displaymath}

where $\mathbf{\mathscr{S}}$ is the direction of the sun in GEO system, which can be computed from GEI to GEO 
transformation given in \S \ref{sect:gei to geo transformation}, then we have:

\begin{displaymath}
\vec{\mathscr{S}}=(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}_3) =((S_1\cos\theta+ S_2\sin\theta) , (-S_1\sin\theta+ S_2\cos\theta) , S_3)
\end{displaymath}


$\vec{S}$ is the direction of the Sun in GEI system, computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine, 
such as the Greenwich Mean Sideral Time $\theta$ normalizing factors occurs because $\vec{D}$ and $\vec{S}$ 
are not necessarily perpendicular.

~\\
The third axis X is computed from ~$\vec{x}=\vec{y}\times\vec{D}$
and the GEO to SM transformation is given by:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
x_1 & x_2 & x_3 \\
y_1 & y_2 & y_3 \\
D_1 & D_2 & D_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEO)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}
 

~\\~\\
  Similarly the SM to GEO transformation is given by:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
x_1 & y_1 & D_1 \\
x_2 & y_2 & D_2 \\
x_3 & y_3 & D_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SM)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\~\\
 with respectively:

\begin{displaymath}
\left( \begin{array}{c}
x_1 \\
x_2\\
x_3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{c}
y_2D_3-y_3D_2 \\
y_3D_1-y_1D_3\\
y_1D_2-y_2D_1 \end{array}\right)
\end{displaymath}

~\\~\\
\begin{displaymath}
\left( \begin{array}{c}
y_1 \\
y_2\\
y_3 \end{array}\right)_{(GEO)} = 
 \frac{1}{Q} \cdot \left(\begin{array}{c}
D_2\mathscr{S}_3-D_3\mathscr{S}2 \\
D_3\mathscr{S}_1-D_1\mathscr{S}3\\
D_1\mathscr{S}_2-D_2\mathscr{S}1 \end{array}\right)
\end{displaymath}

~\\~\\
\begin{displaymath}
Q=[(D_2\mathscr{S}_3-D_3\mathscr{S}_2)^2 + (D_3\mathscr{S}_1-D_1\mathscr{S}_3)^2 + (D_1\mathscr{S}_2-D_2\mathscr{S}_1)^2]^{1/2}
\end{displaymath}

\begin{displaymath}
\vec{\mathscr{S}}=(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}_3) =((S_1\cos\theta + S_2\sin\theta) , (-S_1\sin\theta+ S_2\cos\theta) , S_3)
\end{displaymath}


\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GEO to GSM transformation
%------------------------------------------------------------------------


\section{GEO to GSM transformation}
\label{sect:geo to gsm transformation}

%	Geographic					Geocentric Solar Magnetospheric

\begin{figure}[!h]
\begin{center}
\begin{tabular}{ll}
\emph{\textbf{Geographic}} & \emph{\textbf{Geocentric Solar Magnetospheric}}\\
~\\
\includegraphics[height=5.0 cm]{./FIGURES/Coordinate_system_GEO.eps} &
\includegraphics[height=4.8 cm]{./FIGURES/Coordinate_system_GSM.eps}
\end{tabular}
\end{center}
\end{figure}

In GEO system, the direction of the X-axis of GSM system is the direction of the sun  $\mathbf{\mathscr{S}}$, 
which can be computed from GEI to GEO transformation given in \S \ref{sect:gei to geo transformation}; then we have:

\begin{displaymath}
\vec{x}=\vec{\mathscr{S}}=(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}_3) =((S_1\cos\theta+ S_2\sin\theta) , 
(-S_1\sin\theta+ S_2\cos\theta) , S_3)
\end{displaymath}

$\vec{S}$ is the direction of the Sun in GEI system, computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine, 
such as the Greenwich Mean Sideral Time $\theta$.\\ 

The Y axis in GEO system can be deduced from:

\begin{displaymath}
y = \displaystyle \frac{\vec{D}\times\vec{\mathscr{S}}} {| \vec{D}\times\vec{\mathscr{S}}|}
\end{displaymath}

where $\vec{D}$ is the dipole direction; the geographic coordinates of the dipole axis can be known, 
for instance for IGRF epoch 1965, as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude, thus:

\begin{displaymath}
\vec{D}=(D_1, D_2, D_3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

Practically, $\vec{D}$ is computed for a given time and year from \textbf{\textit{cp\_geo\_dipole\_dir}} subroutine;
normalizing factors in cross product occurs because $\vec{D}$ and $\vec{\mathscr{S}}$ are not necessarily perpendicular.\\ 

Finally the third axis Z is computed from ~
$z = \vec{\mathscr{S}}\times\vec{y}$ ~~~and the GEO to GSM transformation is given by:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
x_1 & x_2 & x_3 \\
y_1 & y_2 & y_3 \\
z_1 & z_2 & z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEO)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}~\\


Similarly the GSM to GEO transformation is given by:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
x_1 & y_1 & z_1 \\
x_2 & y_2 & z_2 \\
x_3 & y_3 & z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\
with respectively:

\begin{center}

$\begin{array}{llll}

\left( \begin{array}{c}
x_1 \\
x_2\\
x_3 \end{array}\right)_{(GEO)} & = 
\left(\begin{array}{c}
\mathscr{S}_1 \\
\mathscr{S}_2\\
\mathscr{S}_3
   \end{array}\right) \\ \\

~\\

\left( \begin{array}{c}
y_1 \\
y_2\\
y_3 \end{array}\right)_{(GEO)} & =     
 \displaystyle \frac{1}{Q} \cdot \left(\begin{array}{c}
D_2\mathscr{S}_3-D_3\mathscr{S}_2 \\
D_3\mathscr{S}_1-D_1\mathscr{S}_3\\
D_1\mathscr{S}_2-D_2\mathscr{S}_1 
  \end{array}\right)\\ \\

~\\
\left( \begin{array}{c}
z_1 \\
z_2\\
z_3 \end{array}\right)_{(GEO)} & = 
\left(\begin{array}{c}
x_2y_3-x_3y_2 \\
x_3y_1-x_1y_3\\
x_1y_2-x_2y_1 
 \end{array}\right) \\ \\

\end{array}$
\end{center}


\begin{displaymath}
Q=[(D_2\mathscr{S}_3-D_3\mathscr{S}_2)^2 + (D_3\mathscr{S}_1-\mathscr{S}_1D_3)^2 + (D_1\mathscr{S}_2-D_2\mathscr{S}_1)^2]^{1/2}
\end{displaymath}

\begin{displaymath}
\vec{\mathscr{S}}=(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}_3) =((S_1\cos\theta+ S_2\sin\theta) , (-S_1\sin\theta+ S_2\cos\theta) , S_3)
\end{displaymath}


\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GEO to GSE transformation
%------------------------------------------------------------------------


\section{GEO to GSE transformation}
\label{sect:geo to gse transformation}

%	Geographic						Geocentric Solar Ecliptic

\begin{figure}[!h]
\begin{center}
\begin{tabular}{lc}
\emph{\textbf{Geographic}} & \emph{\textbf{Geocentric Solar Ecliptic}}\\
~\\
\includegraphics[height=4.8 cm]{./FIGURES/Coordinate_system_GEO.eps} &
\includegraphics[height=3.8 cm]{./FIGURES/Coordinate_system_GSE.eps}
\end{tabular}
\end{center}
\end{figure}

In GEO system, the direction of the X-axis of GSE system is the direction of the sun  $\vec{\mathscr{S}}$, 
which can be computed from GEI to GEO transformation given in \S \ref{sect:gei to geo transformation}; then we have:

\begin{displaymath}
\vec{X}=\vec{\mathscr{S}}=(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}_3) =
((S_1\cos\theta+ S_2\sin\theta) , (-S_1\sin\theta+ S_2\cos\theta) , S_3)
\end{displaymath}

$\vec{S}$ is the direction of the Sun in GEI system, computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine, 
such as the Greenwich Mean Sideral Time $\theta$\\

The Z axis is the direction of the ecliptic pole, which is a known constant value in GEI system:

\begin{displaymath}
\vec{E}=(E_1, E_2, E_3) = (0, -0.398, 0.917)
\end{displaymath}

~\\
From GEI to GEO transformation we have in GEO system:


\begin{displaymath}
\vec{Z}=\vec{\mathscr{E}}=(\mathscr{E}_1, \mathscr{E}_2, \mathscr{E}_3) =
((E_1\cos\theta+ E_2\sin\theta) , (-E_1\sin\theta + E_2\cos\theta) , E_3)
\end{displaymath}

~\\
And finally the Y axis in GEO system can be deduced from:

\begin{displaymath}
\vec{Y}= \vec{\mathscr{E}}\times\vec{\mathscr{S}}
\end{displaymath}


and the GEO to GSE transformation is given by:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(G\mathscr{S}E)} = 
\left(\begin{array}{ccc}
\mathscr{S}_1 & \mathscr{S}_2 & \mathscr{S}_3 \\
Y_1 & Y_2 & Y_3 \\
\mathscr{E}_1 & \mathscr{E}_2 & \mathscr{E}_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEO)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\
 Similarly the GSE to GEO transformation is given by:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
\mathscr{S}_1 & Y_1 & \mathscr{E}_1 \\
\mathscr{S}_2 & Y_2 & \mathscr{E}_2 \\
\mathscr{S}_3 & Y_3 & \mathscr{E}_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSE)}
\end{displaymath}
\end{boxedminipage}\\
\end{center} 

\newpage
with respectively:


\begin{displaymath}
\left( \begin{array}{c}
Y_1 \\
Y_2\\
Y_3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{c}
\mathscr{E}_2\mathscr{S}_3-\mathscr{E}_3\mathscr{S}_2 \\
\mathscr{E}_3\mathscr{S}_1-\mathscr{E}_1\mathscr{S}_3\\
\mathscr{E}_1\mathscr{S}_2-\mathscr{E}_2\mathscr{S}_1\end{array}\right)
\end{displaymath}

~\\
\begin{displaymath}
\vec{\mathscr{S}}=(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}_3) =((S_1\cos\theta+ S_2\sin\theta) , (-S_1\sin\theta + S_2\cos\theta) , S_3)
\end{displaymath}

\begin{displaymath}
\vec{\mathscr{E}}=(\mathscr{E}_1, \mathscr{E}_2, \mathscr{E}_3) =((E_1\cos\theta+ E_2\sin\theta) , (-E_1\sin\theta + E_2\cos\theta) , E_3)
\end{displaymath}

\begin{displaymath}
\vec{E}=(E_1, E_2, E_3) = (0, -0.398, 0.917)
\end{displaymath}


\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GEO to GSEQ transformation
%------------------------------------------------------------------------


\section{GEO to GSEQ transformation}
\label{sect:geo to gseq transformation}

%	Geographic						Geocentric Solar Equatorial

\begin{figure}[!h]
\begin{center}
\begin{tabular}{lc}
\emph{\textbf{Geographic}} & \emph{\textbf{Geocentric Solar Equatorial}}\\
~\\
\includegraphics[height=4.5 cm]{./FIGURES/Coordinate_system_GEO.eps} &
\includegraphics[height=3.8 cm]{./FIGURES/Coordinate_system_GSEQ.eps}
\end{tabular}
\end{center}
\end{figure}

In GEO system, the direction of the X-axis of GSEQ system is the direction of the sun  $\vec{\mathscr{S}}$, 
which can be computed from GEI to GEO transformation given in \S \ref{sect:gei to geo transformation}; then we have:

\begin{displaymath}
\vec{x}=\vec{\mathscr{S}}=(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}_3) =
((S_1\cos\theta+ S_2\sin\theta) , (-S_1\sin\theta + S_2\cos\theta) , S_3)
\end{displaymath}

$\vec{S}$ is the direction of the Sun in GEI system, computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine, 
such as the Greenwich Mean Sideral Time $\theta$\\

The Sun equator plane is defined from the direction of the rotation axis of the SUN which is in GEI system 
a known constant value:

\begin{displaymath}
\vec{R}=(R_1, R_2, R_3) = (0.122, -0.424, 0.899)
\end{displaymath}

from GEI to GEO transformation we obtain this vector in GEO system as:

\begin{displaymath}
\vec{\mathscr{R}}=(\mathscr{R}_1, \mathscr{R}_2, \mathscr{R}_3) =((R_1\cos\theta + R_2\sin\theta) , (-R_1\sin\theta+ R_2\cos\theta) , R_3)
\end{displaymath}

Then the Y axis in GEO system can be deduced from:

\begin{displaymath}
\vec{y}= \displaystyle  \frac{\vec{\mathscr{R}}\times\vec{\mathscr{S}}}{|\vec{\mathscr{R}}\times\vec{\mathscr{S}}|}
\end{displaymath}

Normalizing factors in cross product occurs because $\vec{\mathscr{R}}$ and $\vec{\mathscr{S}}$ are not necessarily perpendicular.
Finally the third axis Z is computed from:
$\vec{z}= \vec{\mathscr{S}}\times\vec{y}$
and the GEO to GSEQ transformation is given by:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSEQ)} = 
\left(\begin{array}{ccc}
x_1 & x_2 & x_3 \\
y_1 & y_2 & y_3 \\
z_1 & z_2 & z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEO)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\~\\
Similarly the GSEQ to GEO transformation is given by:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
x_1 & y_1 & z_1 \\
x_2 & y_2 & z_2 \\
x_3 & y_3 & z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSEQ)}
\end{displaymath}
\end{boxedminipage}
\end{center}

\newpage
with respectively:  
 
 \begin{center}

$\begin{array}{llll}

\left( \begin{array}{c}
x_1 \\
x_2\\
x_3 \end{array}\right)_{(GEO)} & = 
\left(\begin{array}{c}
\mathscr{S}_1 \\
\mathscr{S}_2\\
\mathscr{S}_3
   \end{array}\right) \\ \\

~\\
\left( \begin{array}{c}
y_1 \\
y_2\\
y_3 \end{array}\right)_{(GEO)} & =     
 \displaystyle \frac{1}{Q} \cdot \left(\begin{array}{c}
\mathscr{R}_2\mathscr{S}_3-\mathscr{R}_3\mathscr{S}_2 \\
\mathscr{R}_3\mathscr{S}_1-\mathscr{R}_1\mathscr{S}_3\\
\mathscr{R}_1\mathscr{S}_2-\mathscr{R}_2\mathscr{S}_1
  \end{array}\right)\\ \\

~\\
\left( \begin{array}{c}
z_1 \\
z_2\\
z_3 \end{array}\right)_{(GEO)} & = 
\left(\begin{array}{c}
\mathscr{S}_2y_3-\mathscr{S}_3y_2 \\
\mathscr{S}_3y_1-\mathscr{S}_1y_3\\
\mathscr{S}_1y_2-\mathscr{S}_2y_1
 \end{array}\right) \\ \\
%\end{displaymath}

%\begin{displaymath}

\end{array}$
\end{center} 
 
 \begin{displaymath}
Q=[(\mathscr{R}_2\mathscr{S}_3-\mathscr{R}_3\mathscr{S}_2)^2 + (\mathscr{R}_3\mathscr{S}_1-\mathscr{R}_1\mathscr{S}_3)^2 + 
(\mathscr{R}_1\mathscr{S}_2-\mathscr{R}_2\mathscr{S}_1)^2]^{1/2}
\end{displaymath}

\begin{displaymath}
\vec{\mathscr{S}}=(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}_3) =((S_1\cos\theta + S_2\sin\theta) , 
(-S_1\sin\theta+ S_2\cos\theta) , S_3)
\end{displaymath}

\begin{displaymath}
\vec{\mathscr{R}}=(\mathscr{R}_1, \mathscr{R}_2, \mathscr{R}_3) =((R_1\cos\theta + R_2\sin\theta) , 
(-R_1\sin\theta + R_2\cos\theta) , R_3)
\end{displaymath}

\begin{displaymath}
\vec{R}=(R_1, R_2, R_3) = (0.122, -0.424, 0.899)
\end{displaymath}

\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GEO to VDH transformation
%------------------------------------------------------------------------


\section{GEO to VDH transformation}
\label{sect:geo to vdh transformation}

%	Geographic							VDH

\begin{figure}[!h]
\begin{center}
\begin{tabular}{ll}
\emph{\textbf{Geographic}} & ~~~~\emph{\textbf{VDH}}\\
~\\
\includegraphics[height=4.6 cm]{./FIGURES/Coordinate_system_GEO.eps} & ~~
\includegraphics[height=5.0 cm]{./FIGURES/Coordinate_system_VDH.eps}
\end{tabular}
\end{center}
\end{figure}

VDH system is a local coordinate system, and varies with the position of the point of observation relative to 
the centre of the Earth; this positions is noted in GEO system as:

\begin{displaymath}
\vec{R}=(R_1, R_2, R_3)
\end{displaymath}

and we have directly :  $\vec{V}= \displaystyle\frac{1}{(R_1^2 + R_2^2+ R_3^2)^{1/2}} \cdot \vec{R}$ \\ \\

Since $\vec{D}$ is perpendicular to $\vec{V}$ and to the rotation axis of the Earth, we have:

~\\
$\vec{D}= \displaystyle\frac{\vec{Z_E}\times\vec{R}}{|\vec{Z_E}\times\vec{R}|}$
~~~which give: ~~~ $\vec{D}=\left( \begin{array}{c}
- R_2 \\
\ \ R_1\\
\ \ 0 \end{array}\right)\cdot \displaystyle \frac{1}{(R_1^2+R_2^2)^{1/2}}$ \\ \\
 
The third axis  H is deduced from: $\vec{H}= \vec{V}\times\vec{D}$ 
~~~which give: ~~ $\vec{H} =  \frac{1}{Q} \cdot \left( 
 \begin{array}{c}
-R_1R_3 \\
-R_2R_3\\
 R_1^2+R_2^2 
\end{array}\right)$ 

~\\
with : $Q=[(R_1^2 + R_2^2)(R_1^2 + R_2^2+ R_3^2)]^{1/2}$ \\


All coordinates of X-Y-Z axis of VDH system in GEO coordinates being known, the transform matrix of any vector V is:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(VDH)} = 
\left(\begin{array}{ccc}
V_1 & V_2 & V_3 \\
D_1 & D_2 & D_3 \\
H_1 & H_2 & H_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEO)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\
 Similarly the transformation from system VDH to GEO is:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
V_1 & D_1 & H_1 \\
V_2 & D_2 & H_2 \\
V_3 & D_3 & H_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(VDH)}
\end{displaymath}
\end{boxedminipage}
\end{center}


\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GEO to DM transformation
%------------------------------------------------------------------------


\section{GEO to DM transformation}
\label{sect:geo to dm transformation}

%	Geographic						Dipole Meridian

\begin{figure}[!h]
\begin{center}
\begin{tabular}{ll}
\emph{\textbf{Geographic}} & ~~~~\emph{\textbf{Dipole Meridian}}\\
~\\
\includegraphics[height=4.8 cm]{./FIGURES/Coordinate_system_GEO.eps} & ~~~~
\includegraphics[height=4.5 cm]{./FIGURES/Coordinate_system_DM.eps}
\end{tabular}
\end{center}
\end{figure}

Dipole meridian system is a local coordinate system, and varies with the position of the point of observation 
relative to the centre of the Earth; this positions is noted in GEO system as:

\begin{displaymath}
\vec{R}=(R_1, R_2, R_3)
\end{displaymath}

To transform GEO coordinate to DM coordinates, we need the dipole position in GEO system which is 
the Z axis of DM system. The geographic coordinates of the dipole axis can be known, 
for instance for IGRF epoch 1965, as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude, thus:

\begin{displaymath}
\vec{Z} = \vec{D} = (D_1, D_2, D_3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

Practically, $\vec{D}$ is computed for a given time and year from \textbf{\textit{cp\_geo\_dipole\_dir}} subroutine.\\

We can deduce then the Y-axis  of DM system in GEO coordinates as:

\begin{displaymath}
\vec{Y}= \frac{\vec{D}\times\vec{R} }{|\vec{D}\times\vec{R}|}
\end{displaymath}

Normalizing factors occurs because $\vec{D}$ and $\vec{R}$ are not necessarily perpendicular and because 
$\vec{R}$ is not a unit vector.
The third axis  X is deduced from:	$\vec{X}= \vec{Y}\times\vec{D}$\\

All coordinates of X-Y-Z axis of DM system in GEO coordinates being known, 
the transform matrix of any vector $\vec{V}$ is:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(DM)} = 
\left(\begin{array}{ccc}
X_1 & X_2 & X_3 \\
Y_1 & Y_2 & Y_3 \\
D_1 & D_2 & D_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEO)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}


~\\~\\Similarly the transformation from system DM to GEO is:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
X_1 & Y_1 & D_1 \\
X_2 & Y_2 & D_2 \\
X_3 & Y_3 & D_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(DM)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

\newpage

with respectively:

\begin{displaymath}
\left( \begin{array}{c}
X_1 \\
X_2\\
X_3 \end{array}\right) = 
\left(\begin{array}{c}
Y_2D_3-Y_3D_2 \\
Y_3D_1-Y_1D_3\\
Y_1D_2-Y_2D_1 \end{array}\right)
\end{displaymath}

~\\
\begin{displaymath}
\left( \begin{array}{c}
Y_1 \\
Y_2\\
Y_3 \end{array}\right) =  1/Q \cdot 
\left(\begin{array}{c}
D_2R_3-D_3R_2 \\
D_3R_1-D_1R_3\\
D_1R_2-D_2R_1 \end{array}\right)
\end{displaymath}

~\\
\begin{displaymath}
Q = [(D_2R_3 - D_3R_2)^2 + (D_3R_1 - D_1R_3)^2 + (D_1R_2 - D_2R_1)^2 ]^{1/2}
\end{displaymath}


\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GSE to SM transformation
%------------------------------------------------------------------------

\section{GSE to SM~~transformation}
\label{sect:gse to sm transformation}


\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Ecliptic}} & \emph{\textbf{ Solar Magnetic}}\\
~\\
\includegraphics[height=3.5 cm]{./FIGURES/Coordinate_system_GSE.eps} &
\hspace{0.6cm}
\includegraphics[height=3.9 cm]{./FIGURES/Coordinate_system_SM.eps}
\end{tabular}
\end{center}
\end{figure}

The direct computation from GSE system to SM system is a little bit difficult. 

In fact, it is more easy to pass by the GSM intermediate system (see \S \ref{sect:Geocentric Solar Magnetospheric system}), 
because we have only the product of two rotation matrix: Indeed, in one hand GSE and GSM systems have 
their X-axis in common, so the only difference is a rotation around the X-axis of the angle~$\xi$ 
(see \S \ref{sect:gse to gsm transformation}). 
 
In a second hand, the GSM and SM system have the Y-axis in common, then the transformation matrix is a simple rotation of
$\mu$ angle, which is named the dipole tilt angle (see \ref{sect:gsm to sm transformation}).\\
 

So from \ref{sect:gse to gsm transformation} we have:
\vspace{-12pt}
\begin{center}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\xi & \sin\xi \\
0 & -\sin\xi & \cos\xi \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSE)}
\end{displaymath}
\end{center}

and from \ref{sect:gsm to sm transformation} we have:
\vspace{-12pt}
\begin{center}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
\cos\mu & 0 & -\sin\mu \\
0 & 1 & 0 \\
\sin\mu & 0 & \cos\mu \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath}
\end{center}

~\\~\\Thus the transformation from GSE to SM is: 

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{11.5 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
\cos\mu  & ~~\sin\mu\sin\xi & -\sin\mu\cos\xi \\
0        & ~~\cos\xi        & ~~\sin\xi \\
\sin\mu  & -\cos\mu\sin\xi  & ~~\cos\mu\cos\xi \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath}
\end{boxedminipage}
\end{center}
~\\~\\
The inverse transformation being: 

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{11.5 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
 \cos\mu        & 0         & \sin\mu \\
 \sin\mu\sin\xi & \cos\xi   & -\cos\mu\sin\xi \\
-\sin\mu\cos\xi & ~~\sin\xi & ~~\cos\mu\cos\xi 
\end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath}
\end{boxedminipage}
\end{center}


\newpage
\textbf{\underline{Reminder}}

~\\ 
The $\mu$ angle is computed in section  \ref{sect:gsm to sm transformation}:\\

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{6.5 cm}\vspace{-8pt}
\begin{eqnarray*}
  \sin\mu  & = & \mathscr{S}_1D_1 + \mathscr{S}_2D_2 + \mathscr{S}_3D_3 \\
  \cos\mu  & = & (1 - \sin^2\mu)^{1/2}
\end{eqnarray*}  
\end{boxedminipage}\\
\end{center}


where $\vec{\mathscr{S}}$ is the direction of the sun and $\vec{D}$ the dipole direction, both in GEO system.\\

Vector $\vec{\mathscr{S}}$ can be computed from GEI to GEO transformation given in \S \ref{sect:gei to geo transformation}; 
then we have:
\begin{displaymath}
\vec{\mathscr{S}}=(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}_3) =(S_1\cos\theta+ S_2\sin\theta, -S_1\sin\theta+ S_2\cos\theta, S_3)
\end{displaymath}

where $\vec{S}$ is the direction of the Sun in GEI system, computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine, 
such as the Greenwich Mean Sideral Time $\theta$.\\


Vector $\vec{D}$ is obtained from the International Geomagnetic Reference Field (IGRF); practically, $\vec{D}$ 
is computed for a given time and year from \textbf{\textit{cp\_geo\_dipole\_dir}} subroutine; value for 1965.0 is
$\vec{D}=(D_1, D_2, D_3)=(0.06859,-0.18602, 0.98015)$

~\\




\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GSE to GSM transformation
%------------------------------------------------------------------------

\section{GSE to GSM transformation}
\label{sect:gse to gsm transformation}

%Geocentric Solar Ecliptic		Geocentric Solar Magnetospheric

\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Ecliptic}} & \emph{\textbf{Geocentric Solar Magnetospheric}}\\
\includegraphics[height=3.7 cm]{./FIGURES/Coordinate_system_GSE.eps} &
\includegraphics[height=3.9 cm]{./FIGURES/Coordinate_system_GSM.eps}
\end{tabular}
\end{center}
\end{figure}

GSE and GSM systems have their X-axis in common, so the only difference is a rotation around 
the X-axis of the angle $\xi$, thus the matrix transformation is: 
\medskip
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{10 cm}\vspace{-8pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\xi & \sin\xi \\
0 & -\sin\xi & \cos\xi \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSE)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}
 
~\\
The inverse transformation is obviously:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{10 cm}\vspace{-8pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\xi & -\sin\xi \\
0 & \sin\xi & \cos\xi \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}
 
~\\
 Nevertheless the $\xi$ angle cannot be obtained from a simple equation.
To compute the rotation terms of transformation matrix, we use the GSE to GEI and the GEI to GSM 
previous matrix transformations, given in  \S \ref{sect:gei to gse transformation} and \S \ref{sect:gei to gsm transformation}.

~\\
From  \S \ref{sect:gei to gse transformation} we have:
\vspace{-6pt}
\begin{flushleft}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
S_1 & S_2 & S_3 \\
{y_1} & {y_2} & {y_3} \\
E_1 & E_2 & E_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{flushleft}

~\\
 Where $\vec{S}$ is the direction of the Sun and $\vec{E}$ the direction of ecliptic pole in GEI system, and last
  $\vec{y} = (\vec{E} \times \vec{S})$ still in GEI system.
 Note that we changed the notation $\vec{Y}$ by $\vec{y}$ to avoid confusion with the next $\vec{Y}$ vector.
 
 ~\\
 From \S \ref{sect:gei to gsm transformation} we have:
\vspace{-6pt}
\begin{flushleft}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
S_1 & Y_1 & Z_1 \\
S_2 & Y_2 & Z_2 \\
S_3 & Y_3 & Z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath}
\end{flushleft} 

~\\~\\
Where we have this time in GEI system~~  
$\vec{Y} = (\vec{M} \times \vec{S})/|(\vec{M} \times \vec{S})|$ ~~~ and ~~$\vec{Z} = (\vec{S} \times \vec{Y})$ ,
$\vec{M}$ being the direction of dipole axis.

\newpage
So we can write the GSM to GSE transformation as: 
  
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
S_1 & S_2 & S_3 \\
y_1 & y_2 & y_3 \\
E_1 & E_2 & E_3 \end{array}\right)
\left(\begin{array}{ccc}
S_1 & Y_1 & Z_1 \\
S_2 & Y_2 & Z_2 \\
S_3 & Y_3 & Z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath}

~\\~\\
 which give :

\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
S\cdot S & S\cdot Y & S\cdot Z \\
y\cdot S & y\cdot Y & y\cdot Z \\
E\cdot S & E\cdot Y & E\cdot Z \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath} \\

which becomes, since $\vec{S}$ and $\vec{Y}$ are unit vectors perpendicular between us, as $\vec{S}$ and $\vec{Z}$: \\


\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & y\cdot Y & y\cdot Z \\
0 & E\cdot Y & E\cdot Z \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath} \\

Of course the final matrix does not depend on the $\vec{S}$ vector.

~\\~\\

\textbf{\underline{Computation of  cos \scalebox{1.3}{$\xi$:}}}
~\\
~\\
We have to equalize  $\vec{y}\cdot\vec{Y}$ and $\vec{E}\cdot\vec{Z}$ terms as $\cos \xi$ \\
\begin{flushleft}
\begin{tabular}{ll}
Taking &	$\vec{y}\cdot\vec{Y}=( \vec{E} \times \vec{S})\cdot( \vec{M}\times\vec{S} )/|(\vec{M} \times \vec{S})|$\\ \\
we compute &$\vec{E}\cdot\vec{Z}= \vec{E}\cdot( \vec{S}\times\vec{Y})=
\vec{E}\cdot[( \vec{S}\times (\vec{M}\times\vec{S})/|(\vec{M} \times \vec{S})|]$\\ \\
since &	$\vec{A}\cdot( \vec{B}\times\vec{C})=(\vec{A} \times \vec{B})\cdot\vec{C}$\\ \\
we effectively found & $\vec{E}\cdot\vec{Z}= 
( \vec{E}\times\vec{S})\cdot( \vec{M}\times\vec{S})/|(\vec{M} \times \vec{S})|= \vec{y}\cdot\vec{Y}$\\ \\
then: & $\vec{y}\cdot\vec{Y} = \vec{E}\cdot\vec{Z} = \cos \xi$
\end{tabular}
\end{flushleft}
 
By replacing the corresponding values, we set~~ 
$\cos \xi =( \vec{E} \times \vec{S})\cdot \displaystyle \frac{\vec{M}\times \vec{S}} {| \vec{M}\times\vec{S}|}$


\begin{flushleft}
\begin{tabular}{ll}
since &	$\vec{A}\cdot( \vec{B}\times\vec{C})=(\vec{A}\times\vec{B})\cdot \vec{C}$\\ \\
we found & $\cos\xi = 
- \displaystyle ( \vec{E}\times \vec{S}) \cdot \frac{\vec{S}\times \vec{M}} {| \vec{M}\times\vec{S}|}
=
- \displaystyle\frac{( \vec{E}\times \vec{S}) \times \vec{S}}{|\vec{M} \times  \vec{S}|} \cdot \vec{M}$ \\ \\
\end{tabular}
\end{flushleft} 
 
and finally :
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{4 cm}\vspace{-7pt}
\begin{displaymath}
\cos \xi=  \displaystyle \frac{\vec{E}\cdot\vec{M}}{| \vec{M}\times\vec{S}|}\\
\end{displaymath}
\end{boxedminipage}
\end{center}
 
\newpage
Note that in this formula  $\vec{E}$ and $\vec{M}$ are known since:	\\ \\

1) the direction of ecliptic pole in GEI system is a known constant value:\\

\begin{center}
$\vec{E}=(E_1, E_2, E_3) = (0, -0.398, 0.917)$
\end{center}

 2)  $\vec{M}$ is the dipole direction in GEI system, computed \S \ref{sect:gei to gsm transformation} as:\\ 

\begin{center}
$\vec{M}=(M_1, M_2, M_3) =(D_1\cos\theta- D_2\sin\theta, D_1\sin\theta + D_2\cos\theta, D_3)$
\end{center}

 3) the geographic coordinates of the dipole axis $\vec{D}$ is computed for a given time and year from
 \textbf{\textit{cp\_geo\_dipole\_dir}} subroutine; 
for instance for IGRF epoch 1965 we have:\\ 

\begin{center}
$\vec{D}=(D_1, D_2, D_3)=(0.06859,-0.18602, 0.98015)$
\end{center}

4)  the $\theta$ Greenwich Mean Sideral Time is computed for a given time and year from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine.
 \hspace*{\fill} \\
 
5) the normalisation term  $| \vec{M}\times\vec{S}|$ can be computed as:

\begin{center}
$Q=| \vec{M}\times\vec{S}|=\sqrt{(M_2S_3 - M_3S_2)^2 + (M_3S_1 - M_1S_3)^2 + (M_1S_2 - M_2S_1)^2}$
\end{center}


This leads to the formula:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{6 cm}\vspace{-8pt}
\begin{displaymath}
\cos\xi= (E_1M_1 + E_2M_2 + E_3M_3)/Q\vspace{1 mm}
\end{displaymath}
\end{boxedminipage}
\end{center}

~\\~\\
\textbf{\underline{Computation of  sin \scalebox{1.3}{$\xi$}}}
~\\~\\

Similarly one has to ensure that the  $\vec{E}\cdot\vec{Y}$ and $-\vec{y}\cdot\vec{Z}$ terms are equal.
\begin{flushleft}
\begin{tabular}{ll} 
Taking	& $\vec{y}\cdot\vec{Z}=( \vec{E}\times \vec{S})\cdot( \vec{S}\times \vec{Y} )$\\ \\
since	& $\vec{A}\cdot( \vec{B}\times\vec{C})=(\vec{A}\times \vec{B})\cdot\vec{C}$\\ \\
we have & $\vec{y}\cdot\vec{Z}= [( \vec{E}\times\vec{S}) \times  \vec{S}]\cdot\vec{Y}$\\ \\
and find: & $\vec{y}\cdot\vec{Z} = -\vec{E}\cdot\vec{Y} = -\sin\xi$ \\ \\ 
\end{tabular}
\end{flushleft}
 
Similarly computation of $\sin \xi$ is made as: $\sin\xi= \vec{E}\cdot\vec{Y}$  \\
 
thus : 
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{4 cm}\vspace{-7pt}
\begin{displaymath}
\sin\xi= \vec{E}\cdot \displaystyle \frac{\vec{M}\times \vec{S}} {| \vec{M}\times\vec{S}|}
\end{displaymath} 
\end{boxedminipage}
\end{center}

The expended formula gives:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{12.5 cm}\vspace{-7pt}
\begin{displaymath}
\sin\xi= \text{{\Large [}}~(E_1(M_2S_3 - M_3S_2) + E_2(M_3S_1 - M_1S_3) + E_3(M_1S_2 - M_2S_1)~\text{{\Large ]}}/Q
\end{displaymath} 
\end{boxedminipage}
\end{center}


\newpage 
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GSE to TPN transformation
%------------------------------------------------------------------------

\section{GSE to TPN transformation}
\label{sect:gse to tpn transformation}


\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Ecliptic}} & \emph{\textbf{Tangent Parabole Normal}}\\
~\\
\includegraphics[height=3.5 cm]{./FIGURES/Coordinate_system_GSE.eps} &
\includegraphics[height=5.5 cm]{./FIGURES/Coordinate_system_TPN_a.eps}
\end{tabular}
\end{center}
\end{figure}

TPN system is défined by a paraboloid aroud the X axis toward the Sun, and passing by a given point \textbf{M} $x_0, y_0, z_0$.
Let's consider a plane (X',Y') containing the \textbf{M} point where X' is the X axis of GSE system.
In this plane, the parabol equation is:
\begin{center} 
$y'^2 = 2p(Sx-x')$ 
\end{center}

\vspace{0.4cm}
\underline{\it{Computation of the $\vec{T},\vec{P},\vec{N} $ vectors in GSE system }} \\

From parabol knowed properties (see http://homeomath2.imingo.net/parabol5.htm or other math book)
the $[x_0$-N] distance is the $p$ parameter, which, from the equation'parabol passing by the given point, is: 
\begin{center}
$p=\dfrac{1}{2} \dfrac{(y_0^2 + z_0^2)}{(S_x -x_0)}$ 
\end{center}

So in the (X',Y',Z') system, the coordinates of the nonstandard (not normalisez) $\vec{N}$ vector is:

  
\begin{displaymath}
\left( \begin{array}{c}
\widetilde{N}_x \\
\widetilde{N}_y\\
\widetilde{N}_z \end{array}\right)_{(X'Y'Z')} = 
\left(\begin{array}{c}
p \\
y'_0 \\
0 \end{array}\right)
\end{displaymath}
~\\
Another knowed propertie is that the submit S is the middle of the $[T'-x_0]$ segment. 
So we have directly the coordinate of the nonstandard $\vec{T}$ vector:

  
\begin{displaymath}
\left( \begin{array}{c}
\widetilde{T}_x \\
\widetilde{T}_y\\
\widetilde{T}_z \end{array}\right)_{(X'Y'Z')} = 
\left(\begin{array}{c}
2(Sx-x_0) \\
-y'_0 \\
0 \end{array}\right)
\end{displaymath}

~\\

To get the tranformation between X'Y'Z' system and GSE system, we use the fact that GSE system 
is deduced from X'Y'Z' by a rotation around the X axis (see fig. \ref{rot_around_x}):
\newpage

\begin{figure}[!h]
\begin{center}
\includegraphics[height=5.5 cm]{./FIGURES/Coordinate_system_TPN_b.eps}
\caption{X'Y'Z' and GSE system are different by a rotation around X}
\label{rot_around_x}
\end{center}
\end{figure}


Thus the transformation from $X'Y'Z'$ coordinates to $GSE$ coordinates is:
\vspace{-0.4cm}
\begin{center}
%\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\theta & \sin\theta \\
0 & \sin\theta & -\cos\theta \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(X'Y'Z')}
\end{displaymath}
%\end{boxedminipage}\\
\end{center}

\begin{flushright}
with $cos(\theta)=\dfrac{y_0}{\sqrt{(y_0^2 + z_0^2)}}$ \hspace{0.5 cm}
and  $sin(\theta)=\dfrac{z_0}{\sqrt{(y_0^2 + z_0^2)}}$
\end{flushright}

~\\ ~\\
So we have the nonstandard vectors : 
\vspace{-0.4cm}
\begin{center}
%\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
\widetilde{N}_x \\
\widetilde{N}_y\\
\widetilde{N}_z \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\theta & \sin\theta \\
0 & \sin\theta & -\cos\theta \end{array}\right)
\left(\begin{array}{c}
p \\
y'_0 \\
0 \end{array}\right)_{(X'Y'Z')} =
\left(\begin{array}{c}
p \\
y_o \\
z_o
\end{array}\right)
\end{displaymath}
%\end{boxedminipage}\\
%\end{center}

%\begin{center}
%\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
\widetilde{T_x} \\
\widetilde{T_y} \\
\widetilde{T_z} \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\theta & \sin\theta \\
0 & \sin\theta & -\cos\theta \end{array}\right)
\left(\begin{array}{c}
2(Sx-x_0) \\
-y'_0 \\
0 \end{array}\right)_{(X'Y'Z')} =
\left(\begin{array}{c}
 2(Sx-x_0) \\
-y_o \\
-z_o
\end{array}\right)
\end{displaymath}
%\end{boxedminipage}\\
\end{center}

~\\

After normalisation we get:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{10 cm}\vspace{-2pt}
\begin{displaymath}
\left( \begin{array}{c}
N_x \\
N_y \\
N_z \end{array}\right)_{(GSE)} = 
\dfrac{1}{p^2 +y^2_0 +z^2_0}
\left(\begin{array}{c}
p \\
y_o \\
z_o
\end{array}\right)
\end{displaymath}
%\end{boxedminipage}\\
%\end{center}

%\begin{center}
%\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
T_x \\
T_y \\
T_z \end{array}\right)_{(GSE)} = 
\dfrac{1}{4{(Sx-x_0)}^2 +y^2_0 +z^2_0}
\left(\begin{array}{c}
 2(Sx-x_0) \\
-y_o \\
-z_o
\end{array}\right)
\end{displaymath}
\end{boxedminipage}\\
\end{center}

\begin{flushright}
with $p=\dfrac{1}{2} \dfrac{(y_0^2 + z_0^2)}{(S_x -x_0)}$ 
\end{flushright}

\newpage
The $\vec{P}$ vector is obtained directly normalised by:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{12 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
P_x \\
P_y \\
P_z \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\theta & \sin\theta \\
0 & \sin\theta & -\cos\theta \end{array}\right)
\left(\begin{array}{c}
0 \\
0 \\
1 \end{array}\right)_{(X'Y'Z')} =
\left(\begin{array}{c}
0 \\
~~\sin\theta\\
-\cos\theta
\end{array}\right)
\end{displaymath}
\end{boxedminipage}\\
\end{center}

\begin{flushright}
with $cos(\theta)=\dfrac{y_0}{\sqrt{(y_0^2 + z_0^2)}}$ \hspace{0.5 cm}
and  $sin(\theta)=\dfrac{z_0}{\sqrt{(y_0^2 + z_0^2)}}$
\end{flushright}



\vspace{0.6cm}
\underline{\it{Transformation matrix from GSE to TPN}} \\

Knowing the coordinate of the $\vec{T},\vec{P},\vec{N} $ vectors in GSE system, we deduce at last the transformation matrix:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(TPN)} = 
\left(\begin{array}{ccc}
T_x & T_y & T_z \\
P_x & P_y & P_z \\
N_x & N_y & N_z \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSE)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\~\\
The inverse transformation (not really usefull) is obviously:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-2pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
T_x & P_x & N_x \\
T_y & P_y & N_y \\
T_z & P_z & N_z \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(TPN)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}


\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GSE to ISR2 transformation
%------------------------------------------------------------------------

\section{GSE to ISR2 transformation}
\label{sect:gse to isr2 transformation}


\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Ecliptic}} & \emph{\textbf{Inverse SR2}}\\
~\\
\includegraphics[height=3.5 cm]{./FIGURES/Coordinate_system_GSE.eps} &
\hspace{0.5cm}
\includegraphics[height=3.9 cm]{./FIGURES/Coordinate_system_ISR2.eps}
\end{tabular}
\end{center}
\end{figure}

The best way is to use the GSE to SR2 transformation (see next section \ref{sect:gse to sr2 transformation}), 
since the tranformation from SR2 to ISR2 is very simple.\\

From section \ref{sect:sr2 to isr2 transformation} we have:

\vspace{-16pt}
\begin{center}
%\begin{boxedminipage}[c]{9.5 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(SR2)} = 
\left(\begin{array}{ccc}
1 & ~~0 & ~~0 \\
0 & -1 & ~~0 \\
0 & ~~0 & -1 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(ISR2)}
\end{displaymath}
%\end{boxedminipage}
%\end{center} 

%\begin{center}
%\begin{boxedminipage}[c]{9.5 cm}
\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(ISR2)} = 
\left(\begin{array}{ccc}
1 & ~~0 & ~~0 \\
0 & -1 & ~~0 \\
0 & ~~0 & -1 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SR2)}
\end{displaymath}
%\end{boxedminipage}
\end{center} 

~\\From  section \ref{sect:gse to sr2 transformation} we have:

\vspace{-16pt}
\begin{center}
%\begin{boxedminipage}[c]{12 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{SR2} = 
\left(\begin{array}{ccc}
a(R_y^2+R_z^2) & -a(R_xR_y) & -aR_xR_z \\
0 & aR_z & -aR_y \\
R_x & R_y & R_z \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{GSE}
\end{displaymath}
%\end{boxedminipage}
\end{center}

\begin{center}
%\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{GSE} = 
\left(\begin{array}{ccc}
a(R_y^2+R_z^2) & 0 & R_x \\
-aR_xR_y & aR_z & R_y \\
-aR_xR_z & -aR_y & R_z \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
\end{displaymath}
%\end{boxedminipage}
\end{center}

where $\vec{R}$ vector is the spin axis (or Rotation axis) expressed in GSE coordinate system, 
and extracted from auxiliary data, and $~~a = \dfrac{1}{\sqrt{R_y^2+R_z^2}}$. \\

~\\So the GSE to ISR2 transformation is:\\

%\vspace{-16pt}
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{12 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{ISR2} = 
\left(\begin{array}{ccc}
a(R_y^2+R_z^2) & -a(R_xR_y) & -aR_xR_z \\
0 & -aR_z & aR_y \\
-R_x & -R_y & -R_z \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{GSE}
\end{displaymath}
\end{boxedminipage}
\end{center}

while the inverse transformation is of course:\\

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{GSE} = 
\left(\begin{array}{ccc}
a(R_y^2+R_z^2) & 0 & -R_x \\
-aR_xR_y & -aR_z & -R_y \\
-aR_xR_z & ~~aR_y & -R_z \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{ISR2}
\end{displaymath}
\end{boxedminipage}
\end{center}

~\\~\\Note that for CLUSTER, $\vec{R}$ is close to the $-Z_{GSE}$ axis, so if we set $\vec{R}=(0,0,-1)$
we can check that we found:

\vspace{-12pt}
\begin{center}
%\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{GSE} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{ISR2}
\end{displaymath}
%\end{boxedminipage}
\end{center}

~\\This is the main interest of the ISR2 system.

\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GSE to SR2 transformation
%------------------------------------------------------------------------

\section{GSE to SR2 transformation}
\label{sect:gse to sr2 transformation}

\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Ecliptic}} & \emph{\textbf{Spin Reference 2}}\\
~\\
\includegraphics[height=3.8 cm]{./FIGURES/Coordinate_system_GSE.eps} & ~~~~
\includegraphics[height=3.8 cm]{./FIGURES/Coordinate_system_SR2.eps} 
\end{tabular}
\end{center}
\end{figure}

The transformation of any vector expressed in GSE system into the SR2 system can be written as:
\hspace{-2mm}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{SR2} = 
\left(\begin{array}{ccc}
X_1 & X_2 & X_3 \\
Y_1 & Y_2 & Y_3 \\
Z_1 & Z_2 & Z_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{GSE}
\end{displaymath}

~\\
where $(X_1, X_2, X_3)$ are the components of the $\vec{X}$ axis of the SR2 system expressed in GSE coordinates, 
and in the same way for $\vec{Y}$ and $\vec{Z}$ axis.\\

In SR2 system, $\vec{Z}$ is the rotation axis of the spacecraft, and must be known in GSE system from auxiliary data 
of the Spacecraft. We can write it as:


\begin{displaymath}
\vec{Z}=\left( \begin{array}{c}
Z_1 \\
Z_2\\
Z_3 \end{array}\right)=\vec{R}=\left( \begin{array}{c}
R_x \\
R_y\\
R_z \end{array}\right)_{GSE}
\end{displaymath}


The components of the Y axis can be found by the relation $\vec{Y} =
\displaystyle \frac{\vec{R}\times\vec{S}}{| \vec{R}\times\vec{S} |}$ which is very simple since the direction of the Sun 
$\vec{S}$ is the X axis of GSE system, expressed as (1,0,0). So we deduce:

\vspace{-4mm}
\begin{displaymath}
\vec{Y} = \displaystyle\frac{1}{\sqrt{R_y^2+R_z^2}}\left( \begin{array}{c}
0 \\
R_z\\
-R_y \end{array}\right)_{GSE}
\end{displaymath}

\bigskip
Finally we complete the system by computing $\vec{X} = \vec{Y}\times\vec{Z}$, so:


\begin{displaymath}
\vec{X}=a\left( \begin{array}{c}
R_y^2+R_z^2 \\
-R_xR_y\\
-R_xR_z \end{array}\right)_{GSE}\textrm{~~~ with } ~~a = \frac{1}{\sqrt{R_y^2+R_z^2}}
\end{displaymath}


~\\~\\
Thus, the transformation of GSE coordinate into SR2 coordinates can be written as:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{12 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{SR2} = 
\left(\begin{array}{ccc}
a(R_y^2+R_z^2) & -a(R_xR_y) & -aR_xR_z \\
0 & aR_z & -aR_y \\
R_x & R_y & R_z \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{GSE}
\end{displaymath}
\end{boxedminipage}
\end{center}

\newpage where $\vec{R}$ vector is the spin axis (or Rotation axis) expressed in GSE coordinate system, 
and extracted from auxiliary data. \\
~\\
Note that the reverse transform is simply:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{GSE} = 
\left(\begin{array}{ccc}
a(R_y^2+R_z^2) & 0 & R_x \\
-aR_xR_y & aR_z & R_y \\
-aR_xR_z & _aR_y & R_z \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
\end{displaymath}
\end{boxedminipage}
\end{center}




\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GSE to MFA transformation
%------------------------------------------------------------------------

\section{GSE to MFA transformation}
\label{sect:gse to mfa transformation}


\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Ecliptic}} & \emph{\textbf{Magnetic Field Aligned}}\\
~\\
\includegraphics[height=3.7 cm]{./FIGURES/Coordinate_system_GSE.eps} &
\hspace{0.5cm}
\includegraphics[height=3.9 cm]{./FIGURES/Coordinate_system_MFA.eps}
\end{tabular}
\end{center}
\end{figure}


\vspace{-10pt}
The Magnetic Field Aligned system is defined as a system where Z is along the DC magnetic field, 
noted as Bo, and X in the plane containing the DC magnetic field vector and the direction of the Sun. 
A problem of definition can appear when the DC-MF is aligned with the direction of the Sun, which is not an unlikely case. 
When this situation arrives, the direction of the normal to the ecliptic plane could be used instead of the direction of the Sun, but is is not still the case in this version.\\

The GSE to MAG transformation requires the coordinates of the $\vec{B}$ vector in GSE system.
To obtain the alignment of Z with Bo, we apply two rotations. 

~\\
{\textbf{\underline{The first rotation}}, in the x-y plane of GSE system, 
align the x axis with the perpendicular component of Bo in the x-y plane:
~\\~\\
\begin{tabular}{cc}
\parbox[c]{5.5 cm}
{\includegraphics[height=3.8 cm]{./FIGURES/SR2_MFA_first_rotation.eps}} & 
$
\left( \begin{array}{c}
X' \\
Y'\\
Z' \end{array}\right) = 
\left(\begin{array}{ccc}
~~\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{GSE}
$\\
\end{tabular}

~\\~\\The values of $\sin\varphi$ and $\cos\varphi$ are simply:

\begin{center}
$\sin\varphi=\dfrac{B_y}{\sqrt{B^2_x +B^2_y}}$  ~~~~~~ $\cos\varphi=\dfrac{B_x}{\sqrt{B^2_x +B^2_y}}$
\end{center}
~\\~\\
{\textbf{\underline{The second rotation}}, in the x'-z' plane, leads the new z axis to be aligned with Bo: \\
~\\
\begin{tabular}{cc}
\parbox[c]{5.5 cm}
{\includegraphics[height=3.8 cm]{./FIGURES/SR2_MFA_second_rotation.eps}} &  
$
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MAG} = 
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & ~~\cos\theta \end{array}\right)
\left(\begin{array}{c}
X' \\
Y' \\
Z' \end{array}\right)
$
\end{tabular}

The values of $\sin\theta$ and $\cos\theta$ are simply:\\

\begin{center}
$\sin\theta=\dfrac{\sqrt{B^2_x +B^2_y}}{\sqrt{B^2_x +B^2_y +B^2_z}}$ ~~~~~~ 
$\cos\theta=\dfrac{B_z}{\sqrt{B^2_x +B^2_y +B^2_z}}$
\end{center}

~\\and the transformation from GSE to a new MAG is given by:

\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MAG} = 
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & \cos\theta \end{array}\right)
\left(\begin{array}{ccc}
~~\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
\end{displaymath}

So:

\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MAG} = 
\left(\begin{array}{ccc}
\cos\theta\cos\varphi & \cos\theta\sin\varphi & -\sin\theta \\
-\sin\varphi & \cos\varphi & 0 \\
\sin\theta\cos\varphi & \sin\theta\sin\varphi & ~~\cos\theta \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{GSE}
\end{displaymath}


~\\~\\
At this level, the Z axis of new MAG system is aligned with the Bo DC local magnetic field, 
but the MAG system is still not the MFA system, because the MFA system is defined as having the X in the plane 
containing the DC magnetic field vector and the direction of the Sun. So we must apply a third rotation to pass 
from the MAG system to the MFA system.

~\\
{\textbf{\underline{The third rotation}} in the x-y plane depends of the direction of the Sun in the MAG system, 
defined by its spherical angles $\eta$  and $\psi$  :


\begin{figure}[!h]
\begin{center}
\includegraphics[height=4.5 cm]{./FIGURES/MAG_system.eps}
\end{center}
\end{figure}

and  we pass from the MAG system to the MFA system  by a rotation of $\psi$ angle around the Z axis:

\begin{tabular}{cc}
\parbox[c]{5.9  cm}
{\includegraphics[height=3.8 cm]{./FIGURES/SR2_MFA_third_rotation.eps}} & 
$
\!\left( \!\begin{array}{c}
X \\
Y\\
Z \end{array}\!\right)_{\!\!\mathit{MFA}}\!\!\!= 
\left(\begin{array}{ccc}
~~\cos\psi & \sin\psi & 0 \\
-\sin\psi & \cos\psi & 0 \\
0 & 0 & 1 \end{array}\!\right)\!
\!\left(\!\begin{array}{c}
X \\
Y \\
Z \end{array}\!\right)_{\!\!\mathit{MAG}}\!
$
\end{tabular}

~\\~\\
The $\psi$ angle is the azimuthal angle of the direction of the Sun in MAG system. In fact, it is easy to compute, 
since in the GSE system the direction of the Sun is $(1,0,0)$.

\newpage
So, the direction of the Sun in the MAG system is:

\begin{displaymath}
 \vec{S_M} = 
\left(\begin{array}{ccc}
\cos\theta\cos\varphi & \cos\theta\sin\varphi & -\sin\theta \\
-\sin\varphi & \cos\varphi & 0 \\
\sin\theta\cos\varphi & \sin\theta\sin\varphi & ~~\cos\theta \end{array}\right)
\left(\begin{array}{c}
1 \\
0 \\
0 \end{array}\right)_{GSE}
=
\left(\begin{array}{c}
\cos\theta\cos\varphi \\
-\sin\theta \\
\sin\theta\cos\varphi \end{array}\right)
\end{displaymath}

~\\~\\and we have:
\vspace{-8mm}
\begin{center}
%\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\sin\psi = \frac{Sy_M}{\sqrt{Sx_M^2+Sy_M^2}}~~~~~~~~~~~~~ \cos\psi = \frac{Sx_M}{\sqrt{Sx_M^2+Sy_M^2}}
\end{displaymath}
%\end{boxedminipage}\\
\end{center}


~\\~\\So, the total transformation from GSE system to MFA system is:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{small}
\begin{boxedminipage}[c]{15 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{\mathit{MFA}} = 
\left(\begin{array}{ccc}
~~\cos\psi & \sin\psi & 0 \\
-\sin\psi & \cos\psi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & ~~\cos\theta \end{array}\right)
\left(\begin{array}{ccc}
~~\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{\mathit{GSE}}
\smallskip
\end{displaymath}
\end{boxedminipage}\\
\end{small}
\end{center}

~\\~\\This formula can be expanded as:

\begin{center}
\begin{small}
%\begin{boxedminipage}[c]{15 cm}
\vspace{-12pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MFA} = 
\left(\begin{array}{ccc}
~~\cos\psi & \sin\psi & 0 \\
-\sin\psi & \cos\psi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(
\begin{array}{ccc}
\cos\theta\cos\varphi & \cos\theta\sin\varphi & -\sin\theta \\
-\sin\varphi & \cos\varphi & 0 \\
\sin\theta\cos\varphi & \sin\theta\sin\varphi & ~~\cos\theta \end{array}
\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{GSE}
\end{displaymath}
%\end{boxedminipage}\\
\end{small}
\end{center}

~\\~\\and finally:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{small}
\begin{boxedminipage}[c]{15 cm}\vspace{-5pt}
\begin{displaymath}
\!\!\left(\!\! \begin{array}{c}
\!X \\
\!Y \\
\!Z \end{array}\!\!\right)_{\!\!\mathit{MFA}}\!\!\!= 
\!\!\!\left(\!
\begin{array}{ccc}
~~\cos\psi\cos\theta\cos\varphi - \sin\psi\sin\varphi & ~~\cos\psi\cos\theta\sin\varphi + \sin\psi\cos\varphi &  -\cos\psi\sin\theta \\
 -\sin\psi\cos\theta\cos\varphi - \cos\psi\sin\varphi &  -\sin\psi\cos\theta\sin\varphi + \cos\psi\cos\varphi & ~~\sin\psi\sin\theta\\
~~\sin\theta\cos\varphi & \sin\theta\sin\varphi & ~~\cos\theta \end{array}
\!\right)\!
\!\left(\!\begin{array}{c}
\!X \\
\!Y \\
\!Z \end{array}\!\!\right)_{\!\!\mathit{GSE}}\!
\smallskip
\end{displaymath} 
\end{boxedminipage}
\end{small}
\end{center}


\newpage

%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GSE to GSEQ transformation
%------------------------------------------------------------------------

\section{GSE to GSEQ transformation}
\label{sect:gse to gseq transformation}

%Geocentric Solar Ecliptic       Geocentric Solar Equatorial

\begin{figure}[!h]
\begin{center}
\begin{tabular}{lc}
\emph{\textbf{Geocentric Solar Ecliptic}} & \emph{\textbf{Geocentric Solar Equatorial}}\\
~\\
\includegraphics[height=3.6 cm]{./FIGURES/Coordinate_system_GSE.eps} &
\includegraphics[height=3.2 cm]{./FIGURES/Coordinate_system_GSEQ.eps}
\end{tabular}
\end{center}
\end{figure}

The only difference  between  GSE and GSEQ  systems   is a rotation  about the common  X-axis, 
to have the Y-GSEQ axis parallel to the Sun equator plane.\\

So, if $\theta$ is the rotation angle, the transformation matrix of any vector $\vec{V}$ is:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSEQ)} = 
\left(\begin{array}{ccc}
1 & 0 & ~~0 \\
0 & \cos\theta & -\sin\theta \\
0 & \sin\theta & ~~\cos\theta \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSE)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\~\\
 The inverse transformation is obviously:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
1 & ~~0 & 0 \\
0 & ~~\cos\theta & \sin\theta \\
0 & -\sin\theta & \cos\theta \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSEQ)}
\end{displaymath}
\end{boxedminipage}\\
\end{center} 
~\\
\underline{computation of \scalebox{1.3}{$\theta$} angle:}
~\\~\\
$\theta$ is the ($\vec{Y}_{GSE},\vec{Y}_{GSEQ}$) angle, so $\sin\theta  = |\vec{Y}_{GSE}\times\vec{Y}_{GSEQ}|$ \\

To compute  $\theta$, we use the following known vectors in GEI system: \\

1) the direction $\vec{S}$ of the SUN , computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine:
\begin{displaymath}
\vec{S}=(S_1, S_2, S_3)
\end{displaymath} \\
2) the direction of ecliptic pole, which is a known constant value:
\begin{displaymath}
\vec{E}=(E_1, E_2, E_3) = (0, -0.398, 0.917)
\end{displaymath} \\
3) the direction of the rotation axis of the Sun, which is also a constant value:
\begin{displaymath}
	\vec{R}= (R_1, R_2, R_3) = (0.122, -0.424, 0.899)
\end{displaymath} \\


To compute $\sin\theta  = |\vec{Y}_{GSE}\times\vec{Y}_{GSEQ}|$   we use the following properties:

\begin{displaymath}
\vec{Y}_{GSE} = \vec{Z}_{GSE}\times \vec{X}_{GSE} = \vec{E}\times \vec{S}
\end{displaymath}

and since $\vec{R}$ is in the X-Z plane in the GSEQ system:
\begin{displaymath}
\vec{Y}_{GSEQ} = (\vec{R}\times \vec{S})/|\vec{R} \times \vec{S}|
\end{displaymath}

so we have  $\sin\theta= | ( \vec{E} \times \vec{S}) \times  ( \vec{R} \times  \vec{S }) | / |\vec{R} \times  \vec{S}|$\\

since	$( \vec{A} \times \vec{B}) \times  ( \vec{C} \times  \vec{D} ) = (\vec{A} \times  \vec{B}\cdot \vec{D})\vec{C} - (\vec{A} \times  \vec{B}\cdot \vec{C})\vec{D}$\\

and	$( \vec{A} \times \vec{B}) \cdot \vec{C}  = (\vec{A}\cdot \vec{B}) \times \vec{C}$\\

thus $( \vec{E} \times  \vec{S}) \times  ( \vec{R} \times  \vec{S} ) = (\vec{E} \times  \vec{S}\cdot \vec{S})\vec{R} - (\vec{E} \times  \vec{S}\cdot \vec{R})\vec{S} = (\vec{R} \times  \vec{E}\cdot \vec{S})\vec{S}$\\

and finally, as $\vec{S}$ is a unit vector: \\

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{5 cm}\vspace{-6pt}
\begin{displaymath}
\sin \theta= (\vec{R} \times  \vec{E})\cdot \displaystyle\frac{\vec{S}}{|\vec{R} \times  \vec{S}|}
\end{displaymath}
\end{boxedminipage}
\end{center}

~\\~\\
For numerical applications, expression  $\sin\theta= (\vec{R} \times  \vec{E}) \cdot \displaystyle \frac{ \vec{S} } 
{ |\vec{R} \times  \vec{S}|}$
can be extended as: \\

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{11.5 cm}\vspace{-6pt}
\begin{displaymath}
\sin\theta = \displaystyle \frac {[(R_2E_3-R_3E_2)S_1 + (R_3E_1-R_1E_3)S_2 + (R_1E_2-R_2E_1)S_3 ]}{[(R_2S_3-R_3S_2)^2  + (R_3S_1-R_1S_3)^2  + (R_1S_2-R_2S_1)^2  ]^{1/2}} 
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\~\\
 with numerical values above, this becomes:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{7 cm}\vspace{-6pt}
\begin{displaymath}
\sin\theta=  \displaystyle \frac{(-0.031, -0.112, -0.049)\cdot \vec{S}}{ |(0.122, -0.424, 0.899) \cdot  \vec{S}|}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\~\\
 Since the Sun's spin axis is inclined 7.25$^\circ$ to the ecliptic, 
\underline{$\theta$ changes from -7.25 to 7.25} each year, from approximately December 5 to June 5.\\

The Sun's spin axis is directed most towards the Earth on approximately September 5 at which time 
the Earth reaches its northern most heliographic latitude. At this time $\theta=0$.




\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GSM to GSEQ transformation
%------------------------------------------------------------------------

\section{GSM to GSEQ transformation}
\label{sect:gsm to gseq transformation}


\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Magnetospheric}} & \emph{\textbf{Geocentric Solar Equatorial}}\\
~\\
\includegraphics[height=3.9 cm]{./FIGURES/Coordinate_system_GSM.eps} &
\includegraphics[height=3.6 cm]{./FIGURES/Coordinate_system_GSEQ.eps}
\end{tabular}
\end{center}
\end{figure}

The GSM and GSEQ systems have a common X axis, toward the Sun. The best way to compute GSM to GSEQ transformation is to use 
the GSM to GSE transformation, and then the GSE to GSEQ transformation.\\

GSE and GSM systems have their X-axis in common, so the only difference is a rotation around 
the X-axis of the angle $\xi$, and from section \ref{sect:gse to gsm transformation} we have:

\begin{center}
%\begin{boxedminipage}[c]{10 cm}
\vspace{-16pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{GSE} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\xi & -\sin\xi \\
0 & \sin\xi & ~~\cos\xi \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{GSM}
\end{displaymath}
%\end{boxedminipage}\\
\end{center}

In other hand, the only difference  between  GSE and GSEQ  systems is a rotation  about the common  X-axis, 
to have the Y-GSEQ axis parallel to the Sun equator plane.
So, if $\theta$ is the rotation angle, the transformation matrix computed in section \ref{sect:gse to gseq transformation} is:

\begin{center}
%\begin{boxedminipage}[c]{10 cm}
\vspace{-16pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{GSEQ} = 
\left(\begin{array}{ccc}
1 & 0 & ~~0 \\
0 & \cos\theta & -\sin\theta \\
0 & \sin\theta & ~~\cos\theta \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{GSE}
\end{displaymath}
%\end{boxedminipage}\\
\end{center}

So we get immediately the transformation from GSM to GSEQ by:

\begin{center}
%\begin{boxedminipage}[c]{10 cm}
\vspace{-16pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{GSM} = 
\left(\begin{array}{ccc}
1 & 0 & ~~0 \\
0 & \cos\theta & -\sin\theta \\
0 & \sin\theta & ~~\cos\theta \end{array}\right)
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\xi & -\sin\xi \\
0 & \sin\xi & ~~\cos\xi \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{GSEQ}
\end{displaymath}
%\end{boxedminipage}\\
\end{center}

~\\which gives:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{14 cm}
\vspace{-8pt}
\begin{displaymath}
\left( \begin{array}{c}
\!V_1\! \\
\!V_2\!\\
\!V_3\! \end{array}\right)_{GSEQ} = 
\!\left(\!\begin{array}{ccc}
1 & 0 & ~~0 \\
0 & \cos\theta\cos\xi - \sin\theta\sin\xi & -(\cos\theta\sin\xi - \sin\theta\cos\xi) \\
0 & \sin\theta\cos\xi + \cos\theta\sin\xi & - \sin\theta\sin\xi + \cos\theta\cos\xi 
\end{array}\right)
\!\left(\!\begin{array}{c}
\!V_1\! \\
\!V_2\! \\
\!V_3\! \end{array}\right)_{GSM}\vspace{2pt}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\or obviously:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{11. cm}
\vspace{-8pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{GSEQ} = 
\left(\begin{array}{ccc}
1 & 0 & ~~0 \\
0 & \cos(\theta + \xi) & - \sin(\theta + \xi) \\
0 & \sin(\theta + \xi) & ~~\cos(\theta + \xi) 
\end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{GSM}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\Values of $\theta$ and $\xi$ are given in section \ref{sect:gse to gseq transformation} and \ref{sect:gse to gsm transformation}

\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GSM to MAG transformation
%------------------------------------------------------------------------

\section{GSM to MAG transformation}
\label{sect:gsm to mag transformation}

\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Magnetospheric}} & \emph{\textbf{Magnetic Dipole}}\\
~\\
\includegraphics[height=3.7 cm]{./FIGURES/Coordinate_system_GSM.eps} &
\hspace{0.4cm}
\includegraphics[height=3.9 cm]{./FIGURES/Coordinate_system_MAG.eps}
\end{tabular}
\end{center}
\end{figure}

The best way to compute the GSM to MAG transformation is tu use the SM intermediate system. Indeed, the 
The GSM and SM system have the Y-axis in common, then the transformation matrix is a simple rotation of
$\mu$ angle, which is named the dipole tilt angle. This transformation is given in section \ref{sect:gsm to sm transformation}:

\begin{center}
%\begin{boxedminipage}[c]{9.5 cm}
\vspace{-16pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
\cos\mu & 0 & -\sin\mu \\
0 & 1 & 0 \\
\sin\mu & 0 & \cos\mu \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath}
%\end{boxedminipage}
\end{center}


~\\In other hand, the SM and MAG system have the Z-axis in common, then the transformation matrix is again a simple rotation of 
$\phi$ angle. This transformation is given in section \ref{sect:sm to mag transformation}:

\begin{center}
%\begin{boxedminipage}[c]{9.5 cm}
\vspace{-16pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
~~\cos\phi & \sin\phi & 0 \\
-\sin\phi & \cos\phi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SM)}
\end{displaymath}
%\end{boxedminipage}
\end{center} 

~\\ So we get immediately the GSM to MAG transformation by:

\begin{center}
%\begin{boxedminipage}[c]{9.5 cm}
\vspace{-16pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
~~\cos\phi & \sin\phi & 0 \\
-\sin\phi & \cos\phi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{ccc}
\cos\mu & 0 & -\sin\mu \\
0 & 1 & 0 \\
\sin\mu & 0 & \cos\mu \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SM)}
\end{displaymath}
%\end{boxedminipage}
\end{center} 

~\\which give:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{11.5 cm}
\vspace{-8pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{MAG} = 
\left(\begin{array}{ccc}
~~\cos\phi\cos\mu & \sin\phi &  -\cos\phi\sin\mu \\
 -\sin\phi\cos\mu & \cos\phi & ~~\sin\phi\sin\mu \\
~~\sin\mu         & 0        & ~~\cos\mu  \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{GSM}
\end{displaymath}
\end{boxedminipage}
\end{center} 

~\\and conversely:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{11.5 cm}
\vspace{-8pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{GSM} = 
\left(\begin{array}{ccc}
~~\cos\phi\cos\mu &  -\sin\phi\cos\mu & \sin\mu   \\
~~\sin\phi        & ~~\cos\phi        & ~~0 \\
 -\cos\phi\sin\mu & ~~\sin\phi\sin\mu & \cos\mu  
\end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{MAG}
\end{displaymath}
\end{boxedminipage}
\end{center} 

~\\Values of $\phi$ and $\mu$ are given in section \ref{sect:sm to mag transformation} and \ref{sect:gsm to sm transformation}.

\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GSM to SM transformation
%------------------------------------------------------------------------


\section{GSM to SM transformation}
\label{sect:gsm to sm transformation}

%Geocentric Solar Magnetospheric					Solar Magnetic

\begin{figure}[!h]
\begin{center}
\begin{tabular}{lc}
\emph{\textbf{Geocentric Solar Magnetospheric}} & \emph{\textbf{Solar Magnetic}}\\
~\\
\includegraphics[height=3.8 cm]{./FIGURES/Coordinate_system_GSE.eps} &
\includegraphics[height=4.1 cm]{./FIGURES/Coordinate_system_SM.eps}
\end{tabular}
\end{center}
\end{figure}

The GSM and SM system have the Y-axis in common, then the transformation matrix is a simple rotation of
$\mu$ angle, which is named the dipole tilt angle.\\

Thus the transformation matrix of any vector $\vec{V}$ is: 

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9.5 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
\cos\mu & 0 & -\sin\mu \\
0 & 1 & 0 \\
\sin\mu & 0 & \cos\mu \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath}
\end{boxedminipage}
\end{center}

~\\ and the inverse transformation is obviously:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9.5 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
\cos\mu & 0 & \sin\mu \\
0 & 1 & 0 \\
-\sin\mu & 0 & \cos\mu \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SM)}
\end{displaymath}
\end{boxedminipage}
\end{center} 

~\\ 
The angle $\mu$ can be obtained from $\sin\mu = \vec{\mathscr{S}}\cdot\vec{D}$, where $\vec{\mathscr{S}}$ 
is the direction of the sun and $\vec{D}$ the dipole direction, both in GEO system.\\

Vector $\vec{\mathscr{S}}$ can be computed from GEI to GEO transformation given in \S \ref{sect:gei to geo transformation}; 
then we have:
\begin{displaymath}
\vec{\mathscr{S}}=(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}_3) =(S_1\cos\theta+ S_2\sin\theta, -S_1\sin\theta+ S_2\cos\theta, S_3)
\end{displaymath}

where $\vec{S}$ is the direction of the Sun in GEI system, computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine, 
such as the Greenwich Mean Sideral Time $\theta$.\\


Vector $\vec{D}$ is obtained from the International Geomagnetic Reference Field (IGRF); practically, $\vec{D}$ 
is computed for a given time and year from \textbf{\textit{cp\_geo\_dipole\_dir}} subroutine; value for 1965.0 is
$\vec{D}=(D_1, D_2, D_3)=(0.06859,-0.18602, 0.98015)$

~\\
Finally, rotation matrix elements are:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{6.5 cm}\vspace{-8pt}
\begin{eqnarray*}
  \sin\mu  & = & \mathscr{S}_1D_1 + \mathscr{S}_2D_2 + \mathscr{S}_3D_3 \\
  \cos\mu  & = & (1 - \sin^2\mu)^{1/2}
\end{eqnarray*}  
\end{boxedminipage}\\
\end{center}



\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : GSM to TPN transformation
%------------------------------------------------------------------------

\section{GSM to TPN transformation}
\label{sect:gsm to tpn transformation}


\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Magnetospheric}} & \emph{\textbf{Tangent Paraboloid Normal}}\\
~\\
\includegraphics[height=4.0 cm]{./FIGURES/Coordinate_system_GSM.eps} &
\hspace{0.5cm}
\includegraphics[height=5.5 cm]{./FIGURES/Coordinate_system_TPN_a.eps}
\end{tabular}
\end{center}
\end{figure}

TPN system is défined by a paraboloid aroud the X axis toward the Sun, and passing by a given point \textbf{M} $(x_0, y_0, z_0)$.
The formulas below are the same that the GSE system, since GSM and GSE have the same X axis, 
which is the axe of revolution of the paraboloid.\\

So let's consider a plane (X',Y') containing the \textbf{M} point where X' is the X axis of GSM system.
In this plane, the parabol equation is:
\begin{center} 
$y'^2 = 2p(Sx-x')$ 
\end{center}

\vspace{0.4cm}
\underline{\it{Computation of the $\vec{T},\vec{P},\vec{N} $ vectors in GSM system }} \\

From parabol knowed properties (see http://homeomath2.imingo.net/parabol5.htm or other math book)
the $[x_0$-N] distance is the $p$ parameter, which, from the equation'parabol passing by the given point, is: 
\begin{center}
$p=\dfrac{1}{2} \dfrac{(y_0^2 + z_0^2)}{(S_x -x_0)}$ 
\end{center}

So in the (X',Y',Z') system, the coordinates of the nonstandard (not normalisez) $\vec{N}$ vector is:

  
\begin{displaymath}
\left( \begin{array}{c}
\widetilde{N}_x \\
\widetilde{N}_y\\
\widetilde{N}_z \end{array}\right)_{(X'Y'Z')} = 
\left(\begin{array}{c}
p \\
y'_0 \\
0 \end{array}\right)
\end{displaymath}
~\\
Another knowed propertie is that the submit S is the middle of the $[T'-x_0]$ segment. 
So we have directly the coordinate of the nonstandard $\vec{T}$ vector:

  
\begin{displaymath}
\left( \begin{array}{c}
\widetilde{T}_x \\
\widetilde{T}_y\\
\widetilde{T}_z \end{array}\right)_{(X'Y'Z')} = 
\left(\begin{array}{c}
2(Sx-x_0) \\
-y'_0 \\
0 \end{array}\right)
\end{displaymath}

~\\

To get the tranformation between X'Y'Z' system and GSM system, we use the fact that GSM system 
is deduced from X'Y'Z' by a rotation around the X axis (see fig. \ref{rot_around_x_GSM}):
\newpage

\begin{figure}[!h]
\begin{center}
\includegraphics[height=5.5 cm]{./FIGURES/Coordinate_system_TPN_b_gsm.eps}
\caption{X'Y'Z' and GSM system are different by a rotation around X}
\label{rot_around_x_GSM}
\end{center}
\end{figure}


Thus the transformation from $X'Y'Z'$ coordinates to $GSM$ coordinates is:
\vspace{-0.4cm}
\begin{center}
%\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\theta & \sin\theta \\
0 & \sin\theta & -\cos\theta \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(X'Y'Z')}
\end{displaymath}
%\end{boxedminipage}\\
\end{center}

\begin{flushright}
with $cos(\theta)=\dfrac{y_0}{\sqrt{(y_0^2 + z_0^2)}}$ \hspace{0.5 cm}
and  $sin(\theta)=\dfrac{z_0}{\sqrt{(y_0^2 + z_0^2)}}$
\end{flushright}

~\\ ~\\
So we have the nonstandard vectors : 
\vspace{-0.4cm}
\begin{center}
%\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
\widetilde{N}_x \\
\widetilde{N}_y\\
\widetilde{N}_z \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\theta & \sin\theta \\
0 & \sin\theta & -\cos\theta \end{array}\right)
\left(\begin{array}{c}
p \\
y'_0 \\
0 \end{array}\right)_{(X'Y'Z')} =
\left(\begin{array}{c}
p \\
y_o \\
z_o
\end{array}\right)
\end{displaymath}
%\end{boxedminipage}\\
%\end{center}

%\begin{center}
%\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
\widetilde{T_x} \\
\widetilde{T_y} \\
\widetilde{T_z} \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\theta & \sin\theta \\
0 & \sin\theta & -\cos\theta \end{array}\right)
\left(\begin{array}{c}
2(Sx-x_0) \\
-y'_0 \\
0 \end{array}\right)_{(X'Y'Z')} =
\left(\begin{array}{c}
 2(Sx-x_0) \\
-y_o \\
-z_o
\end{array}\right)
\end{displaymath}
%\end{boxedminipage}\\
\end{center}

~\\

After normalisation we get:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{10 cm}\vspace{-2pt}
\begin{displaymath}
\left( \begin{array}{c}
N_x \\
N_y \\
N_z \end{array}\right)_{(GSM)} = 
\dfrac{1}{p^2 +y^2_0 +z^2_0}
\left(\begin{array}{c}
p \\
y_o \\
z_o
\end{array}\right)
\end{displaymath}
%\end{boxedminipage}\\
%\end{center}

%\begin{center}
%\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
T_x \\
T_y \\
T_z \end{array}\right)_{(GSM)} = 
\dfrac{1}{4{(Sx-x_0)}^2 +y^2_0 +z^2_0}
\left(\begin{array}{c}
 2(Sx-x_0) \\
-y_o \\
-z_o
\end{array}\right)
\end{displaymath}
\end{boxedminipage}\\
\end{center}

\begin{flushright}
with $p=\dfrac{1}{2} \dfrac{(y_0^2 + z_0^2)}{(S_x -x_0)}$ 
\end{flushright}

\newpage
The $\vec{P}$ vector is obtained directly normalised by:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{12 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
P_x \\
P_y \\
P_z \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\theta & \sin\theta \\
0 & \sin\theta & -\cos\theta \end{array}\right)
\left(\begin{array}{c}
0 \\
0 \\
1 \end{array}\right)_{(X'Y'Z')} =
\left(\begin{array}{c}
0 \\
~~\sin\theta\\
-\cos\theta
\end{array}\right)
\end{displaymath}
\end{boxedminipage}\\
\end{center}

\begin{flushright}
with $cos(\theta)=\dfrac{y_0}{\sqrt{(y_0^2 + z_0^2)}}$ \hspace{0.5 cm}
and  $sin(\theta)=\dfrac{z_0}{\sqrt{(y_0^2 + z_0^2)}}$
\end{flushright}



\vspace{0.6cm}
\underline{\it{Transformation matrix from GSM to TPN}} \\

Knowing the coordinate of the $\vec{T},\vec{P},\vec{N} $ vectors in GSM system, we deduce at last the transformation matrix:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(TPN)} = 
\left(\begin{array}{ccc}
T_x & T_y & T_z \\
P_x & P_y & P_z \\
N_x & N_y & N_z \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(GSM)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\~\\
The inverse transformation (not really usefull) is obviously:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-2pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
T_x & P_x & N_x \\
T_y & P_y & N_y \\
T_z & P_z & N_z \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(TPN)}
\end{displaymath}
\end{boxedminipage}\\
\end{center}



\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : SM to MAG transformation
%------------------------------------------------------------------------


\section{SM~~to MAG transformation}
\label{sect:sm to mag transformation}

\begin{figure}[!h]
\begin{center}
\begin{tabular}{ll}
\emph{\textbf{Solar Magnetic}} & \emph{\textbf{Geomagnetic}}\\
~\\
\includegraphics[height=4.5 cm]{./FIGURES/Coordinate_system_SM.eps} &
\includegraphics[height=4.5 cm]{./FIGURES/Coordinate_system_MAG.eps}
\end{tabular}
\end{center}
\end{figure}

The SM and MAG system have the Z-axis in common, then the transformation matrix is a simple rotation of 
$\phi$ angle, thus the transformation matrix of any vector $\vec{V}$ is: \\


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9.5 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
~~\cos\phi & \sin\phi & 0 \\
-\sin\phi & \cos\phi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SM)}
\end{displaymath}
\end{boxedminipage}
\end{center} 

~\\~\\
 and the inverse transformation is obviously:


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9.5 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
\cos\phi & -\sin\phi & 0 \\
\sin\phi & ~~\cos\phi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(MAG)}
\end{displaymath}
\end{boxedminipage}
\end{center} 

~\\~\\
Nevertheless the angle $\phi$ is  not derivable from a simple equation.\\

To compute the rotation terms of transformation matrix, we use the MAG to GEO and the GEO to SM  
matrix transformations, given in \S \ref{sect:geo to mag transformation} and \S \ref{sect:geo to sm transformation}.


~\\ ~\\ 
\textbf{\underline{The first transformation}} is noted (see \S \ref{sect:geo to mag transformation}):

\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 
\end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
X_1 & X_2 & X_3 \\
Y_1 & Y_2 & Y_3 \\
D_1 & D_2 & D_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(MAG)}
\end{displaymath}

%\begin{flushleft}
with 	$\vec{X}=(\vec{Y}\times \vec{D})$ in GEO System and $\vec{Y}=(\vec{N} \times \vec{D})/|\vec{N} \times \vec{D}|$\\
%\end{flushleft}

$\vec{N}$ and $\vec{D}$ vector are respectively the North geographic pole and the magnetic dipole in geographic system.\\


\newpage

Practically, geographic dipole direction $\vec{D}$ is computed for a given time and year from \textbf{\textit{cp\_geo\_dipole\_dir}} subroutine; 
value for 1965.0 is:
\begin{displaymath}
\vec{D}=(D_1, D_2, D_3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

we deduce from $\vec{Y}= \displaystyle \frac{ \vec{N}\times\vec{D}}{| \vec{N}\times\vec{D}|}$
 ~~ the result 
$\vec{Y} = \displaystyle\frac{(-D_2, D_1, 0 )}{(D_1^2+D_2^2)^{1/2} }$ \\ \\

~\\ ~\\
\textbf{\underline{The second transformation}} is noted (see \S \ref{sect:geo to sm transformation}):


\begin{displaymath}
\left( \begin{array}{c} 
V_1 \\
V_2\\                               
V_3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
x_1 & y_1 & D_1 \\
x_2 & y_2 & D_2 \\
x_3 & y_3 & D_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SM)}
\end{displaymath}

\begin{flushleft}
with	$x = \vec{y}\times\vec{D}$  in GEO  system and $\vec{y}=( \vec{D}\times\vec{\mathscr{S}})/| \vec{D}\times\vec{\mathscr{S}}|$
\end{flushleft}

$\vec{\mathscr{S}}$ is the direction of the sun in GEO system, which can be computed from GEI to GEO transformation 
given in \S \ref{sect:gei to geo transformation}, then we have:

\begin{center} \begin{math}
\vec{\mathscr{S}}=(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}_3) =(S_1\cos\theta+ S_2\sin\theta, -S_1\sin\theta+ S_2\cos\theta, S_3)
\end{math} \end{center}

$\vec{S}$ is the direction of the Sun in GEI system, computed from \textbf{\textit{cp\_gei\_sun\_dir}} subroutine, 
such as the Greenwich Mean Sideral Time $\theta$.

~\\
Knowing all elements for MAG to GEO and GEO to SM transformations, we can write the SM to MAG transformation as: 

\begin{center}
$\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
X_1 & X_2 & X_3 \\
Y_1 & Y_2 & Y_3 \\
D_1 & D_2 & D_3 \end{array}\right)
\left(\begin{array}{ccc}
x_1 & y_1 & D_1 \\
x_2 & y_2 & D_2 \\
x_3 & y_3 & D_3 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SM)}$
\end{center}

which give :

\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc} 
\vec{X}\cdot\vec{x} & \vec{X}\cdot \vec{y} & \vec{X} \cdot \vec{D} \\
\vec{Y}\cdot\vec{x} & \vec{Y}\cdot \vec{y} & \vec{Y} \cdot \vec{D} \\
\vec{D}\cdot \vec{x} & \vec{D}\cdot \vec{y} &\vec{D} \cdot \vec{D} 
\end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SM)}
\end{displaymath}

~\\ ~\\
 In other hand we can write the following equivalences: \\ 

\begin{equation}
  \left\{
    \begin{aligned}
 &\vec{X}\cdot\vec{D} =(\vec{Y}\times\vec{D})\cdot\vec{D} = \vec{Y}\cdot(\vec{D}\times\vec{D}) =0\\ \\
 &\vec{Y}\cdot\vec{D} =( \vec{N}\times\vec{D})\cdot\vec{ D}/|\vec{N}\times\vec{D}| =  \vec{N}\cdot (\vec{D}\times \vec{D})/|\vec{N}\times \vec{D}| =0\\ \\
 &\vec{D}\cdot\vec{x} = \vec{D}\cdot(\vec{y}\times\vec{D}) = -\vec{D}\cdot(\vec{D}\times\vec{y}) = -(\vec{D}\times\vec{D})\cdot\vec{y} =0\\ \\
 &\vec{D}\cdot\vec{y} = \vec{D}\cdot(\vec{D}\times\vec{\mathscr{S}})/|\vec{D}\times\vec{\mathscr{S}}| = ( \vec{D}\times\vec{D})\cdot\vec{\mathscr{S}}/|\vec{D}\times\vec{\mathscr{S}}| =0 \\ \\
 &\vec{D}\cdot\vec{D} =1
    \end{aligned}
  \right.
\end{equation}



\newpage
then we have the following matrix:

\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
\vec{X}\cdot\vec{x} & \vec{X}\cdot\vec{y} & 0 \\
\vec{Y}\cdot\vec{x} & \vec{Y}\cdot\vec{y} & 0 \\
0 & 0 &1 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SM)}
\end{displaymath}

~\\ 
 
\textbf{\underline{Computation of  cos \scalebox{1.3}{$\varphi$}}}
~\\
~\\
We have to equalize  $\vec{X}\cdot\vec{x}$ and $\vec{Y}\cdot\vec{y}$ terms as $\cos\varphi$\\ ~\\
Taking
\begin{tabular}{ll}
	 &$\vec{X}\cdot\vec{x} = ( \vec{Y}\times\vec{D})\cdot( \vec{y}\times \vec{D} ) =
-( \vec{Y}\times\vec{D})\cdot( \vec{D}\times\vec{y} )$\\ \\
 & $\vec{X}\cdot\vec{x} =  -( \vec{Y}\times\vec{D})\times \vec{D}\cdot\vec{y}$ \\ ~\\
\end{tabular}

and since $\vec{Y}$ and $\vec{D}$ are perpendicular:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{4 cm}\vspace{-8pt}
\begin{displaymath}
	\vec{X}\cdot\vec{x} = \vec{Y}\cdot\vec{y} = \cos\varphi
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\~\\
Coordinates of $\vec{Y}$ axe is given in \ref{sect:geo to mag transformation}  as:
$
\vec{Y}= \displaystyle \frac{(-D_2, D_1, 0 )}{(D_1^2+D_2^2)^{1/2}}
$ ~~~and ~~  $\vec{y}= \displaystyle\frac{ \vec{D}\times\vec{\mathscr{S}}} {| \vec{D}\times\vec{\mathscr{S}}|}$  \\

~\\
Then we have:
$
\cos\varphi = \vec{Y}\cdot\vec{y} = \vec{Y}\cdot(\vec{D}\times\vec{\mathscr{S}})/|\vec{D}\times\vec{\mathscr{S}}|=
(\vec{Y}\times\vec{D})\cdot \vec{\mathscr{S}}/|\vec{D}\times\vec{\mathscr{S}}|
$ \\


The $(\vec{Y}\times\vec{D})$ vector can be expanded as:
$(\vec{Y}\times\vec{D})=(D_1D_3, D_2D_3, -\dfrac{D_1^2+D_2^2}{(D_1^2+D_2^2)^{1/2}} ) $

~\\
and we deduce:
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{8 cm}\vspace{-6pt}
\begin{displaymath}
\cos\varphi = \displaystyle \frac{1}{Q} \cdot [D_1D_3\mathscr{S}_1 + D_2D_3\mathscr{S}_2 - D_1^2+D_2^2\mathscr{S}_3]
\end{displaymath}	
\end{boxedminipage}\\
\end{center} 

~\\~\\
with
$
Q=(D_1^2+D_2^2)^{1/2}.[(D_2\mathscr{S}3-D_3\mathscr{S}_2)^2 + (D_3\mathscr{S}1-D_1\mathscr{S}3)^2 + 
(D_1\mathscr{S}_2-D_2\mathscr{S}_1)^2]^{1/2}$

~\\~\\
and
$(\mathscr{S}_1, \mathscr{S}_2, \mathscr{S}3)$ = $((S_1\cos\theta+ S_2\sin\theta) , (-S_1\sin\theta+ S_2\cos\theta) , S_3)$

~\\~\\
\textbf{\underline{Computation of  sin \scalebox{1.3}{$\varphi$}}}
~\\
~\\
 
 We have to equalize  $\vec{X}\cdot\vec{y}$ and $-\vec{Y}\cdot\vec{x}$ terms as $\sin\varphi$
 
~\\
 Taking  $\vec{X}\cdot\vec{y}=( \vec{Y}\times\vec{D})\cdot\vec{y}$
 ~~~and ~~	$-\vec{Y}\cdot\vec{x}= -\vec{Y}\cdot( \vec{y}\times\vec{D}) = \vec{Y}\cdot( \vec{D}\times\vec{y})=
 ( \vec{Y}\times\vec{D})\cdot\vec{y}$


~\\
 yet we have well:\\
 \begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{4.2 cm}\vspace{-8pt}
\begin{displaymath}
\vec{X}\cdot\vec{y} = -\vec{Y}\cdot\vec{x} = \sin\varphi
\end{displaymath} 
\end{boxedminipage}\\
\end{center}
 
 \newpage
 $\sin\varphi$ is then computed from   $\sin\varphi= ( \vec{Y}\times\vec{D})\cdot\vec{y}$\\ \\

 From above we have: $(\vec{Y}\times\vec{D})=(D_1D_3, D_2D_3, - \dfrac{D_1^2+D_2^2}{(D_1^2+D_2^2)^{1/2}}$
 
~\\~\\
 and with ~~
$\vec{y} = (\vec{D}\times\vec{\mathscr{S}})/|\vec{D}\times\vec{\mathscr{S}}|$

~\\~\\
   we deduce:

 \begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{5 cm}\vspace{-6pt}
\begin{displaymath} 
\sin\varphi = \displaystyle \frac{1}{Q} \cdot(D_2\mathscr{S}_1 - D_1\mathscr{S}_2)
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\
  with Q such as above.




\newpage
%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : SR2 to ISR2 transformation
%------------------------------------------------------------------------

\section{SR2 to ISR2 transformation}
\label{sect:sr2 to isr2 transformation}

\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Spin Reference 2}} & \emph{\textbf{Inverse SR2}}\\
~\\
\includegraphics[height=5. cm]{./FIGURES/Coordinate_system_SR2.eps} &
\hspace{0.8cm}
\includegraphics[height=5. cm]{./FIGURES/Coordinate_system_ISR2.eps}
\end{tabular}
\end{center}
\end{figure}


ISR2 system is often used for CLUSTER data, because the spin axis of CLUSTER S/C is close to the -Z axis of GSE system.
So, by simply changing the signe of Z and Y in the SR2 system, we obtain a system named ISR2 (Inverse SR2) which is close to the GSE system.\\

The transformation beetween SR2 to ISR2 is simply: \\


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9.5 cm}\vspace{0.1cm}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(SR2)} = 
\left(\begin{array}{ccc}
1 & ~~0 & ~~0 \\
0 & -1 & ~~0 \\
0 & ~~0 & -1 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(ISR2)}
\smallskip
\end{displaymath}
\end{boxedminipage}
\end{center} 

~\\~\\
 and the inverse transformation is obviously the same:\\


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9.5 cm}\vspace{0.1cm}
\begin{displaymath}
\left( \begin{array}{c}
V_1 \\
V_2\\
V_3 \end{array}\right)_{(ISR2)} = 
\left(\begin{array}{ccc}
1 & ~~0 & ~~0 \\
0 & -1 & ~~0 \\
0 & ~~0 & -1 \end{array}\right)
\left(\begin{array}{c}
V_1 \\
V_2 \\
V_3 \end{array}\right)_{(SR2)}
\smallskip
\end{displaymath}
\end{boxedminipage}
\end{center} 


\newpage

%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : SR to SR2 transformation
%------------------------------------------------------------------------

\section{SR~~to SR2 transformation}
\label{sect:sr to sr2 transformation}

%Spin Reference System 					Spin Reference 2 System

\begin{figure}[!h]
\begin{center}
\begin{tabular}{cc}
\emph{\textbf{Spin Reference System}} & \emph{\textbf{Spin Reference 2 System}}\\
~\\
\label{}
\includegraphics[height=5.0 cm]{./FIGURES/Coordinate_system_SR.eps} &
\hspace{0.5cm}
\includegraphics[height=5.0 cm]{./FIGURES/Coordinate_system_SR2.eps}
\end{tabular}
\end{center}
\end{figure}


By the way of the Sun Reference Pulse, we know the spin phase $\varphi(t_o)$  at a given time $t_o$. 
The spin phase $\varphi(t_o)$ is the azimutal angle of the direction of the Sun in the SR system, for the knowed time to.  
At any time $t$, knowing the spin frequency $f_s$, the $\varphi(t)$ angle can be computed by by:

\begin{displaymath}
\varphi(t)= \varphi(t_o)-2\pi f_s (t-t_o)
\end{displaymath} \\

The spacecraft is supposed rotating in the direct x to y sens. If it rotates in the other sens, 
the signe of $f_s$  must be changed. Note that at each time multiple of $t=  t_o + k/f_s$  (k being any signed integer) ,
$\varphi(t)$ has the same value as $\varpi(t_o)$.\\

The only one difference between the SR system and the SR2 system is a rotation of the  $\varphi$ angle around the spin axis, 
so we have:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{SR2} = 
\left(\begin{array}{ccc}
\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR}
\smallskip
\end{displaymath}
\end{boxedminipage}\\
\end{center} 

~\\~\\
  and the inverse transformation is obviously: 

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9  cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{SR} = 
\left(\begin{array}{ccc}
\cos\varphi & -\sin\varphi & 0 \\
\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
\smallskip
\end{displaymath}
\end{boxedminipage}\\
\end{center}

\newpage

%------------------------------------------------------------------------
%	    CHAPTER : MATHEMATICAL FORM OF TRANSFORMATIONS
%		SECTION : SR2 to MFA transformation
%------------------------------------------------------------------------
\section{SR2 to MFA transformation}
\label{sect:sr2 to mfa transformation}

%Spin Reference 2 					Magnetic Field Aligned

\begin{figure}[!h]
\begin{center}
\begin{tabular}{ccc}
\emph{\textbf{Spin Reference 2}} & ~& \emph{\textbf{Magnetic Field Aligned}}\\
~\\
\includegraphics[height=5.0 cm]{./FIGURES/Coordinate_system_SR2.eps} &
~ &
\includegraphics[height=5.0 cm]{./FIGURES/Coordinate_system_MFA.eps}
\end{tabular}
\end{center}
\end{figure}

\vspace{-10pt}
The Magnetic Field Aligned system is defined as a system where Z is along the DC magnetic field, 
noted as Bo, and X in the plane containing the DC magnetic field vector and the direction of the Sun. 
A problem of definition can appear when the DC-MF is aligned with the direction of the Sun, which is not an unlikely case. 
When this situation arrives, the direction of the normal to the ecliptic plane could be used instead of the direction of the Sun, but is is not still the case in this version.\\

To obtain the alignment of Z with Bo, we apply two rotations. 

~\\
{\textbf{\underline{The first rotation}}, in the x-y plane, align the x axis with the perpendicular component of Bo in the x-y plane:
~\\~\\
\begin{tabular}{cc}
\parbox[c]{5.5 cm}
{\includegraphics[height=3.8 cm]{./FIGURES/SR2_MFA_first_rotation.eps}} & 
$
\left( \begin{array}{c}
X' \\
Y'\\
Z' \end{array}\right) = 
\left(\begin{array}{ccc}
~~\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
$
\end{tabular}

~\\~\\
{\textbf{\underline{The second rotation}}, in the x'-z' plane, leads the new z axis to be aligned with Bo: \\
~\\
\begin{tabular}{cc}
\parbox[c]{5.5 cm}
{\includegraphics[height=3.8 cm]{./FIGURES/SR2_MFA_second_rotation.eps}} &  
$
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MAG} = 
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & ~~\cos\theta \end{array}\right)
\left(\begin{array}{c}
X' \\
Y' \\
Z' \end{array}\right)
$
\end{tabular}

\newpage

and the transformation from SR2 to a new MAG is given by:

\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MAG} = 
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & \cos\theta \end{array}\right)
\left(\begin{array}{ccc}
~~\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
\end{displaymath}

~\\~\\
At this level, the Z axis of new MAG system is aligned with the Bo DC local magnetic field, 
but the MAG system is still not the MFA system, because the MFA system is defined as having the X in the plane 
containing the DC magnetic field vector and the direction of the Sun. So we must apply a third rotation to pass 
from the MAG system to the MFA system.

~\\
{\textbf{\underline{The third rotation}} in the x-y plane depends of the direction of the Sun in the MAG system, 
defined by its spherical angles $\eta$  and $\psi$  :


\begin{figure}[!h]
\begin{center}
\includegraphics[height=5.0 cm]{./FIGURES/MAG_system.eps}
\end{center}
\end{figure}

and  we pass from the MAG system to the MFA system  by a rotation of $\psi$ angle around the Z axis:

\begin{tabular}{cc}
\parbox[c]{5  cm}
{\includegraphics[height=3.8 cm]{./FIGURES/SR2_MFA_third_rotation.eps}} & 
$
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MFA} = 
\left(\begin{array}{ccc}
~~\cos\psi & \sin\psi & 0 \\
-\sin\psi & \cos\psi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{MAG}
$
\end{tabular}

~\\~\\~\\
So, the total transformation from SR2 system to MFA system is:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{small}
\begin{boxedminipage}[c]{15 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MFA} = 
\left(\begin{array}{ccc}
~~\cos\psi & \sin\psi & 0 \\
-\sin\psi & \cos\psi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & ~~\cos\theta \end{array}\right)
\left(\begin{array}{ccc}
~~\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
\smallskip
\end{displaymath}
\end{boxedminipage}\\

\end{small}
\end{center}


\newpage

\textbf{\underline{Computation of the angles \scalebox{1.3}{$\theta$} and \scalebox{1.3}{$\varphi$} }}
~\\
~\\

$\theta$  and $\varphi$  are respectively the polar and azimuthal angles of the Bo DC magnetic field vector in SR2 system.
If we note Bx, By and Bz the components of Bo in SR2 system, we have:\\

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}\vspace{-6pt}
\begin{eqnarray*}
\sin\theta = \frac{\sqrt{Bx^2+By^2}}{B_0} & ,& \cos\theta = \frac{Bz}{B_0}
\end{eqnarray*}
\begin{eqnarray*}
\sin\varphi = \frac{By}{\sqrt{Bx^2+By^2}} & ,& \cos\varphi = \frac{Bx}{\sqrt{Bx^2+By^2}}
\end{eqnarray*}
\end{boxedminipage}\\
\end{center}

~\\~\\
\textbf{\underline{Computation of the angle \scalebox{1.3}{$\psi$} }}
~\\~\\
$\psi$ is the azimuthal angle of the direction of the Sun in MAG system . If we note $Sx_M$, $Sy_M$, $Sz_M$ 
the Cartesian components of this direction in MAG system, we have: \\


\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{9 cm}%\vspace{-2pt}
\begin{displaymath}
\sin\psi = \frac{Sy_M}{\sqrt{Sx_M^2+Sy_M^2}}, \cos\psi = \frac{Sx_M}{\sqrt{Sx_M^2+Sy_M^2}}
\end{displaymath}
\end{boxedminipage}\\
\end{center}

~\\~\\
  \textbf{\underline{Computation of $Sx_M$, $Sy_M$, $Sz_M$:}}
~\\~\\
To compute the components of the direction of the Sun in MAG system, we use the transformation from SR2 to MAG, 
computed in the beginning of this annexe, as:
~\\
\begin{displaymath}
\left( \begin{array}{c}
Sx_M \\
Sy_M\\
Sz_M \end{array}\right)_{MAG} = 
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & \cos\theta \end{array}\right)
\left(\begin{array}{ccc}
\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
S_x \\
S_y \\
S_z \end{array}\right)_{SR2}
\end{displaymath}

~\\~\\
where $S_x, S_y, S_z$ are the components of the direction of the Sun in SR2 system. Having $S_y =0$, this  leads to:

\begin{displaymath}
\left( \begin{array}{c}
Sx_M \\
Sy_M\\
Sz_M \end{array}\right)_{MAG} = \left(\begin{array}{c}
S_x\cos\theta\cos\varphi  -S_z\sin\theta \\
-S_x\sin\varphi \\
S_x\sin\theta\cos\varphi + S_z\cos\theta \end{array}\right)
\end{displaymath}

~\\~\\
$S_x, S_y, S_z$ are deduced by the transformation of GSE to SR2 given in annexe 1, thus:

\begin{displaymath}
\left( \begin{array}{ccc}
S_x \\
S_y\\
S_z \end{array}\right)_{SR2} = \left(\begin{array}{ccc}
a(R_y^2+R_z^2) & -a(R_xR_y) & -aR_xR_z \\
0 & aR_z & -aR_y \\
R_x & R_y & R_z \end{array}\right)
\left( \begin{array}{c}
1 \\
0\\
0 \end{array}\right)_{GSE}\\
\end{displaymath}

~\\~\\
with $a=\dfrac{1}{\sqrt{Ry^2+Rz^2}}$, ~~$\vec{R}$ vector being the Rotation axis expressed in GSE coordinate. 

\newpage

Note that in GSE, 
the direction of the Sun is simply (1,0,0), thus the direction of the Sun in SR2 system is: 

\begin{displaymath}
\left( \begin{array}{c}
S_x \\
S_y\\
S_z \end{array}\right)_{SR2} = \left(\begin{array}{c}
\sqrt{R_y^2+R_z^2}\\
0  \\
R_x  \end{array}\right)
\end{displaymath}

~\\~\\
 which leads to the result:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{10 cm}\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
Sx_M \\
Sy_M\\
Sz_M \end{array}\right)_{MAG} = \left(\begin{array}{c}
\sqrt{R_y^2+R_z^2}\cos\theta\cos\varphi-R_x\sin\theta\\ \\
-\sqrt{R_y^2+R_z^2}\sin\varphi \\ \\
\sqrt{R_y^2+R_z^2}\sin\theta\cos\varphi+R_x\cos\theta  \end{array}\right)
\end{displaymath}
\end{boxedminipage}\\
\end{center}

\bigskip
Knowing now the 3 angles $\theta$,$\varphi$ and $\psi$ we can expand the previous formula


\begin{center}
\begin{small}
\vspace{-6pt}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MFA} = 
\left(\begin{array}{ccc}
~~\cos\psi & \sin\psi & 0 \\
-\sin\psi & \cos\psi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & ~~\cos\theta \end{array}\right)
\left(\begin{array}{ccc}
~~\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
\end{displaymath}

\end{small}
\end{center}

~\\as:

\begin{center}\setlength{\fboxrule}{1pt}
\begin{small}
\begin{boxedminipage}[c]{15 cm}\vspace{-5pt}
\begin{displaymath}
\!\!\left(\!\! \begin{array}{c}
\!X \\
\!Y \\
\!Z \end{array}\!\!\right)_{\!\!\mathit{MFA}}\!\!\!= 
\!\!\!\left(\!
\begin{array}{ccc}
~~\cos\psi\cos\theta\cos\varphi - \sin\psi\sin\varphi & ~~\cos\psi\cos\theta\sin\varphi + \sin\psi\cos\varphi &  -\cos\psi\sin\theta \\
 -\sin\psi\cos\theta\cos\varphi - \cos\psi\sin\varphi &  -\sin\psi\cos\theta\sin\varphi + \cos\psi\cos\varphi & ~~\sin\psi\sin\theta\\
~~\sin\theta\cos\varphi & \sin\theta\sin\varphi & ~~\cos\theta \end{array}
\!\right)\!
\!\left(\!\begin{array}{c}
\!X \\
\!Y \\
\!Z \end{array}\!\!\right)_{\!\!\mathit{GSE}}\!
\smallskip
\end{displaymath} 
\end{boxedminipage}
\end{small}
\end{center}


\newpage
%=========================================================================

%------------------------------------------------------------------------
%       PART    : DEFINITIONS AND MATHEMATICAL FORMULAS
%		CHAPTER : USE OF EULER ANGLES
%------------------------------------------------------------------------
\chapter{USE OF EULER ANGLES}
\label{chapter:Euler_angles}

%------------------------------------------------------------------------
%		CHAPTER : CALENDAR CONVERSIONS
%		SECTION : General remarks on transformation matrix
%------------------------------------------------------------------------
\section{General remarks}
\label{sect:General remarks-3}

Most space missions give Euler angles, allowing the knowledge of position of spinning spacecraft by respect
to another coordinate system, assumed to be fixed by respect to the spin period. Following sections 
give definition of Euler angle, and how to use it. Example chosen is for GEOS spacecraft, 
where the fixed system is VDH (see \cite {Robert04}).


\section{Definition of Euler angles}
\label{sect:definition_of_Euler}

Euler angles are defining according the figure \ref{Def_Euler_angles}.
In this example, Euler angle allow to pass from the spinning system XYZ (in blue) to the fixed system VDH (in red).
The line corresponding to the intersection of  two plane is the node line (green).

\bigskip

$\theta$ is the the nutation, $\varphi$ the precession, and $\Psi$ the intrinsic rotation.

\begin{figure}[!h]
    \begin{center}
        \label{Def_Euler_angles}
        \includegraphics[width=8 cm]{./FIGURES/Def_Euler_angles.eps}
        \caption{Definition of Euler angles}
    \end{center}
\end{figure}

 

\section{XYZ to VDH transformation}
\label{sect:XYZ_to_VDH}

One need 3 rotations to pass from XYZ system to VDH one:

\begin{itemize}
\item  a first rotation $A$ around the Z axis (spin axis) of $\varphi$ angle lead X on the node axis N, 
and become X'

\item a second rotation $B$ around N of $\theta$ angle lead Z on H, and become Z'

\item a third rotation $C$ around Z' of $\Psi$ angle lead X' on V.

\end{itemize}


So the full matrix to pass from XYZ to VDH is the matrix product $R= CBA$, so be:
\bigskip

$
R=
\begin{pmatrix}
cos \Psi & -sin \Psi & 0\\
sin \Psi & cos \Psi & 0\\
0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
1 & 0 & 0 \\
cos \theta & -sin \theta & 0\\
sin \theta & cos \theta & 0

\end{pmatrix}
\begin{pmatrix}
cos \varphi & -sin \varphi & 0\\
sin \varphi & cos \varphi & 0\\
0 & 0 & 1
\end{pmatrix}
$

\bigskip
After computation we get:
\bigskip

$R=
\begin{pmatrix}
cos\Psi cos\varphi - sin\Psi cos\theta sin\varphi & -cos\Psi sin\varphi - sin\Psi cos\theta cos\varphi & sin\Psi sin\theta\\
sin\Psi cos\varphi + cos\Psi cos\theta sin\varphi & -sin\Psi sin\varphi + cos\Psi cos\theta cos\varphi & -cos\Psi sin\theta\\
sin\theta sin\varphi                              & sin\theta cos\varphi                               & cos\theta
\end{pmatrix}
$


\bigskip
The inverse matrix is $R^{-1} = A^{-1} B^{-1} C^{-1}$ but it is more simply to take the transposed matrix.

\bigskip
So, to summarize: 

\begin{center}\setlength{\fboxrule}{1pt}
    \begin{boxedminipage}[c]{16.3 cm}\vspace{-5pt}
        \begin{displaymath}
        \small
        \left( \begin{array}{c}
        V_1 \\
        V_2\\
        V_3 \end{array}\right)_{\tiny{(VDH)}} = 
        \left(\begin{array}{ccc}

 cos\Psi cos\varphi - sin\Psi cos\theta sin\varphi & -cos\Psi sin\varphi - sin\Psi cos\theta cos\varphi & sin\Psi sin\theta\\
 sin\Psi cos\varphi + cos\Psi cos\theta sin\varphi & -sin\Psi sin\varphi + cos\Psi cos\theta cos\varphi & -cos\Psi sin\theta\\
 sin\theta sin\varphi                              & sin\theta cos\varphi                               & cos\theta
\end{array}\right)
        \left(\begin{array}{c}
        V_1 \\
        V_2 \\
        V_3 \end{array}\right)_{\tiny{(XYZ)}}
        \end{displaymath}
    \end{boxedminipage}\\
\end{center}

\bigskip

\begin{center}\setlength{\fboxrule}{1pt}
    \begin{boxedminipage}[c]{16.3 cm}\vspace{-5pt}
        \begin{displaymath}
        \small
        \left( \begin{array}{c}
        V_1 \\
        V_2\\
        V_3 \end{array}\right)_{\tiny{(XYZ)}} = 
        \left(\begin{array}{ccc}
cos\Psi cos\varphi - sin\Psi cos\theta sin\varphi  &  sin\Psi cos\varphi + cos\Psi cos\theta sin\varphi & sin\theta sin\varphi\\
-cos\Psi sin\varphi - sin\Psi cos\theta cos\varphi & -sin\Psi sin\varphi + cos\Psi cos\theta cos\varphi & sin\theta cos\varphi \\
sin\Psi sin\theta                                  & -cos\Psi sin\theta                                 & cos\theta
        \end{array}\right)
    \left(\begin{array}{c}
    V_1 \\
    V_2 \\
    V_3 \end{array}\right)_{\tiny{(VDH)}}
    \end{displaymath}
\end{boxedminipage}\\
\end{center}



\newpage
%=========================================================================

%------------------------------------------------------------------------
%       PART    : DEFINITIONS AND MATHEMATICAL FORMULAS
%		CHAPTER : CALENDAR CONVERSIONS
%------------------------------------------------------------------------
\chapter{CALENDAR CONVERSIONS}
\label{chapter:calendar conversions}

%------------------------------------------------------------------------
%		CHAPTER : CALENDAR CONVERSIONS
%		SECTION : General remarks on transformation matrix
%------------------------------------------------------------------------
\section{General remarks}
\label{sect:General remarks-2}

Most space missions deliver or use for their processing data date and time in various format, 
such as decimal Julian day, month-day in the month, year, decimal hours, hour-min-sec, and so on. 
In order to easily manipulate all theses quantities, and to get transformations between else, 
special calendar conversions, described below, has been added to ROCOTLIB library.
Details on input/output of each subroutine are available on section \ref{sect:description of "Calendar" subroutines}


%------------------------------------------------------------------------
%		CHAPTER : CALENDAR CONVERSIONS
%		SECTION : List of calendar conversions and definitions
%------------------------------------------------------------------------
\section{List of calendar computation utilities}
\label{sect:list of calendar computation utilities}

\subsection{Compute if a given  year is or not a  leap year (cp\_leap\_year)}

A given year (as 1990) is a leap year if this number is divisible by 4; if the year is a secular year (as 1900 or 2000), 
this year is a leap year if this number is divisible by 400.
For instance, 1988, 1992, 2000 are leap years, 1900, 1989, 2100 are not.

\subsection{Compute   the number of day in a month (cp\_nbday\_in\_month)}

Dependent of the year because of leap years.

\subsection{Compute english day name from day in a week (cp\_en\_day\_name)}

Example :  `` Monday " for 1

\subsection{Compute french day name from day in a week (cp\_fr\_day\_name)}

Example : `` Lundi " for 1 


\subsection{Compute english month name from month number (cp\_en\_month\_name)}

Example :  `` January " for 1 

\subsection{Compute french month name from month number (cp\_fr\_month\_name)}

Example : `` Janvier " for 1 



\section{List of calendar conversion utilities}
\label{sect:list of calendar conversion utilities}


\subsection{Convert date to day of the year (cv\_date\_to\_doty)}

This conversion compute the day of the year, equal to 1 for January 1, from a date given as month, day in the month, and year.
For instance, the day of the year of October 17, 1990 is 290. This conversion  counts the number of the day in a month, 
taking into account leap year since February has not a constant number of days (using cp\_leap\_year).

\subsection{Convert day of the year to date (cv\_doty\_to\_date)}

 This is the inverse conversion of cv\_date\_to\_doty, since one compute the corresponding month and day in the month for 
a given day of the year, and a given year. Year is necessary to know if the year is or not a leap year (using cp\_leap\_year).

\subsection{Convert date to Julian day 1950  (cv\_date\_to\_jul1950)}

From a given date as month, day, year, this conversion compute the Julian day ,
i.e. day number from January 1, 1950, with Julian day equal to 1 for January 1, 1950 (use cv\_date\_to\_doty and cp\_leap\_year conversions). 

\subsection{Convert date to Julian day 2000  (cv\_date\_to\_jul2000)}

From a given date as month, day, year, this conversion compute the Julian day , 
i.e. day number from January 1, 2000, with Julian day equal to 1 for January 1, 2000 (use cv\_date\_to\_doty and cp\_leap\_year conversions). 


\subsection{Convert  Julian day 1950 to date (cv\_jul1950\_to\_date)}

This is the inverse conversion of cv\_date\_to\_jul1950, since one compute for a given Julian day the corresponding date as month, 
day in the month and year (use cp\_leap\_year and cv\_doty\_to\_date conversions).


\subsection{Convert Julian day 2000 to date (cv\_jul2000\_to\_date)}

This is the inverse conversion of cv\_date\_to\_jul2000, since one compute for a given Julian day the corresponding date as month, 
day in the month and year (use cp\_leap\_year and cv\_doty\_to\_date conversions).


\subsection{Convert   hour, min, sec to decimal hour  (cv\_hms\_to\_dech)}

This conversion makes the operation hour + minute/60. + second/3600.


\subsection{Convert  decimal hour to hour, min, sec  (cv\_dech\_to\_hms)}

Inverse of cv\_hms\_to\_dech.

\subsection{Convert  day, hour, min, sec,ms.  to  ms of the day  (cv\_dhms\_to\_msotd)}

As jour*24*360000 + hour*3600000 +min*60000 +sec*1000 +ms 


\subsection{Convert  ms of the day to hour, min, sec., ms (cv\_msotd\_to\_hmsms)}\label{sec:}

Inverse of cv\_dhms\_to\_msotd

\subsection{Convert  date to week number in a year  (cv\_date\_to\_weekn)}

A week is always beginning by a Monday.


\subsection{Convert  date to day of the week   (cv\_date\_to\_dotw)}

With 1 for Monday, etc.


\subsection{Convert the week number in a year  to date   (cv\_weekn\_to\_date)}

Date is computed for the first day of the week, always a Monday.




 
