HolmesFeatherstoneAttraction Gradient and Hessian issue

Hello all,

For a project I needed the gradient and the hessian matrix of the gravitational potential from HolmesFeatherstoneAttractionModel.

I realized that the gradient method returns -gradU instead of gradU. The acceleration method is correct as it returns gradient (-gradU), but this is very confusing when you don’t need the acceleration but the correct gradient. I computed the hessian matrix using DerivativeStructure and it turns out that the hessian method returns the opposite of the potential hessian matrix. I understand the choice to embed the - sign in the methods as the class is more likely used to compute the force and not directly the potential.

I would like to know if this comes from a design choice? If so, I think it would be great to update the javadoc to clarify it.

Cheers,

Romain

1 Like

Hi @rcuvilllon

As you mentioned, it is related to the fact that in Orekit it is mostly used to compute the acceleration. So, it limit the number of operations if the method returns -gradU.

But you are right, it can be confusing. Could you open an issue in our Gitlab repository in order to update the JavaDoc?

Thank you

Bryan

1 Like

Hi @bcazabonne ,

Thank you for your answer, I’ve opened an issue .

Romain :slight_smile: