Calling scipy optimizer on function with Orekit function calls

I am trying to use fsolve from scipy.optimize. I have a function that I wish to root-solve, this function works without problem being called directly. However, when I call fsolve, it gives an error

InvalidArgsError: (<class 'org.hipparchus.geometry.euclidean.threed.Vector3D'>, 'scalarMultiply', 1.0)

(I don’t think the problem is limited to scalarMultiply(), it just happens to be the first Orekit function called.) I am able to run the example given in the scipy documentation without problem.

What is the resolution to this problem, or, short of that, what techniques can I use to debug?

Hi there,

I believe you’re giving to scalarMultiply something that is not a native Python float (maybe a Numpy object instead). Use float() on the input.

Cheers,
Romain.

You’re absolutely right, calling float() on the multiplier argument sent to scalarMultiply() fixes the problem. Thank you.

2 Likes