Use the responsive grid below. Large screens show three columns, smaller screens show two, and mobile shows one.
This sample uses three rules: x² for x < 0, 2x + 1 for 0 ≤ x < 3, and 10 − x for x ≥ 3.
| x | Matching rule | f(x) |
|---|---|---|
| -2 | x^2 for x < 0 | 4 |
| 0 | 2x + 1 for 0 ≤ x < 3 | 1 |
| 2 | 2x + 1 for 0 ≤ x < 3 | 5 |
| 5 | 10 - x for x ≥ 3 | 5 |
A piecewise function uses different formulas on different intervals. The calculator checks the input value against each interval in order. The first interval that contains x becomes the active rule.
f(x) = { f₁(x) if condition₁; f₂(x) if condition₂; ... ; fₙ(x) if conditionₙ }Evaluation process
1. Compare x with each interval boundary.
2. Respect inclusive and exclusive endpoints.
3. Select the first matching piece.
4. Substitute x into that expression.
5. Compute the final numeric result.
Example: if f(x) = x² for x < 0 and f(x) = 2x + 1 for 0 ≤ x < 3, then
f(2) = 2(2) + 1 = 5.
- Enter the x value you want to evaluate.
- Choose how many pieces your function uses.
- For each piece, enter a label, formula, and interval bounds.
- Choose whether each boundary is inclusive or exclusive.
- Set graph range and sample points if needed.
- Press Evaluate Function.
- Read the selected rule, substitution step, final value, and graph.
- Use the export buttons to download CSV or PDF outputs.
1. What is a piecewise function?
A piecewise function uses different formulas on different parts of the number line. The correct formula depends on where the input value falls.
2. What do inclusive and exclusive endpoints mean?
Inclusive means the boundary value is part of the interval. Exclusive means the boundary value is not included. Symbols like ≤ and ≥ are inclusive, while < and > are exclusive.
3. What happens if two pieces overlap?
The calculator checks pieces from top to bottom. If more than one interval could contain x, the first matching piece is used. Arrange overlapping rules carefully.
4. Can I leave a bound blank?
Yes. A blank lower bound means the interval extends left without limit. A blank upper bound means the interval extends right without limit.
5. Which functions can I enter inside expressions?
You can use sin, cos, tan, asin, acos, atan, sqrt, abs, exp, ln, log, log10, floor, ceil, round, min, max, pow, and pi.
6. Why does the graph sometimes show gaps?
Gaps appear when a piece does not apply on part of the graph range, or when the formula becomes undefined at certain x values. This is expected for many piecewise models.
7. Can I use decimals and negative numbers?
Yes. The calculator accepts decimal inputs, negative values, and decimal interval boundaries. This helps with continuous models and real-world datasets.
8. What do the CSV and PDF downloads include?
The CSV export stores the evaluated input, output, selected condition, and all active pieces. The PDF export creates a clean summary of the current result.