numerical_integral( function
, begin
, end
[ , params=[]
] )
The numerical integral in SageMath of function
from begin
to end
. The returned output is a tuple consisting of the value of the integral and and an error estimate.
This operation assumes that the variable of integration is the first argument of function
. The optional params
argument is used to include additional numerical parameters as a list. These parameters are assigned in the order in which they appear as arguments in the definition of function
.
The function to be integrated must return real values, not complex values.
For complicated integrals SciPy’s quad
is significantly faster. It needs to be imported from scipy.integrate
. The argument corresponding to params
is named args
and works the same way.
Examples:
numerical_integral( x, 0, 1 )
f(x,a,b) = x + a + b^2 [numerical_integral( f, 0, 1, params=[n,0] ) for n in range(1,4)]
f(x,a,b) = x + a + b^2 [numerical_integral( f, 0, 1, params=[0,n] ) for n in range(1,4)]
Related operations: integral
Operation category: calculus operations sagemath-docs