Nepedia
Back to Discover
Fluent Reader
🔢

Piecewise function

math Maturity 11-13 Next article →

Imagine a path that changes its rules at different spots. In math, we call this a piecewise function. This type of function uses different rules for different sections. We call these sections subdomains. Each subdomain is a small part of a larger group.

Piecewise linear function gnuplot
Piecewise linear function gnuplot

A piecewise function is a way to specify how a function works. It can also be a property of the function itself. Some people call these hybrid functions or functions defined by cases. This helps us describe shapes that are not the same all the way through.

To use a piecewise function, you must first pick the right rule. You look at your input value to find its subdomain. Then, you use the specific sub-function for that section.

Absolute value
Absolute value

For example, look at the absolute value function. If a number is less than zero, it uses one rule. This rule makes negative numbers positive. If a number is zero or higher, it uses a different rule. This second rule simply keeps the number the same. For instance, the input -3 gives an output of 3. The input 5 gives an output of 5.

These functions can have many different shapes. A step function is made of constant sub-functions. This makes the graph look like a set of stairs.

You might also see a piecewise linear function. This uses straight lines for its parts. Other types include piecewise smooth or piecewise continuous functions. Some use polynomial parts and are called splines. Even power-law parts can be used to build these functions. These different pieces allow for very complex and interesting patterns.

Sometimes the pieces of a function join together perfectly. We call this being continuous.

Upper semi
Upper semi

For a function to be continuous, the parts must meet without any breaks. There should be no jump discontinuity at the endpoints. A jump discontinuity is a spot where the path skips. If the pieces meet smoothly, the function can also be differentiable. This means the slopes of the parts match where they touch. If they do not match, the function might have a sharp corner.

We use these ideas to understand the real world. For example, they help us model the human visual system. Our eyes often see smooth regions separated by sharp edges. This is very much like how a cartoon looks.

Absolute value
Absolute value

Scientists use these models to understand how we see images. We can also use piecewise functions for interpolation. This is a way to fill in gaps between known points. These math tools help us turn many small parts into one big picture.

425 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.