Piecewise

From HandWiki
Short description: Function defined by multiple sub-functions
Plot of the piecewise linear function [math]\displaystyle{ f(x) = \left\{ \begin{array}{lll} -3-x & \text{if} & x \leq -3 \\ x+3 & \text{if} & -3 \leq x \leq 0 \\ 3-2x & \text{if} & 0 \leq x \leq 3 \\ 0.5x - 4.5 & \text{if} & 3 \leq x \\ \end{array} \right. }[/math]

In mathematics, a piecewise-defined function (also called a piecewise function, a hybrid function, or definition by cases) is a function defined by multiple sub-functions, where each sub-function applies to a different interval in the domain.[1][2][3] 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

Graph of the absolute value function, [math]\displaystyle{ y=|x| }[/math]

Piecewise functions can be defined using the common functional notation, where the body of the function is an array of functions and associated subdomains. These subdomains together must cover the whole domain; often it is also required that they are pairwise disjoint, i.e. form a partition of the domain.[4] 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 function:[2]

[math]\displaystyle{ |x| = \begin{cases} -x, & \text{if } x \lt 0 \\ +x, & \text{if } x \ge 0 . \end{cases} }[/math]

For all values of [math]\displaystyle{ x }[/math] less than zero, the first sub-function ([math]\displaystyle{ -x }[/math]) is used, which negates the sign of the input value, making negative numbers positive. For all values of [math]\displaystyle{ x }[/math] greater than or equal to zero, the second sub-function ([math]\displaystyle{ x }[/math]) is used, which evaluates trivially to the input value itself.

The following table documents the absolute value function at certain values of [math]\displaystyle{ x }[/math]:

x f(x) Sub-function used
−3 3 [math]\displaystyle{ -x }[/math]
−0.1 0.1 [math]\displaystyle{ -x }[/math]
0 0 [math]\displaystyle{ x }[/math]
1/2 1/2 [math]\displaystyle{ x }[/math]
5 5 [math]\displaystyle{ x }[/math]

In order to evaluate a piecewise-defined function at a given input value, the appropriate subdomain needs to be chosen in order to select the correct sub-function—and produce the correct output value.

Continuity and differentiability of piecewise-defined functions

Plot of the piecewise-quadratic function [math]\displaystyle{ f(x) = \left\{ \begin{array}{lll} x^2 & \text{if} & x \lt 0.707 \\ 1.5 - (x - 1.414)^2 & \text{if} & 0.707 \leq x \\ \end{array} \right. }[/math] Its only discontinuity is at [math]\displaystyle{ x_0 = 0.707 }[/math].

A piecewise-defined function is continuous on a given interval in its domain if the following conditions are met:

  • its sub-functions are continuous on the corresponding intervals (subdomains),
  • there is no discontinuity at an endpoint of any subdomain 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 [math]\displaystyle{ x_0 }[/math]. The filled circle indicates that the value of the right sub-function is used in this position.

For a piecewise-defined 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 sub-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-regular" 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.[5] In particular, shearlets have been used as a representation system to provide sparse approximations of this model class in 2D and 3D.

Common examples

See also

References

  1. "Piecewise Functions". https://www.mathsisfun.com/sets/functions-piecewise.html. 
  2. 2.0 2.1 2.2 2.3 Weisstein, Eric W.. "Piecewise Function" (in en). https://mathworld.wolfram.com/PiecewiseFunction.html. 
  3. "Piecewise functions". https://brilliant.org/wiki/piecewise-functions/. 
  4. A feasible weaker requirement is that all definitions agree on intersecting subdomains.
  5. Kutyniok, Gitta; Labate, Demetrio (2012). "Introduction to shearlets". Shearlets (Birkhäuser): 1–38. https://www.math.uh.edu/~dlabate/SHBookIntro.pdf.  Here: p.8