DGS Studio

Advanced Visualization

Piecewise & Discontinuities

Visualize piecewise functions, open/closed points, and discontinuities.

The braces list the pieces in order. The first matching condition wins. This definition is y = { x if x < 0; x+2 if x >= 0 }. At x = 0 the left piece reaches 0 and the right piece starts at 2, so the graph jumps.

A strict inequality is drawn with an open endpoint. An inclusive bound is a filled endpoint. DGS does not connect the two y-values with a vertical line, because a function graph does not contain that segment.

Equation

y = { x if x < 0; x+2 if x >= 0 }

How an explicit graph works

An explicit graph gives y directly from x. Every vertical line meets the curve once, except where the expression is undefined. DGS draws it on the 2D board and, for an ordinary function, can mark intercepts, extrema, and asymptotes without changing the equation you typed.

Domain matters. Square roots and logarithms stop where their inputs are invalid, and rational functions and tangent open a gap at a pole. A slider letter such as a, b, or c is not a second curve. In DGS the lowercase names a, b, and c start at 4, 3, and 5 unless the input assigns them.

Reading the input

Other versions of this example

These stay on this page so each version keeps the same explanation. Choose Try example to run a version in its Studio workflow, or copy it into the editable field below.

Piecewise function

This line defines an explicit function. The left side is the vertical coordinate, and the right side is evaluated for each x.

y = { x if x < 0; x+2 if x >= 0 }

Hole / Removable Discontinuity

This line defines an explicit function. The left side is the vertical coordinate, and the right side is evaluated for each x.

y=(x^2-1)/(x-1)

Try a change

Generate Graph posts the expression to the studio graph engine and draws the result on the homepage. The editable field is the entire input, including every line.

Edit and generate

Generate Graph opens the studio homepage and runs this field. Open in DGS Studio loads the same text and waits for you to generate it. The equation is sent once, as a query parameter.

Related examples