Create mpf from array
Ich versuche, @ zu verwendfsolve
in Kombination mit demmpmath
package. Allerdings bekomme ich den Fehlercannot create mpf from array([mpf('1.0')], dtype=object)
.
Hier ist ein minimales Beispiel, das den Fehler reproduziert. Für dieses Beispiel brauche ich das @ technisch nicmpmath
Paket, aber meine eigentliche Funktion enthält hyperkonfluente Funktionen, die das tun.
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
Ich habe eine ähnliche Frage gefunden, die vorschlägt, @ zu verwendenp.frompyfunc
(Wie man ein Array mpf?), aber es sagt mir, dass die Funktion nicht aufrufbar ist (wenn ich es auf @ anwendvn
).