# Jacobian matrix for covariance transformation from Keplerian to Equinoctial

Hello,
I have to get the Jacobian matrix to transform the covariance matrix of a Keplerian orbit to a covariance matrix in Equinoctial elements.
I saw that there is the possibility to use the method getJacobianWrtCartesian and getJacobianWrtParameters to get the Jacobin from a Cartesian to a Keplerian and vice versa. What about the Equinoctial orbit? Is there any direct way to get the Jacobian matrix starting from / arriving to an Equinoctial orbit?

Thank you!

You will have to compose Jacobians.

``````      KeplerianOrbit   kep           = ...;
RealMatrix       covarianceKep = ...;

// convert to Cartesian covariance
double[][] jk = new double[6][6];
kep.getJacobianWrtParameters(PositionAngle.MEAN, jk);
RealMatrix dCdK = MatrixUtils.createRealMatrix(jk);
RealMatrix covarianceCart = dCdK.multiply(covarianceKep).multiplyTransposed(dCdK);

// convert to Equinoctial covariance
double[][] je = new double[6][6];
EquinoctialOrbit equ = (EquinoctialOrbit) OrbitType.EQUINOCTIAL.convertType(kep);
equ.getJacobianWrtCartesian(PositionAngle.MEAN, je);
RealMatrix dEdC = MatrixUtils.createRealMatrix(je);
RealMatrix covarianceEqu = dEdC.multiply(covarianceCart).multiplyTransposed(dEdC);
``````

Beware that when converting the covariances, the left hand side multiplication calls the `multiply` method whereas the right hand side multiplication calls the `multiplyTransposed` method (this avoids creating the intermediate transposed matrix).

Beware also I wrote this skeleton code quickly, you should double check to ensure the transforms are in the correct direction.

Thank you Luc!