Piecewise Function Calculator – Evaluate Functions by Parts
Evaluate piecewise-defined functions at specific x values
How to Use
- Enter the x value you want to evaluate
- Define the first piece with a condition (e.g., x < 0) and expression (e.g., x^2)
- Add additional pieces with their conditions and expressions
- Use 'otherwise' for a catch-all condition
- Click calculate to see which piece applies and the result
What is a Piecewise Function?
A piecewise function is a function defined by multiple sub-functions, each applying to a specific interval of the domain. The function 'switches' between different formulas depending on the input value.
Piecewise functions are written using a brace notation that shows each piece alongside its condition. For example, f(x) = x² if x < 0, and f(x) = 2x if x ≥ 0.
How to Evaluate Piecewise Functions
To evaluate a piecewise function at a specific x value:
- Identify which condition the x value satisfies
- Use the corresponding expression for that condition
- Substitute the x value into that expression
- Calculate the result
Examples of Piecewise Functions
Common examples of piecewise functions include:
- Absolute value: |x| = x if x ≥ 0, -x if x < 0
- Step functions: f(x) = 0 if x < 0, 1 if x ≥ 0
- Tax brackets: different rates for different income ranges
- Shipping costs: different rates based on weight ranges
Continuity of Piecewise Functions
A piecewise function is continuous at a boundary point if the left-hand limit, right-hand limit, and function value all agree at that point. Discontinuities occur when pieces don't connect smoothly.
To check continuity at a boundary x = a, verify that the limit from the left equals the limit from the right equals f(a).
Real-World Applications
- Tax calculations with progressive brackets
- Utility billing with tiered pricing
- Shipping cost calculations
- Speed limits in different zones
- Insurance premiums based on age groups
- Signal processing and digital filters
- Computer graphics and animation
Frequently Asked Questions
- What if my x value doesn't match any condition?
- If no condition matches, the function is undefined at that point. Use 'otherwise' as a catch-all condition to handle all remaining cases.
- How do I write conditions for this calculator?
- Use standard inequality notation: x < 0, x >= 2, x = 5. For ranges, use compound conditions like -1 <= x < 3. Use 'otherwise' for a default case.
- What expressions can I use?
- You can use polynomial expressions with x, including powers (x^2), multiplication (2x or 2*x), addition, and subtraction. For example: x^2 + 2x - 1.
- Can piecewise functions be continuous?
- Yes, if the pieces connect smoothly at boundary points. For continuity, the function values from adjacent pieces must match at their shared boundary.