Advanced maths

Piecewise function grapher with open and closed endpoints

Plot multiple formula-and-condition pieces with included or excluded endpoints, inspect a query x and export an SVG without joining branch gaps.

Your numbers

Add or remove rows to change the pieces. Examples: x^2 ; x<0 or sin(x) ; 0<=x<pi. Use all for every x, = for an isolated point and != for an exclusion. Up to 12 pieces.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Try it, understand it

Explore the result

Change formulas and boundary rules independently, then inspect which rows actually assign the selected x.

Worked example comparison
ExampleOutputWhat to notice
Jump at zeroValues assigned at x=0Piece 2: 1An open (0,0) and filled (0,1) distinguish approach from assignment.
Change one isolated valueValues assigned at x=0Piece 2: 3The quadratic excludes zero while a separate branch assigns three.
A gap in the domainValues assigned at x=0No piece assigns this xNo row assigns zero; the tool does not fill the missing interval.
Overlapping definitionsValues assigned at x=0.5Piece 1: 0.5; Piece 2: -0.5Both assignments are retained, making the conflict at 0.5 visible.
Finite sine branchValues assigned at x=1.57079632679Piece 1: 1A bounded nonpolynomial formula uses the same explicit domain rules.

Check your understanding

Does x<0 include zero?

No. A separate equality or inclusive condition is required to assign a value there.

Can two overlapping formulas still describe one function?

They can if they agree on the entire intersection. An overlap warning alone does not establish disagreement.

Behind the numbers

How this calculation works

Enter one formula and one domain condition per row, separated by a semicolon. The graph draws each matching branch independently and distinguishes included endpoints from finite excluded endpoints. Check all assignments at a selected x without silently resolving overlaps. Add more rows for more pieces, then export the SVG.

THE FORMULAFor each piece, use its formula only where its domain condition is satisfied; boundaries retain strict or inclusive comparison signs

A worked example

For x² when x<0 and 2x+1 when x≥0, the left formula approaches zero at the join but excludes x=0. The right formula includes the point (0,1). The graph shows an open dot at (0,0) and a filled dot at (0,1), making the jump visible.

Good to know

1–12 bounded expressions with supported one-variable comparisons; graph bounds and query within ±1000. Curves are finite samples, not continuity or limit proofs. Overlaps are retained without priority, and a gap is not silently filled. Included undefined samples or query values cause an error. An excluded undefined endpoint has no finite endpoint marker.

A domain condition is part of the formula

A piecewise definition combines formulas with conditions specifying where each formula applies. Writing x² on one row does not mean that expression supplies the value everywhere. If its condition is x<0, it applies only to negative inputs. At any query x, first test the condition and then evaluate the corresponding expression.

Enter one expression and one condition on each line, separated by a semicolon. Add or remove lines to change the number of pieces. The condition parser supports one-sided and chained comparisons, including strict and inclusive endpoints. Constant bounds can use the same bounded arithmetic notation as the expression parser, so 0<=x<pi is a useful trigonometric example.

The continuity and discontinuity diagnostic calculator separately checks one bounded expression at a point. Matching finite probes do not prove an arbitrary limit, and a graph alone does not assign a missing endpoint value.

A little curiosity

Follow a jump at the join

Consider x² for x<0 and 2x+1 for x≥0. As negative x values move toward zero, the first formula approaches zero. That branch excludes x=0, so the formula’s finite endpoint value is drawn with an open dot at (0,0). The second branch includes zero and assigns 2×0+1=1, giving a filled dot at (0,1).

These marks communicate two separate pieces of information: the limiting shape of a branch and the value actually assigned at the endpoint. A graph that joins those dots with one continuous line would misrepresent the definition. This tool keeps branch polylines separate and checks the query independently, so the displayed value at zero comes from the inclusive branch rather than from whichever line was drawn first.

Read strict and inclusive comparisons carefully

The signs x<2 and x≤2 differ at exactly one input. That difference matters when defining a function value or testing whether adjacent domains meet. A chained condition such as −2<x≤2 intersects two restrictions: the lower endpoint is excluded and the upper endpoint is included. The table reports whether the query satisfies the full condition, not just its first comparison.

An equality such as x=0 can assign an isolated value. For example, x² on x!=0 together with the constant 3 on x=0 keeps the familiar quadratic away from zero but assigns a different height at that single point. The excluded quadratic endpoint and included isolated point are shown separately. Neither a tiny visual gap nor a coincident plotted pixel is used to decide the actual membership rule.

Do not silently resolve overlapping definitions

The original task allows multiple pieces to overlap in the same horizontal region, so the grapher retains each entered branch rather than imposing an undocumented first-match order. The same query can therefore match more than one row. If the formulas give different values there, the entered relation is not a single-valued function at that x.

A reported overlap counts pairs of conditions with a nonempty intersection. It does not prove that their formulas disagree throughout that intersection. Two expressions can define the same value on an overlapping domain. Review the query values and the formulas before deciding whether the overlap is harmless duplication or a genuine conflict. Gaps are handled just as explicitly: a query in a gap receives no invented value.

Use finite sampling without mistaking it for a limit proof

Each visible domain interval is sampled separately and the graph joins the resulting coordinates. Included samples and active query values must be finite. When an excluded endpoint has a finite formula value, that value can be used for the open dot. If the excluded formula value is undefined, the page does not invent a finite endpoint dot or claim to have proved an infinite limit.

For example, 1/x with x!=0 excludes the pole itself. A finite graph still cannot prove the behavior arbitrarily close to zero, and a coarse collection of samples can miss rapid changes or interior singularities. The graph is an illustration of entered formulas and domain rules, not a continuity checker, symbolic limit solver or proof that every point between samples is valid.

The Riemann sums calculator uses a different sampling construction to approximate signed accumulation. The trigonometric function grapher instead studies a single transformed sine or cosine wave with analytic period and range. Those related tools do not establish continuity for an arbitrary collection of pieces.

Keep the requested window separate from the domain

A condition such as x≥0 describes an unbounded domain. The finite drawing clips it to the selected graph window without declaring the clipped edge to be a new domain endpoint. Only actual finite domain boundaries receive endpoint markers. A y=0 baseline records the requested horizontal span so a narrow branch does not silently change the viewing window.

The copied result records every definition, the window and all assignments at the query. The SVG preserves the separately drawn branches and boundary markers. Keep those settings with a shared illustration: without the inequalities, a plotted curve alone cannot fully describe which endpoint values belong to the definition.

A few questions, answered

Can I add more pieces?

Yes. Add more expression ; condition rows, up to twelve. Each row is parsed and drawn independently.

What do open dots mean?

The branch excludes that endpoint, although its formula has a finite value there. A separate inclusive branch can still assign a value at the same x.

Which piece wins when conditions overlap?

No priority is imposed. All matching assignments are displayed so you can inspect whether they agree.

Can I exclude one point?

Yes. Use a condition such as x!=0. You may add a separate equality branch such as 3 ; x=0.

Does the graph prove continuity?

No. It joins finite samples and shows stated endpoint membership. Limits and continuity require additional mathematical analysis.

Find your calculator

Start typing to explore the library.