Piecewise Function Integral Calculator
This piecewise function integral calculator evaluates the integral of functions defined differently on different intervals. It handles piecewise functions by breaking them into their component parts and integrating each part separately.
How to Use This Calculator
To calculate the integral of a piecewise function:
- Enter the function definition in the text area, specifying different expressions for different intervals.
- Enter the lower and upper limits of integration.
- Click "Calculate" to compute the integral.
- Review the result and the step-by-step calculation.
Example format for a piecewise function: x^2 for x < 1, x+1 for x >= 1
How Piecewise Integrals Work
Piecewise functions are defined differently on different intervals. To integrate them, we:
- Identify the intervals where the function changes definition.
- Integrate each part separately over its respective interval.
- Sum the results of each individual integral.
For a piecewise function f(x) = {f₁(x) for a ≤ x < b, f₂(x) for b ≤ x ≤ c}, the integral is:
∫[a to c] f(x) dx = ∫[a to b] f₁(x) dx + ∫[b to c] f₂(x) dx
Worked Examples
Example 1: Simple Piecewise Function
Function: f(x) = {x for 0 ≤ x < 1, x² for 1 ≤ x ≤ 2}
Integral from 0 to 2:
∫[0 to 1] x dx + ∫[1 to 2] x² dx = [x²/2]₀¹ + [x³/3]₁² = (1/2 - 0) + (8/3 - 1/3) = 0.5 + 7/3 ≈ 2.6667
Example 2: Absolute Value Function
Function: f(x) = {x for x ≥ 0, -x for x < 0}
Integral from -1 to 1:
∫[-1 to 0] -x dx + ∫[0 to 1] x dx = [x²/2]₋₁⁰ + [x²/2]₀¹ = (0 - 1/2) + (1/2 - 0) = -0.5 + 0.5 = 0