I am using
scipy.optimize.minimize_scalar and got an error:
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\site-packages\scipy\optimize\_minimize.py", line 873, in minimize_scalar
return _minimize_scalar_bounded(fun, bounds, args, **options)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\site-packages\scipy\optimize\_optimize.py", line 2210, in _minimize_scalar_bounded
if np.isnan(xf) or np.isnan(fx) or np.isnan(fu):
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
After changing the return of my objective function from
retVal = abs(q1In - PSq1IC(maxk, x)) to
retVal = float(abs(q1In - PSq1IC(maxk, x)))
things are working well.
My conclusion: scipy.optimize.minimize_scalar can deal with float and float64, but not Float.