Piecewise Function Evaluator
Evaluate a two-piece function at a point.
Enter your values
Enter the threshold c you are working with.
Enter the slope m1 (x<c) you are working with.
Enter the intercept b1 (x<c) you are working with.
Enter the slope m2 (x>=c) you are working with.
Enter the intercept b2 (x>=c) you are working with.
Enter the value to evaluate x you are working with.
Results update instantly as you type — no submit needed. Your values are remembered on this device, and the shareable link reopens the calculator with exactly these numbers.
- f(x)
- 2
- Branch used
- m2x+b2 (x >= 0)
- x value
- 3
- Threshold
- 0
Quick answer
The evaluator picks the branch based on whether x is below or at/above the threshold, then applies that branch's slope and intercept.
f(x) = m1x+b1 if x<c, else m2x+b2
At a glance
| What it does | Evaluate a two-piece function at a point. |
|---|---|
| Category | Math |
| Inputs needed | Threshold c, Slope m1 (x<c), Intercept b1 (x<c), Slope m2 (x>=c), Intercept b2 (x>=c), Value to evaluate x |
| Main output | f(x) |
| Formula | f(x) = m1x+b1 if x<c, else m2x+b2 |
| Cost | Free — no sign-up, no download |
How to use the Piecewise Function Evaluator
- 1Enter the threshold c that splits the domain.
- 2Enter the slope and intercept for each branch.
- 3Enter the x value to test — the calculator picks the right branch automatically.
Inputs explained
- Threshold c
- Enter the threshold c you are working with.
- Slope m1 (x<c)
- Enter the slope m1 (x<c) you are working with.
- Intercept b1 (x<c)
- Enter the intercept b1 (x<c) you are working with.
- Slope m2 (x>=c)
- Enter the slope m2 (x>=c) you are working with.
- Intercept b2 (x>=c)
- Enter the intercept b2 (x>=c) you are working with.
- Value to evaluate x
- Enter the value to evaluate x you are working with.
Worked example
Using the values the calculator loads with:
Inputs
- Threshold c0
- Slope m1 (x<c)2
- Intercept b1 (x<c)1
- Slope m2 (x>=c)-1
- Intercept b2 (x>=c)5
- Value to evaluate x3
Results
- f(x)2
- Branch usedm2x+b2 (x >= 0)
- x value3
- Threshold0
Frequently asked questions
What is a piecewise function?
A function defined by different expressions over different parts of its domain.
Can branches be non-linear?
This tool models linear branches; for other shapes evaluate each piece manually at your x.
What do I need to enter into the Piecewise Function Evaluator?
Just 6 values: threshold c, slope m1 (x<c), intercept b1 (x<c), slope m2 (x>=c), intercept b2 (x>=c), value to evaluate x. Every field starts with a realistic example, so you can change one number at a time and watch the result update instantly.
How does the Piecewise Function Evaluator work out the answer?
The evaluator picks the branch based on whether x is below or at/above the threshold, then applies that branch's slope and intercept. It applies the formula f(x) = m1x+b1 if x<c, else m2x+b2 and shows the working so you can check each step by hand.
Is the Piecewise Function Evaluator free, and do I need an account?
It is completely free with no sign-up, no download and no usage limit. Everything is calculated in your browser, so the numbers you type never leave your device.
Results are estimates for general information. For medical, legal, structural or financial decisions, confirm with a qualified professional.