Integral¶
Parameters¶
- \(f(x)\): integrand
- \([a,b]\): interval of integration
What it means¶
An integral accumulates quantities (often area under a curve) over an interval.
What it's used for¶
- Areas, accumulated change, and continuous probability.
- Solving differential and physical models.
Key properties¶
- Linear operator.
- Linked to derivatives by the Fundamental Theorem of Calculus.
Common gotchas¶
- Indefinite and definite integrals are different objects.
- Bounds and variable of integration are easy to mishandle.
Example¶
\(\int_0^1 x\,dx = 1/2\).
How to Compute (Pseudocode)¶
Input: function f, interval [a,b], numerical integration method, subdivisions n
Output: approximate integral value
# Example: composite trapezoidal rule
h <- (b - a) / n
total <- 0.5 * f(a) + 0.5 * f(b)
for i from 1 to n-1:
total <- total + f(a + i*h)
return h * total
Complexity¶
- Time: \(O(n)\) function evaluations for common fixed-grid numerical rules (for example, trapezoidal or midpoint)
- Space: \(O(1)\) extra space
- Assumptions: Numerical approximation of a definite integral is shown; symbolic integration uses different algorithms/workflows