Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Piecewise function
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Function defined by multiple sub-functions}} {{Redirect|Piecewise||Piecewise property (disambiguation){{!}}Piecewise property}} {{CS1 config|mode=cs1}} {{Refimprove|date=March 2017}} [[File:Piecewise linear function gnuplot.svg|thumb|280px|Plot of the [[piecewise linear function]] <math>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 function''' (also called a '''piecewise-defined function''', a '''hybrid function''', or a '''function defined by cases''') is a [[function (mathematics)|function]] whose [[Domain of a function|domain]] is [[partition of a set|partitioned]] into several [[interval (mathematics)|intervals]] ("subdomains") on which the function may be defined differently.<ref>{{Cite web|title=Piecewise Functions|url=https://www.mathsisfun.com/sets/functions-piecewise.html|access-date=2020-08-24|website=www.mathsisfun.com}}</ref><ref name=mathworld>{{mathworld|title=Piecewise Function|id=PiecewiseFunction}}</ref><ref>{{Cite web|title=Piecewise functions|url=https://brilliant.org/wiki/piecewise-functions/|access-date=2020-09-29|website=brilliant.org}}</ref> Piecewise definition is actually a way of specifying the function, rather than a characteristic of the resulting function itself, as every function whose domain contains at least two points can be rewritten as a piecewise function. The first three paragraphs of this article only deal with this first meaning of "piecewise". Terms like '''piecewise linear''', '''piecewise smooth''', '''piecewise continuous''', and others are also very common. The meaning of a function being piecewise <math>P</math>, for a property <math>P</math> is roughly that the domain of the function can be partitioned into pieces on which the property <math>P</math> holds, but is used slightly differently by different authors.<ref>{{Cite book |last=S. M. Nikolsky |url=https://archive.org/details/nikolsky-a-course-of-mathematical-analysis-vol-1-mir |title=A Course Of Mathematical Analysis Vol 1 |year=1977 |pages=178}}</ref><ref>{{Cite journal |last=Sofronidis |first=Nikolaos Efstathiou |date=2005 |title=The set of continuous piecewise differentiable functions. |url=https://projecteuclid.org/journals/real-analysis-exchange/volume-31/issue-1/The-set-of-continuous-piecewise-differentiable-functions/rae/1149516810.full |journal=Real Analysis Exchange |volume=31 |issue=1 |pages=13–22 |doi=10.14321/realanalexch.31.1.0013 |issn=0147-1937}}</ref> Unlike the first meaning, this is a property of the function itself and not only a way to specify it. Sometimes the term is used in a more global sense involving triangulations; see [[Piecewise linear manifold]]. == Notation and interpretation == [[Image:Absolute value.svg|thumb|280px|right|Graph of the absolute value function, <math>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. A semicolon or comma may follow the subfunction or subdomain columns.<ref name=mathworld/> The <math>\text{if}</math> or <math>\text{for}</math> is rarely omitted at the start of the right column.<ref name=mathworld/> The subdomains together must cover the whole [[Domain of a function|domain]]; sometimes it is also required that they are pairwise disjoint, i.e. form a partition of the domain.<ref>A feasible weaker requirement is that all definitions agree on intersecting subdomains.</ref> This is enough for a function to be "defined by cases", but in order for the overall function to be "piecewise", the subdomains are typically required to be nonempty intervals (some may be degenerate intervals, i.e. single points or unbounded intervals) and they are often not allowed to have infinitely many subdomains in any bounded interval. This means that functions with bounded domains will only have finitely many subdomains, while functions with unbounded domains can have infinitely many subdomains, as long as they are appropriately spread out. As an example, consider the piecewise definition of the [[absolute value]] function:<ref name=mathworld/> <math display="block">|x| = \begin{cases} -x, & \text{if } x < 0 \\ +x, & \text{if } x \ge 0 . \end{cases} </math> For all values of <math>x</math> less than zero, the first sub-function (<math>-x</math>) is used, which negates the sign of the input value, making negative numbers positive. For all values of <math>x</math> greater than or equal to zero, the second sub-function {{nobr|(<math>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>x</math>: {| class="wikitable" ! style="width: 3em" | ''x'' ! style="width: 3em" | ''f''(''x'') !Sub-function used |- |−3 ||3 ||<math>-x</math> |- |−0.1||0.1||<math>-x</math> |- |0 ||0 ||<math>x</math> |- |1/2 ||1/2||<math>x</math> |- |5 ||5 ||<math>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. == Examples == * A [[step function]] or piecewise constant function, composed of constant sub-functions * [[Piecewise linear function#Examples|Piecewise linear function]], composed of [[Linear function (calculus) |linear]] sub-functions * [[Broken power law]], a function composed of power-law sub-functions * [[Spline (mathematics)|Spline]], a function composed of polynomial sub-functions, often constrained to be smooth at the joints between pieces ** [[B-spline]] * [[PDIFF]] * <math>f(x)= \begin{cases} \exp\left( -\frac{1}{1 - x^2}\right), & x \in (-1,1) \\ 0, & \text{otherwise} \end{cases}</math><br /> and some other common [[Bump function]]s. These are infinitely differentiable, but [[analytic function|analyticity]] holds only piecewise. == Continuity and differentiability of piecewise-defined functions == [[Image:Upper semi.svg|thumb|280px|Plot of the piecewise-[[quadratic function]] <math>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.</math> Its only discontinuity is at <math>x_0 = 0.707</math>.]] A piecewise-defined function is [[Continuous function|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>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.<ref>{{SpringerEOM|title=One-sided derivative|author-last1=Rehmann|author-first1=Ulf|oldid=48044}}</ref><ref>{{Cite book |last=Ilyin |first=V. A. |title=Fundamentals Of Mathematical Analysis |last2=Poznyak |first2=E. G. |publisher=Mir Publishers Moscow |others=Translated from Russian by Irene Aleksanova. |year=1982 |isbn=978-93-859-2386-9 |volume=1 |pages=146, 177}}</ref><ref>{{Cite book |last=Canuto |first=Claudio |title=Mathematical Analysis I |last2=Tabacco |first2=Anita |publisher=Springer-Verlag Italia |others=Translated by: Simon G. Chiossi |year=2008 |isbn=978-88-470-0875-5 |location=Milan |publication-date=2008 |pages=83, 176}}</ref> == Applications == In applied mathematical analysis, "piecewise-regular" functions have been found to be consistent with many [[Visual perception#Cognitive and computational approaches|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]]);<ref>{{cite journal |title = Introduction to shearlets |first1 = Gitta |last1 = Kutyniok|author1-link=Gitta Kutyniok |first2 = Demetrio |last2 = Labate |journal = Shearlets |pages = 1–38 |year = 2012 |publisher = [[Birkhäuser]] |url = https://www.math.uh.edu/~dlabate/SHBookIntro.pdf }} Here: p.8</ref> a '''cartoon-like function''' is a [[Smoothness#Example:_finitely-times_differentiable_(Ck)|C<sup>2</sup>]] function, smooth except for the existence of discontinuity curves.<ref name="s150">{{cite journal | last1=Kutyniok | first1=Gitta | last2=Lim | first2=Wang-Q | title=Compactly supported shearlets are optimally sparse | journal=Journal of Approximation Theory | volume=163 | issue=11 | date=2011 | doi=10.1016/j.jat.2011.06.005 | pages=1564–1589| arxiv=1002.2661 }}</ref> In particular, [[shearlet]]s 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 == * [[Piecewise linear continuation]] * {{Look from|Piecewise}} {{Wikibooks|Gnuplot#Piecewise-defined functions}} ==References== {{Reflist}} [[Category:Functions and mappings]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:CS1 config
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite web
(
edit
)
Template:Look from
(
edit
)
Template:Mathworld
(
edit
)
Template:Nobr
(
edit
)
Template:Redirect
(
edit
)
Template:Refimprove
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Sister project
(
edit
)
Template:SpringerEOM
(
edit
)
Template:Wikibooks
(
edit
)