Hello,

I am approaching for the first time the theory of covariance propagation and I have some doubts about the results I am obtaining when propagating numerically both the orbit and its covariance matrix.

Following what suggested in Covariance matrix before last measurements, I implemented this piece of code:

```
public class test {
public static void main(String[] args) {
// Initial state
TimeScale utc = TimeScalesFactory.getUTC();
AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, utc);
Vector3D position = new Vector3D(-605000.7922166, -5870000.2295111, 3493000.0531990);
Vector3D velocity = new Vector3D(-1568.254290, -3702.348910, -6479.483950);
PVCoordinates cartCoord = new PVCoordinates(position, velocity);
CartesianOrbit initialOrbit = new CartesianOrbit(cartCoord, FramesFactory.getGCRF(), initialDate, Constants.IERS2010_EARTH_MU);
double period = initialOrbit.getKeplerianPeriod();
// Initial covariance
double[][] initialCovariance = {{1.000000e+02, 1.000000e-02, 1.000000e-02, 1.000000e-04, 1.000000e-04, 1.000000e-04},
{1.000000e-02, 1.000000e+02, 1.000000e-02, 1.000000e-04, 1.000000e-04, 1.000000e-04},
{1.000000e-02, 1.000000e-02, 1.000000e+02, 1.000000e-04, 1.000000e-04, 1.000000e-04},
{1.000000e-04, 1.000000e-04, 1.000000e-04, 1.000000e-04, 1.000000e-06, 1.000000e-06},
{1.000000e-04, 1.000000e-04, 1.000000e-04, 1.000000e-06, 1.000000e-04, 1.000000e-06},
{1.000000e-04, 1.000000e-04, 1.000000e-04, 1.000000e-06, 1.000000e-06, 1.000000e-04}};
RealMatrix initCovariance = new Array2DRowRealMatrix(initialCovariance);
// Numerical propagator
NumericalPropagator prop = new NumericalPropagator(new ClassicalRungeKuttaIntegrator(1));
SpacecraftState initialSpacecraftState = new SpacecraftState(initialOrbit);
prop.setOrbitType(OrbitType.CARTESIAN);
prop.setInitialState(initialSpacecraftState);
PartialDerivativesEquations PDE = new PartialDerivativesEquations("partial-derivatives", prop);
SpacecraftState initialSpacecraftStateWithDerivatives = PDE.setInitialJacobians(initialSpacecraftState);
prop.resetInitialState(initialSpacecraftStateWithDerivatives);
JacobiansMapper jacobianMapper = PDE.getMapper();
prop.setStepHandler(new PropagationStepHandler(jacobianMapper, initCovariance));
prop.propagate(initialDate.shiftedBy(period));
}
// Step handler
private static class PropagationStepHandler implements OrekitStepHandler {
private JacobiansMapper jacobianMapper;
private RealMatrix initCovariance;
public PropagationStepHandler(JacobiansMapper jacobianMapper, RealMatrix initCovariance) {
this.jacobianMapper = jacobianMapper;
this.initCovariance = initCovariance;
}
@Override
public void handleStep(OrekitStepInterpolator interpolator) {
SpacecraftState currentSpacecraftState = interpolator.getCurrentState();
// Current state transition matrix
double[][] stm = new double[6][6];
jacobianMapper.getStateJacobian(currentSpacecraftState, stm);
RealMatrix dYdY0 = new Array2DRowRealMatrix(stm, false);
// Current covariance
RealMatrix newCovariance = dYdY0.multiply(initCovariance.multiplyTransposed(dYdY0));
System.out.println(newCovariance.getEntry(0, 0));
}
}
}
```

As you can see, I am running the propagation over one orbital revolution. I was therefore expecting to obtain the final covariance matrix equal to the initial one since the cartesian elements at the end of the propagation are exactly those of the initial state (I was expecting the dYdY0 matrix to be the identity matrix). Instead I get that, for example, the element [0][0] of the final covariance matrix is equal to 2774.37 instead of 100.

Did I implement something wrong in the code or am I just missing something from the theory of covariance propagation?

Thank you in advance!

Kind regards,

Claudio Toquinho Campana