I'm trying to use fsolve
in combination with the mpmath
package.
However, I get the error cannot create mpf from array([mpf('1.0')], dtype=object)
.
Here is a minimal example reproducing the error. For this example, I technically do not need the mpmath
package, but my actual function contains hyperconfluent functions that do.
from scipy.optimize import fsolve
#from mpmath import hyp1f1 as hyp1f1mp
#from mpmath import gamma as gammamp
import mpmath as mp
#import numpy as np
mp.dps = 250; mp.pretty = True
def cosFunc(p):
vn = p
output = mp.sin(vn)
return output
estimate = mp.mpf(1)
value = fsolve(cosFunc,estimate)
print value
I found a similar question suggesting to use np.frompyfunc
(How to mpf an array?), but it tells me that the function is not callable (when I apply it on vn
).