Nepedia
Back to Discover
Advanced Reader
🔢

Piecewise function

math Maturity 11-13 Next article →

A piecewise function is a mathematical rule that changes depending on the input value. You might also hear it called a piecewise-defined function, a hybrid function, or a function defined by cases. In these functions, the domain—the set of all possible input values—is partitioned into several distinct intervals called subdomains.

Piecewise linear function gnuplot
Piecewise linear function gnuplot

Within each subdomain, the function follows its own specific rule, which is known as a sub-function. This method allows mathematicians to describe complex behaviors by breaking them into simpler, manageable parts. While any function can technically be rewritten this way, the term often describes a specific property of a function itself.

To evaluate a piecewise function, you must follow a specific sequence of steps. First, you look at your input value to determine which subdomain it belongs to. Once you identify the correct interval, you select the sub-function associated with that specific part.

Absolute value
Absolute value

For example, consider the absolute value function. This function uses one rule for all values where x is less than zero. This sub-function negates the sign of the input to make negative numbers positive. For all values where x is greater than or equal to zero, it uses a different sub-function. This second rule simply evaluates the input value as it is. Thus, an input of -3 results in 3, while an input of 5 results in 5.

There are many different types of piecewise functions based on the nature of their sub-functions. A step function, or piecewise constant function, uses constant sub-functions to create a shape like stairs. A piecewise linear function is built from straight-line sub-functions. Other versions include piecewise smooth or piecewise continuous functions. You may also encounter splines, which are functions composed of polynomial sub-functions. Some splines are even constrained to be smooth at the joints where the pieces meet. Other complex types include broken power laws and B-splines.

Mathematically, the subdomains must cover the entire domain of the function. They are typically required to be nonempty intervals, which can be single points or unbounded. In many cases, these subdomains are pairwise disjoint, meaning they do not overlap. However, a weaker requirement allows for overlapping subdomains if all the definitions agree at the intersection. For functions with bounded domains, there are usually only a finite number of subdomains. Functions with unbounded domains can have infinitely many subdomains, provided they are spread out appropriately.

Upper semi
Upper semi

The way these pieces connect determines the continuity and differentiability of the function. A piecewise function is continuous on an interval if its sub-functions are continuous and there are no discontinuities at the subdomain endpoints. If a function has a break where one part ends and another begins, it has a jump discontinuity. For a function to be differentiable, it must first be continuous. Additionally, the one-sided derivatives at the endpoints must exist and coincide. This means the slopes of the two neighboring sub-functions must match perfectly where they touch.

These mathematical concepts are highly significant in applied mathematical analysis. For instance, piecewise-regular functions are consistent with models of the human visual system. Our eyes often perceive images as smooth regions separated by distinct edges, much like a cartoon. In these models, the function is smooth except for the existence of discontinuity curves. Researchers have used shearlets to provide sparse approximations for these types of 2D and 3D models. This shows how piecewise math helps us represent how we actually see the world.

Beyond vision, piecewise functions are vital for interpolation. This is a method used to estimate values between known data points, such as in nearest-neighbor interpolation. By using different rules for different segments, mathematicians can create highly accurate models for various scientific fields. Whether describing the sharp turn of an absolute value graph or the smooth curves of a spline, piecewise functions turn many individual parts into a single, coherent mathematical description.

652 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (4)
File:Piecewise linear function gnuplot.svg
Piecewise linear function gnuplot.svg
File:Absolute value.svg
Absolute value.svg
File:PiecewiseMonoDiff svg.svg
PiecewiseMonoDiff svg.svg
File:Upper semi.svg
Upper semi.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.