![Piecewise linear function gnuplot](https://upload.wikimedia.org/wikipedia/commons/e/e9/Piecewise_linear_function_gnuplot.svg)
In
mathematics
Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
, a piecewise-defined function (also called a piecewise function, a hybrid function, or definition by cases) is a
function
Function or functionality may refer to:
Computing
* Function key, a type of key on computer keyboards
* Function model, a structured representation of processes in a system
* Function object or functor or functionoid, a concept of object-oriente ...
defined by multiple sub-functions, where each sub-function applies to a different interval in the domain.
Piecewise definition is actually a way of expressing the function, rather than a characteristic of the function itself.
A distinct, but related notion is that of a property holding piecewise for a function, used when the domain can be
divided into intervals on which the property holds. Unlike for the notion above, this is actually a property of the function itself. A
piecewise linear function (which happens to be also continuous) is depicted as an example.
Notation and interpretation
Piecewise functions can be defined using the common
functional notation
In mathematics, a function from a set to a set assigns to each element of exactly one element of .; the words map, mapping, transformation, correspondence, and operator are often used synonymously. The set is called the domain of the functi ...
, where the body of the function is an array of functions and associated subdomains. These subdomains together must cover the whole
domain
Domain may refer to:
Mathematics
*Domain of a function, the set of input values for which the (total) function is defined
**Domain of definition of a partial function
**Natural domain of a partial function
**Domain of holomorphy of a function
* Do ...
; often it is also required that they are pairwise disjoint, i.e. form a partition of the domain. In order for the overall function to be called "piecewise", the subdomains are usually required to be intervals (some may be degenerated intervals, i.e. single points or unbounded intervals). For bounded intervals, the number of subdomains is required to be finite, for unbounded intervals it is often only required to be locally finite. For example, consider the piecewise definition of the
absolute value
In mathematics, the absolute value or modulus of a real number x, is the non-negative value without regard to its sign. Namely, , x, =x if is a positive number, and , x, =-x if x is negative (in which case negating x makes -x positive), an ...
function:
:
For all values of
less than zero, the first function (
) is used, which negates the sign of the input value, making negative numbers positive. For all values of
greater than or equal to zero, the second function is used, which evaluates trivially to the input value itself.
The following table documents the absolute value function at certain values of
:
{, class="wikitable"
!style="width: 3em" , ''x''
!style="width: 3em" , ''f''(''x'')
!Function used
, -
, −3 , , 3 , ,
, -
, −0.1, , 0.1, ,
, -
, 0 , , 0 , ,
, -
, 1/2 , , 1/2, ,
, -
, 5 , , 5 , ,
, -
Here, notice that in order to evaluate a piecewise function at a given input value, the appropriate subdomain needs to be chosen in order to select the correct function—and produce the correct output value.
Continuity and differentiability of piecewise functions
A piecewise function is
continuous
Continuity or continuous may refer to:
Mathematics
* Continuity (mathematics), the opposing concept to discreteness; common examples include
** Continuous probability distribution or random variable in probability and statistics
** Continuous ...
on a given interval in its domain if the following conditions are met:
* its constituent functions are continuous on the corresponding intervals (subdomains),
* there is no discontinuity at each endpoint of the subdomains within that interval.
The pictured function, for example, is piecewise-continuous throughout its subdomains, but is not continuous on the entire domain, as it contains a jump discontinuity at
. The filled circle indicates that the value of the right function piece is used in this position.
For a piecewise function to be differentiable on a given interval in its domain, the following conditions have to fulfilled in addition to those for continuity above:
* its constituent functions are differentiable on the corresponding ''open'' intervals,
* the one-sided derivatives exist at all intervals endpoints,
* at the points where two subintervals touch, the corresponding one-sided derivatives of the two neighboring subintervals coincide.
Applications
In applied mathematical analysis, piecewise functions have been found to be consistent with many
models of the human visual system, where images are perceived at a first stage as consisting of smooth regions separated by edges.
In particular,
shearlet In applied mathematical analysis, shearlets are a multiscale framework which allows efficient encoding of anisotropic features in multivariate problem classes. Originally, shearlets were introduced in 2006 for the analysis and sparse approximation o ...
s have been used as a representation system to provide sparse approximations of this model class in 2D and 3D.
Common examples
*
Piecewise linear function, a piecewise function composed of line segments
**
Step function
In mathematics, a function on the real numbers is called a step function if it can be written as a finite linear combination of indicator functions of intervals. Informally speaking, a step function is a piecewise constant function having only ...
, a piecewise function composed of constant functions
***
Boxcar function
In mathematics, a boxcar function is any function which is zero over the entire
real line except for a single interval where it is equal to a constant, ''A''. The boxcar function can be expressed in terms of the uniform distribution as
\operatorn ...
,
***
Heaviside step function
The Heaviside step function, or the unit step function, usually denoted by or (but sometimes , or ), is a step function, named after Oliver Heaviside (1850–1925), the value of which is zero for negative arguments and one for positive argume ...
***
Sign function
In mathematics, the sign function or signum function (from '' signum'', Latin for "sign") is an odd mathematical function that extracts the sign of a real number. In mathematical expressions the sign function is often represented as . To avoi ...
**
Absolute value
In mathematics, the absolute value or modulus of a real number x, is the non-negative value without regard to its sign. Namely, , x, =x if is a positive number, and , x, =-x if x is negative (in which case negating x makes -x positive), an ...
**
Triangular function
A triangular function (also known as a triangle function, hat function, or tent function) is a function whose graph takes the shape of a triangle. Often this is an isosceles triangle of height 1 and base 2 in which case it is referred to as ''th ...
*
Broken power law
In statistics, a power law is a functional relationship between two quantities, where a relative change in one quantity results in a proportional relative change in the other quantity, independent of the initial size of those quantities: one qua ...
, a piecewise function composed of power laws
*
Spline, a piecewise function composed of polynomial functions, possessing a high degree of smoothness at the places where the polynomial pieces connect
**
B-spline
In the mathematical subfield of numerical analysis, a B-spline or basis spline is a spline function that has minimal support with respect to a given degree, smoothness, and domain partition. Any spline function of given degree can be expresse ...
*
PDIFF
In geometric topology, PDIFF, for ''p''iecewise ''diff''erentiable, is the category of piecewise-smooth manifolds and piecewise-smooth maps between them. It properly contains DIFF (the category of smooth manifolds and smooth functions between them ...
*
and some other common
Bump function
In mathematics, a bump function (also called a test function) is a function f: \R^n \to \R on a Euclidean space \R^n which is both smooth (in the sense of having continuous derivatives of all orders) and compactly supported. The set of all bump f ...
s. These are infinitely differentiable, but analyticity holds only piecewise.
* Continuous functions in the reals need not be bounded or uniformly continuous, but are always piecewise bounded and piecewise uniformly continuous.
See also
*
Piecewise linear continuation Simplicial continuation, or piecewise linear continuation (Allgower and Georg),Eugene L. Allgower, K. Georg, "Introduction to Numerical Continuation Methods", ''SIAM Classics in Applied Mathematics'' 45, 2003.E. L. Allgower, K. Georg, "Simplicial an ...
References
{{Reflist
Functions and mappings