I am using the least_square method from the scipy library. I give the function to minimize "zkDistErrs" and give the initial guess as "rv". I also give some extra arguments by using "args=". Finally, I give the method the Jacobian matrix as a callable function "jacobian".
Both "zkDistErrs" and "jacobian" have the same input arguments : "rv0, t0, data, mu". And my problem is that, while running, it seems like least_square calls "jacobian" and gives the initial "rv" everytime even though it changes every iteration within the least_square method.
Here is the code:
def orbit_det(t0,rv,data,planet):
res = scipy.optimize.least_squares(zkDistErrs, rv, args=( t0,data,planet.mu ),jac=jacobian, method='lm',ftol=1e-2,xtol=1e-3)
return res
def jacobian(rv0, t0, data, mu):
def zkDistErrs(rv0, t0, data, mu):
Thank you very much !