scipy.integrate.
fixed_quad#
- scipy.integrate.fixed_quad(func, a, b, args=(), n=5)[Quelle]#
Berechnet ein bestimmtes Integral mittels Gauß-Quadratur fester Ordnung.
Integriert func von a nach b mittels Gauß-Quadratur der Ordnung n.
- Parameter:
- funccallable
Eine Python-Funktion oder -Methode zur Integration (muss Vektorinputs akzeptieren). Bei der Integration einer vektorwertigen Funktion muss das zurückgegebene Array die Form
(..., len(x))haben.- afloat
Untere Integrationsgrenze.
- bfloat
Obere Integrationsgrenze.
- argstuple, optional
Zusätzliche Argumente, die an die Funktion übergeben werden sollen, falls vorhanden.
- nint, optional
Ordnung der Quadraturintegration. Standardwert ist 5.
- Rückgabe:
- valfloat
Gauß-Quadratur-Approximation des Integrals
- noneNone
Statisch zurückgegebener Wert von None
Siehe auch
Beispiele
>>> from scipy import integrate >>> import numpy as np >>> f = lambda x: x**8 >>> integrate.fixed_quad(f, 0.0, 1.0, n=4) (0.1110884353741496, None) >>> integrate.fixed_quad(f, 0.0, 1.0, n=5) (0.11111111111111102, None) >>> print(1/9.0) # analytical result 0.1111111111111111
>>> integrate.fixed_quad(np.cos, 0.0, np.pi/2, n=4) (0.9999999771971152, None) >>> integrate.fixed_quad(np.cos, 0.0, np.pi/2, n=5) (1.000000000039565, None) >>> np.sin(np.pi/2)-np.sin(0) # analytical result 1.0