ValueError when using scipy least_squares
The problem is:
- case A: your initial-point
- case B: your function
model
Giving the start-point x0 = np.array([0.1,0.2])
(and also u,y
), calling fun(x0, u, y)
, the following happens:
np.sqrt((x[1]/u) - 1) # part of model(x, u)= np.sqrt((0.2 / u) - 1)= np.sqrt(some_near_zero_vector - 1) # because u much bigger than 0.2= np.sqrt(some_near_minus_one_vector)= NaN-vector, which is not finite! # because of negative components in sqrt