Skip to content

Piecewise Function Calculator

Define a function using different formulas and conditions, evaluate it at any x-value, and view a clear graph instantly.

f(x)

Define your function

Your result

FUNCTION VALUE
f(2) = 4
Matched piece: x² when x ≥ 0
Input valuex = 2
Pieces defined2
Domain statusDefined
Active formulax^2

How piecewise functions work

1. Add formulas

Enter each expression using x, such as x^2, 2*x+1, or sqrt(x).

2. Set conditions

Use conditions like x<0, x>=0, or x>1 && x<=5.

3. Evaluate

The calculator uses the first condition that is true for your chosen x-value.

Supported syntax: Use +, −, *, /, ^, parentheses, abs(x), sqrt(x), sin(x), cos(x), tan(x), log(x), exp(x), pi, and e. Conditions support <, <=, >, >=, ==, !=, &&, and ||.

Frequently asked questions

What is a piecewise function?

A piecewise function uses different formulas for different portions of its domain.

Does the order of pieces matter?

Yes. If conditions overlap, the calculator uses the first matching piece from the top.

Can the function be undefined?

Yes. If none of your conditions match the selected x-value, the result is shown as undefined.

Math Calculation Disclaimer

Results are estimates generated locally in your browser using standard mathematical formulas. They are for informational and educational purposes only and are not a substitute for verification in coursework, examinations or professional contexts requiring certified accuracy. VisionVix accepts no liability for decisions based on this tool's output.

🎁 WELCOME GIFT

🎁 Get 5 FreeAI Credits

Leave your email and get 5 free credits on VisionVix — our AI agent marketplace with 500+ tools. Plus, be first to know when new calculators go live here. No spam, ever.

Thanks — your credits are being prepared.

Credits added to your VisionVix account within 24 hours.
VisionVix AI agent dashboard on a laptop

500+ AI Agents

📊

Smart Calculators

🔔

Early Access

🛡️

No Spam, Ever