Piecewise function

Last updated
Plot of the piecewise linear function
f
(
x
)
=
{
-
3
-
x
if
x
<=
-
3
x
+
3
if
-
3
<=
x
<=
0
3
-
2
x
if
0
<=
x
<=
3
0.5
x
-
4.5
if
3
<=
x
{\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.} Piecewise linear function gnuplot.svg
Plot of the piecewise linear function

In mathematics, a piecewise function (also called a piecewise-defined function, a hybrid function, or a function defined by cases) is a function whose domain is partitioned into several intervals ("subdomains") on which the function may be defined differently. [1] [2] [3] Piecewise definition is actually a way of specifying the function, rather than a characteristic of the resulting function itself.

Contents

Notation and interpretation

Graph of the absolute value function,
y
=
|
x
|
{\displaystyle y=|x|} Absolute value.svg
Graph of the absolute value function,

Piecewise functions can be defined using the common functional notation, where the body of the function is an array of functions and associated subdomains. A semicolon or comma may follow the subfunction or subdomain columns. [4] The or is rarely omitted at the start of the right column. [4]

The 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. [5] 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]

For all values of less than zero, the first sub-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 sub-function () is used, which evaluates trivially to the input value itself.

The following table documents the absolute value function at certain values of :

xf(x)Sub-function used
−33
−0.10.1
00
1/21/2
55

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.

Examples

Continuity and differentiability of piecewise-defined functions

