Computing Jacobian Matrix


I have a trajectory (time, position and velocity are defined) from Earth to the Moon and cannot really define an orbit with this trajectory as such.

I have defined a variable of type SpacecraftState using AbsPVCoordinates.
I then use this variable as an input for PartialDerivativesEquations.setInitialJacobian(SpacecraftState)

However, I get an error of: orbit not defined, state rather contains an absolute position-velocity-acceleration when trying to compute the Jacobian matrix.

Orekit states that inputting a variable of type SpacecraftState to compute the Jacobian matrix is allowed and a SpacecraftState can be defined using AbsPVCoordinates but I still get this error. Could anyone identify what I’m doing incorrectly? Or is there another way of computing the Jacobian matrix - without having to define an orbit?

Thank you!

Hi @benoist

What you’ve done is probably correct. Your problem comes from a missing feature in Orekit. Indeed, it’s not currently possible to use PartialDerivatesEquations class with a SpacecraftState built from AbsPVCoodinates.

We will add in the next version of Orekit (i.e. 10.2) a new feature allowing to use PartialDerivativesEquations class with a SpacecraftState built from AbsPVCoordinated. Probably, it will be a new class. Something like AbsPartialDerivativesEquations. This feature is currently available on Vincent Mouraux’s Orekit projet (on its cr3bp branch). It will be soon added to the main Orekit project.

What you can try in the meantime, is to use DerivativeStructure features of Orekit. If you want an example on how to use it, you can have a look on MaximeJ’s post here. In its post, he gives a small scrip explaining how to compute a Jacobian Matrix using DerivativeStructure features. You have just to use AbsPVCoordinates instead of Orbit to build your SpacecraftState.

Kind regards,

Though I haven’t tried it, I think it would also work to just use a CartesianOrbit to initialize and to propagate in Cartesian elements.

Hi all,

Thank you very much for your answers, I’ve started implementing it but I still struggle on one part of the derivatives: as I’ve set the thrust as a ParameterDriver I also want to compute the derivatives of the thrust magnitude with respect to the positions and velocities only: dT/dx; dT/dy; dT/dz; dT/dVx etc.

What is the best way to compute these derivatives based on the example you sent? Would it be adding an extra element to the stateVector getting the norm of the thrust and applying the same logic?

Thank you!


Hi benoist,

Are you using the “Field Propagation” from the example or the new AbsolutePartialDerivativesEquations class ?
If you’re using the field propagation you will probably be stuck. I don’t think you can “field” the parameters of a force model, but maybe someone here will prove me wrong.
If you’re using the cr3bp branch and the class AbsolutePartialDerivativesEquations, the computation of these derivatives should be done automatically and you’ll get them inside the dYdP array when calling AbsolutePartialDerivativesEquations#getMapper().getParametersJacobian(final SpacecraftState state, final double[][] dYdP).

Have a good day,