#jsDisabledContent { display:none; } My Account | Register | Help

# Piecewise linear function

Article Id: WHEBN0000444224
Reproduction Date:

 Title: Piecewise linear function Author: World Heritage Encyclopedia Language: English Subject: Collection: Publisher: World Heritage Encyclopedia Publication Date:

### Piecewise linear function

In mathematics, a piecewise linear function is a function composed of straight-line sections.[1] It is a piecewise-defined function whose pieces are affine functions.

If the function is continuous, the graph will be a polygonal curve.

## Contents

• Examples 1
• Fitting to a curve 2
• Fitting to data 3
• Notation 4
• References 7

## Examples

A continuous piecewise linear function

The function defined by:

f(x) = \begin{cases} -x-3 & \text{if }x \leq -3 \\ x+3 & \text{if }-3 < x < 0 \\ -2x+3 & \text{if }0 \leq x < 3 \\ 0.5x-4.5 & \text{if }x \geq 3 \end{cases}

is piecewise linear with four pieces. (The graph of this function is shown to the right.) Since the graph of a linear function is a line, the graph of a piecewise linear function consists of line segments and rays.

Other examples of piecewise linear functions include the absolute value function, the square wave, the sawtooth function, and the floor function.

## Fitting to a curve

A function (blue) and a piecewise linear approximation to it (red).

An approximation to a known curve can be found by sampling the curve and interpolating linearly between the points. An algorithm for computing the most significant points subject to a given error tolerance has been published.[2]

## Fitting to data

If partitions are already known, linear regression can be performed independently on these partitions. However, continuity is not preserved in that case. A stable algorithm with this case has been derived.[3]

If partitions are not known, the residual sum of squares can be used to choose optimal separation points.[4]

A variant of decision tree learning called model trees learns piecewise linear functions.[5]

## Notation

A piecewise linear function in two dimensions (top) and the convex polytopes on which it is linear (bottom).

The notion of a piecewise linear function makes sense in several different contexts. Piecewise linear functions may be defined on n-dimensional Euclidean space, or more generally any vector space or affine space, as well as on piecewise linear manifolds, simplicial complexes, and so forth. In each case, the function may be real-valued, or it may take values from a vector space, an affine space, a piecewise-linear manifold, or a simplicial complex. (In these contexts, the term “linear” does not refer solely to linear transformations, but to more general affine linear functions.)

In dimensions higher than one, it is common to require the domain of each piece to be a polygon or polytope. This guarantees that the graph of the function will be composed of polygonal or polytopal pieces.

Important sub-classes of piecewise linear functions include the continuous piecewise linear functions and the convex piecewise linear functions. In general, for every n dimensional continuous piecewise linear function f : \mathbb{R}^n \to \mathbb{R}, there is a

\Pi \in \mathcal{P}(\mathcal{P}(\mathbb{R}^{n+1}))

such that:

f(\vec{x}) = \min_{\Sigma \in \Pi} \max_{(\vec{a},b) \in \Sigma} \vec{a} \cdot \vec{x} + b.

If f is convex as well as continuous, then there is a

\Sigma \in \mathcal{P}(\mathbb{R}^{n+1})

such that:

f(\vec{x}) = \max_{(\vec{a},b) \in \Sigma} \vec{a} \cdot \vec{x} + b.

Splines generalize piecewise linear functions to higher-order polynomials, which are in turn contained in the category of piecewise-differentiable functions, PDIFF .

• Apps, P., Long, N., & Rees, R. (2014). Optimal piecewise linear income taxation. Journal of Public Economic Theory, 16(4), 523-545.

## References

1. ^ Stanley, William D. (2004). Technical Analysis And Applications With Matlab. Cengage Learning. p. 143.
2. ^ Hamann, B.; Chen, J. L. (1994). "Data point selection for piecewise linear curve approximation". Computer Aided Geometric Design 11 (3): 289.
3. ^ Golovchenko, Nikolai. "Least-squares Fit of a Continuous Piecewise Linear Function". Retrieved 6 Dec 2012.
4. ^ Vieth, E. (1989). "Fitting piecewise linear regression functions to biological responses". Journal of applied physiology (Bethesda, Md. : 1985) 67 (1): 390–396.
5. ^ Landwehr, N.; Hall, M.; Frank, E. (2005). "Logistic Model Trees" (PDF). Machine Learning 59: 161.
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.

Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.