Ich versuche dies zu integrieren:Wie benutzt man tplquad?
integrieren (integrieren (integrieren (2 * sin (z) * cos (atan ((2 * cos (y) -0,5 + x)/(2 * sin (y)))), y, 0, pi/2), x, 0,1), z, 0, pi/2);
Wolfram finden die Lösung, aber ich möchte die Genauigkeit kontrollieren. Ich versuche es mit tplquad, aber es gibt einen Fehler.
def f(x,y,z):
return 2*sin(z)*cos(atan((2*cos(y)-0.5+x)/(2*sin(y))))
tplquad(f,0,1,0,pi/2,0,pi/2)
Die Fehler sind:
Blockquote Datei "", Zeile 3, in File „/usr/lib/python2.7/dist-packages/scipy/integrate/quadpack.py Zeile 526, in tplquad Rückkehr dblquad (_infunc2, a, b, gfun, hfun, (func, qfun, rfun, Args), epsabs = epsabs, epsrel = epsrel) Datei "/usr/lib/python2.7 /dist-packages/scipy/integrate/quadpack.py ", Zeile 461, in dblquad zurück Quad (_infunc, a, b, (Funktion, gfun, hfun, Args), epsabs = epsabs, Epsrel = Epsrel) Datei"/usr/lib/py thon2.7/dist-packages/scipy/integrate/quadpack.py ", Zeile 281, in Quad retval = _quad (func, a, b, args, full_output, epsab, epsrel, limit, punkte) Datei"/usr /lib/python2.7/dist-packages/scipy/integrate/quadpack.py ", Zeile 345, in _quad Rückgabe _quadpack._qagse (func, a, b, Argumente, full_output, epsabs, epsrel, Grenze) Datei" /usr/lib/python2.7/dist-packages/scipy/integrate/quadpack.py“, Linie 406, in _infunc a = gfun (x)
Haben Sie eine Idee, wo der Fehler aus kommen könnte ?
Es ist großartig! Danke –
Ich habe nur eine Frage über Parameter, verstehe ich nicht Lambda z: und nach Lambda z, x können Sie bitte erklären? –
@mpdesousa Der 'Lambda'-Operator erlaubt es, einfach einfache anonyme Funktionen zu definieren. Es ist ein grundlegendes Merkmal der Python-Sprache (siehe z. B. [hier] (http://stackoverflow.com/questions/890128/why-are-python-lambdas-useful)) – Stelios