Calculate the definite integral of a function from a to b.
This function calculates the definite integral of a univariate function on the interval .
- Parameters:
-
fun | The function (or functor) whose definite integral is to be calculated. This function should both take and return a single argument of type T. |
a | The starting value of the interval. |
b | The ending value of the interval. |
N | The number of subintervals to calculate. Increasing this number will improve the accuracy of the estimate but will also increase run-time. |
tol | The accuracy required. Both accuracy and run-time decrease as this number increases. |
- Exceptions:
-
- See also:
- intsimp(FUNCTOR fun, T a, T b, unsigned int& N)
- Note:
- Users will typically wish to implement fun in terms of a functor. Using a functor provides a generic way in which to evaluate functions with more than one parameter. Furthermore, although one can pass a function pointer to this routine, the compiler cannot inline and fully optimize code referenced by function pointers.
References fabs(), intsimp(), and SCYTHE_CHECK_10.