Skip to content
ENExplore Calculators

Piecewise Function Calculator

Evaluate a piecewise-defined function at x by selecting the matching interval branch.

About Piecewise Function Calculator

A piecewise function uses different expressions on different intervals. This calculator evaluates a two-piece function: f₁(x) when x < boundary, and f₂(x) when x ≥ boundary. It also checks the one-sided limits at the boundary to indicate continuity.

Formula

Piecewise definition

f(x) = { f₁(x) if x < c ; f₂(x) if x ≥ c }

c
Boundary value
f₁
Left branch
f₂
Right branch

Worked example

With the default values below, Piecewise Function Calculator returns f(x) of 7.00000000. Change any input above and every figure here is recalculated in your browser.

Inputs used

f₁(x) (when x < boundary)
x^2
Boundary value
0
f₂(x) (when x ≥ boundary)
2*x + 1
x value to evaluate
3

Results

f(x)
7.00000000
Branch Used
f₂(x) = 2*x + 1 (x ≥ 0)
Left limit at boundary
0.000000
Right limit at boundary
1.000000

Step by step

  1. 1Values used
  2. 2Piecewise definition
  3. 3f(x)= 7.00000000
  4. 4Branch Used= f₂(x) = 2*x + 1 (x ≥ 0)
  5. 5Left limit at boundary= 0.000000
  6. 6Right limit at boundary= 1.000000

Assumptions and limits

  • The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 8 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Can I have more than two pieces?

This calculator supports two pieces. For more complex piecewise functions, evaluate each piece separately using the Function Calculator.

How do I check if the function is continuous?

Compare the left limit and right limit at the boundary. If they are equal, the function is continuous at that point.

Piecewise Function Calculator – Calculate f(x) & Branch Used