Plot of the piecewise-quadratic function
f
(
x
)
=
{
x
2
if
x
<
0.707
1.5
-
(
x
-
1.414
)
2
if
0.707
<=
x
{\displaystyle f(x)=\left\{{\begin{array}{lll}x^{2}&{\text{if}}&x<0.707\\1.5-(x-1.414)^{2}&{\text{if}}&0.707\leq x\\\end{array}}\right.}
Its only discontinuity is at
x
0
=
0.707
{\displaystyle x_{0}=0.707}
. Upper semi.svg
Plot of the piecewise-quadratic function Its only discontinuity is at .

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

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 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:

Some sources only examine the function definition, [6] while others acknowledge the property iff the function admits a partition into a piecewise definition that meets the conditions. [7] [8]

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 (as in a cartoon); [9] a cartoon-like function is a C2 function, smooth except for the existence of discontinuity curves. [10] In particular, shearlets have been used as a representation system to provide sparse approximations of this model class in 2D and 3D.

Piecewise defined functions are also commonly used for interpolation, such as in nearest-neighbor interpolation.

See also

Related Research Articles

<span class="mw-page-title-main">Antiderivative</span> Concept in calculus

In calculus, an antiderivative, inverse derivative, primitive function, primitive integral or indefinite integral of a continuous function f is a differentiable function F whose derivative is equal to the original function f. This can be stated symbolically as F' = f. The process of solving for antiderivatives is called antidifferentiation, and its opposite operation is called differentiation, which is the process of finding a derivative. Antiderivatives are often denoted by capital Roman letters such as F and G.

In mathematics, a continuous function is a function such that a small variation of the argument induces a small variation of the value of the function. This implies there are no abrupt changes in value, known as discontinuities. More precisely, a function is continuous if arbitrarily small changes in its value can be assured by restricting to sufficiently small changes of its argument. A discontinuous function is a function that is not continuous. Until the 19th century, mathematicians largely relied on intuitive notions of continuity and considered only continuous functions. The epsilon–delta definition of a limit was introduced to formalize the definition of continuity.

<span class="mw-page-title-main">Integral</span> Operation in mathematical calculus

In mathematics, an integral is the continuous analog of a sum, which is used to calculate areas, volumes, and their generalizations. Integration, the process of computing an integral, is one of the two fundamental operations of calculus, the other being differentiation. Integration was initially used to solve problems in mathematics and physics, such as finding the area under a curve, or determining displacement from velocity. Usage of integration expanded to a wide variety of scientific fields thereafter.

<span class="mw-page-title-main">B-spline</span> Spline function

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 expressed as a linear combination of B-splines of that degree. Cardinal B-splines have knots that are equidistant from each other. B-splines can be used for curve-fitting and numerical differentiation of experimental data.

<span class="mw-page-title-main">Riemann integral</span> Basic integral in elementary calculus

In the branch of mathematics known as real analysis, the Riemann integral, created by Bernhard Riemann, was the first rigorous definition of the integral of a function on an interval. It was presented to the faculty at the University of Göttingen in 1854, but not published in a journal until 1868. For many functions and practical applications, the Riemann integral can be evaluated by the fundamental theorem of calculus or approximated by numerical integration, or simulated using Monte Carlo integration.

<span class="mw-page-title-main">Monotonic function</span> Order-preserving mathematical function

In mathematics, a monotonic function is a function between ordered sets that preserves or reverses the given order. This concept first arose in calculus, and was later generalized to the more abstract setting of order theory.

In mathematics, a singularity is a point at which a given mathematical object is not defined, or a point where the mathematical object ceases to be well-behaved in some particular way, such as by lacking differentiability or analyticity.

<span class="mw-page-title-main">Maximum and minimum</span> Largest and smallest value taken by a function at a given point

In mathematical analysis, the maximum and minimum of a function are, respectively, the largest and smallest value taken by the function. Known generically as extremum, they may be defined either within a given range or on the entire domain of a function. Pierre de Fermat was one of the first mathematicians to propose a general technique, adequality, for finding the maxima and minima of functions.

In mathematics, the Riemann–Stieltjes integral is a generalization of the Riemann integral, named after Bernhard Riemann and Thomas Joannes Stieltjes. The definition of this integral was first published in 1894 by Stieltjes. It serves as an instructive and useful precursor of the Lebesgue integral, and an invaluable tool in unifying equivalent forms of statistical theorems that apply to discrete and continuous probability.

In mathematics, the Henstock–Kurzweil integral or generalized Riemann integral or gauge integral – also known as the (narrow) Denjoy integral, Luzin integral or Perron integral, but not to be confused with the more general wide Denjoy integral – is one of a number of inequivalent definitions of the integral of a function. It is a generalization of the Riemann integral, and in some situations is more general than the Lebesgue integral. In particular, a function is Lebesgue integrable over a subset of if and only if the function and its absolute value are Henstock–Kurzweil integrable.

In mathematics, a piecewise linear or segmented function is a real-valued function of a real variable, whose graph is composed of straight-line segments.

<span class="mw-page-title-main">Spline (mathematics)</span> Mathematical function defined piecewise by polynomials

In mathematics, a spline is a function defined piecewise by polynomials. In interpolating problems, spline interpolation is often preferred to polynomial interpolation because it yields similar results, even when using low degree polynomials, while avoiding Runge's phenomenon for higher degrees.

<span class="mw-page-title-main">Sign function</span> Mathematical function returning -1, 0 or 1

In mathematics, the sign function or signum function is a function that has the value −1, +1 or 0 according to whether the sign of a given real number is positive or negative, or the given number is itself zero. In mathematical notation the sign function is often represented as or .

In mathematics, nonstandard calculus is the modern application of infinitesimals, in the sense of nonstandard analysis, to infinitesimal calculus. It provides a rigorous justification for some arguments in calculus that were previously considered merely heuristic.

<span class="mw-page-title-main">Smoothness</span> Number of derivatives of a function (mathematics)

In mathematical analysis, the smoothness of a function is a property measured by the number, called differentiability class, of continuous derivatives it has over its domain.

<span class="mw-page-title-main">Operation (mathematics)</span> Addition, multiplication, division, ...

In mathematics, an operation is a function which takes zero or more input values to a well-defined output value. The number of operands is the arity of the operation.

<span class="mw-page-title-main">Finite element method</span> Numerical method for solving physical or engineering problems

The finite element method (FEM) is a popular method for numerically solving differential equations arising in engineering and mathematical modeling. Typical problem areas of interest include the traditional fields of structural analysis, heat transfer, fluid flow, mass transport, and electromagnetic potential.

<span class="mw-page-title-main">Lebesgue integral</span> Method of integration

In mathematics, the integral of a non-negative function of a single variable can be regarded, in the simplest case, as the area between the graph of that function and the X axis. The Lebesgue integral, named after French mathematician Henri Lebesgue, is one way to make this concept rigorous and to extend it to more general functions.

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 of functions . They are a natural extension of wavelets, to accommodate the fact that multivariate functions are typically governed by anisotropic features such as edges in images, since wavelets, as isotropic objects, are not capable of capturing such phenomena.

In the mathematical field of numerical analysis, discrete spline interpolation is a form of interpolation where the interpolant is a special type of piecewise polynomial called a discrete spline. A discrete spline is a piecewise polynomial such that its central differences are continuous at the knots whereas a spline is a piecewise polynomial such that its derivatives are continuous at the knots. Discrete cubic splines are discrete splines where the central differences of orders 0, 1, and 2 are required to be continuous.

References

  1. "Piecewise Functions". www.mathsisfun.com. Retrieved 2020-08-24.
  2. 1 2 Weisstein, Eric W. "Piecewise Function". mathworld.wolfram.com. Retrieved 2020-08-24.
  3. "Piecewise functions". brilliant.org. Retrieved 2020-09-29.
  4. 1 2 Weisstein, Eric W. "Piecewise Function". mathworld.wolfram.com. Retrieved 2024-07-20.
  5. A feasible weaker requirement is that all definitions agree on intersecting subdomains.
  6. "Differentiability of Piecewise Defined Functions – AP Central | College Board". apcentral.collegeboard.org. Retrieved 2024-08-26.
  7. S. M. Nikolsky (1977). A Course Of Mathematical Analysis Vol 1. p. 178.
  8. Sofronidis, Nikolaos Efstathiou (2005). "The set of continuous piecewise differentiable functions". Real Analysis Exchange. 31 (1): 13–22. ISSN   0147-1937.
  9. Kutyniok, Gitta; Labate, Demetrio (2012). "Introduction to shearlets" (PDF). Shearlets. Birkhäuser: 1–38. Here: p.8
  10. Kutyniok, Gitta; Lim, Wang-Q (2011). "Compactly supported shearlets are optimally sparse". Journal of Approximation Theory. 163 (11): 1564–1589. arXiv: 1002.2661 . doi:10.1016/j.jat.2011.06.005.