page_title: Piecewise
section_title: Notation and interpretation
hierarchical_section_title: Piecewise / Notation and interpretation
context_page_description: In mathematics, a piecewise-defined function is a function defined by multiple sub-functions, where each sub-function applies to a different sub-domain, and are grouped together via the symbol. Piecewise is actually a way of expressing the function, rather than a characteristic of the function itself, but with additional qualification, it can describe the nature of the function. For example, a piecewise polynomial function is a function that is defined by a polynomial on each of its sub-domains, but possibly by a different polynomial on each sub-domain.
  The word piecewise is also used to describe any property of a piecewise-defined function that holds for each piece, but not necessarily hold for the whole domain of the function. A function is piecewise differentiable or piecewise continuously differentiable if each piece is differentiable throughout its subdomain, even though the whole function may not be differentiable at the points between the pieces. In convex analysis, the notion of a derivative may be replaced by that of the subderivative for piecewise functions.
context_section_description: Piecewise functions are defined using the common functional notation, where the body of the function is an array of functions and associated subdomains.  Crucially, in most settings, there must only be a finite number of subdomains, each of which must be an interval, in order for the overall function to be called "piecewise".  For example, consider the piecewise definition of the absolute value function:
  For all values of x less than zero, the first function (−x) is used, which negates the sign of the input value, making negative numbers positive.  For all values of x greater than or equal to zero, the second function (x) is used, which evaluates trivially to the input value itself.
  The following table documents the absolute value function at certain values of x:
  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.
caption: Graph of the absolute value function, y = |x|.