# Transforming the canonical piecewise-linear model into a smooth-piecewise representation

- Victor M. Jimenez-Fernandez
^{1}Email author, - Maribel Jimenez-Fernandez
^{2}, - Hector Vazquez-Leal
^{1}, - Evodio Muñoz-Aguirre
^{3}, - Hector H. Cerecedo-Nuñez
^{4}, - Uriel A. Filobello-Niño
^{1}and - Francisco J. Castro-Gonzalez
^{1}

**Received: **28 September 2015

**Accepted: **9 September 2016

**Published: **20 September 2016

## Abstract

A smoothed representation (based on natural exponential and logarithmic functions) for the canonical piecewise-linear model, is presented. The result is a completely differentiable formulation that exhibits interesting properties, like preserving the parameters of the original piecewise-linear model in such a way that they can be directly inherited to the smooth model in order to determine their parameters, the capability of controlling not only the smoothness grade, but also the approximation accuracy at specific breakpoint locations, a lower or equal overshooting for high order derivatives in comparison with other approaches, and the additional advantage of being expressed in a reduced mathematical form with only two types of inverse functions (logarithmic and exponential). By numerical simulation examples, this proposal is verified and well-illustrated.

## Keywords

## Background

Piecewise-linear models are widely used in diverse fields, such as circuit theory, image processing, system identification, economics and financial analysis, etc (Chua and Ying 1983; Chua and Deng 1985; Hasler and Schnetzler 1989; Yamamura and Ochiai 1992; Russo 2006; Feo and Storace 2004, 2007; Brooks 2008). The factor that prevalently motivates the use of this type of models is the simplicity of their structure which let them be efficiently implemented in both algorithms and hardware. In general, piecewise-linear models looks very appealing for graphical tasks, like curve fitting, interpolation or extrapolation, where a function is constructed to fit or determine new values within or outside the range of a discrete set of known data points (Bian and Menz 1998; Dai et al. 2007; Magnani and Boyd 2009; Misener and Floudas 2010; Jimenez-Fernandez et al. 2014). However, a notorious shortcoming can be distinguished in this type of models when function derivatives are of interest. This is because the first derivatives of piecewise-linear functions are not continuous at breakpoints and the second derivatives do not exist or are vanished inside each linear partition. This fact limits their application in that cases where derivatives are imperatively required, such as device modeling, nonlinear systems simulation, and analysis of experimental data, among others. In that regard, although there are many reported piecewise-linear models (Chua and Kang 1977; Kang and Chua 1978; Chua and Deng 1988; Kahlert and Chua 1990; Guzelis and Goknar 1991; Pospisil 1991; Kevenaar et al. 1994; Leenaerts and Van-Bokhoven 1998; Julian et al. 1999; Li et al. 2001), due to its compact formulation, the most popular is the so-called canonical piecewise-linear representation (Chua and Kang 1977) which is given by the following theorem:

###
**Theorem 1**

*Any single*-

*valued piecewise*-

*linear function with at most*\(\sigma\)

*breakpoints*\(\beta_{1} < \beta_{2} < \ldots < \beta_{\sigma }\)

*, can be represented by the expression*

*with*\(b = \left( {\frac{{J^{(1)} + J^{(\sigma + 1)} }}{2}} \right),\) \(c_{i} = \left( {\frac{{J^{(i + 1)} - J^{(i)} }}{2}} \right),\) \(a = y\left( 0 \right) - \sum\nolimits_{i = 1}^{\sigma } {c_{i} |\beta_{i} |}\)

*for*\(i = 1,2, \ldots ,\sigma\)

*, and*\(J^{\left( i \right)}\)

*denoting the slope of the i*-

*th constitutive linear segment in the piecewise*-

*linear function.*

*n*-dimensional functions, (1) takes the form

*n*-dimensional vectors, \(a\), \(c_{i}\) and \(\beta_{i}\) are scalars, and “\(\left\langle , \right\rangle\)” denotes the inner product of two vectors.

As can be seen, this model is expressed by a closed formula with a minimal number of parameters. Nevertheless, due to a sum of absolute-value terms is included in (1) and (2), it is not completely differentiable.

Motivated by the fact of merging in a unique piecewise model these two fundamental characteristics: simplicity and differentiability, in this paper an algebraic transformation to smooth the canonical piecewise-linear model, is proposed. Such transformation let it obtain a new formulation which is based on natural exponential and logarithmic functions. It results in a new model that, besides of being smooth and preserving a minimum number of parameters, it makes the native piecewise-linear model completely differentiable. In this concern, it is important to mention that, in accordance with literature such lack of differentiability has been overcome by substituting the basis-function of the piecewise-linear model (in this case, the absolute-value) for its smooth approximation. Illustrative examples of this strategy can be found in (Bacon and Watts 1971; Seber and Wild 1989; Lazaro et al. 2001; Griffiths and Miller 1973), where the functions \(sign(x)\), \(\tanh (x)\), \(lch(x)\), and \(hyp(x)\) are used, respectively. Similarly, our smoothing transformation is based on the same principle but compared to those reported approaches, it reveals significant improvements, for example: (1) a better curve fitting accuracy can be achieved due to the deviation between the piecewise-linear function of reference, and the resulting smooth description, is restrictively focused at the breakpoints, (2) no additional parameters needs to be computed because it uses the same parameters of the original canonical model, and (3) the resulting smooth model exhibits a lower or equal overshooting for their derivatives. The paper is organized as follows. In section 2, the deduction of the smoothing transformation formula is explained in detail. Section 3 describes the transformation strategy by two illustrative examples (for one- and two-dimensional domains). In section 4 a comparative analysis and discussion about the curve fitting accuracy that can be achieved through the proposed transformation as well as the overshooting in derivatives, is exposed. This comparative is done among the most popular smoothing proposals reported in literature. Finally, section 5 presents the concluding remarks of this work.

## Deduction of transformation formula

*µ*is included as

*Proof* See Appendix A

*α*is incorporated to controls the smoothness. A more formal definition for (8) is expressed by the following theorem:

###
**Theorem 2**

*Any one*-

*dimensional canonical piecewise*-

*linear function that is characterized by L segments and σ breakpoints*\(\beta_{1} < \beta_{2} < \ldots < \beta_{\sigma } ,\)

*can be transformed into smooth*-

*piecewise function expressed as*

*where the set of*\(\left( {\sigma + 2} \right)\)

*parameters:*\(\left\{ {A,B,C_{i} } \right\}\)

*can be determined as follows:*

*and the parameter α can be used to preserve a constant smoothness in all the function domain, or to define a specific smoothness grade*\(\alpha_{i}\)

*at any i*-

*th breakpoint location as*

with *δ* being the deviation between the piecewise-linear and the smooth-piecewise functions at \(x = \beta_{i} .\)

*Proof* See Appendix B

*n*-dimensional representation of (9), a smooth transformation is derived from (2) and expressed as

*Proof* See Appendix C

## Illustrative examples

With the purpose of exploring (9), we present two application examples; the first shows how to obtain the smooth-piecewise representation of any one-dimensional function, and the second exposes a more practical case where the smoothing transformation is applied into a two-dimensional characterization curve for a n-channel MOS transistor.

### Example 1

*α*is small the smoothness of (17) is increased, in contrast, when

*α*is greater it is decreased. From a geometrical interpretation, this means a trade-off between the deviation from the breakpoint coordinate, and the desired smoothness. In Fig. 2 the first and second derivatives of \(y(x),\) for \(\alpha = 10,\) are contrasted with the corresponding derivatives of \(y_{CPWL} (x).\) As it was expected, the first derivative for \(y_{CPWL} (x)\) yields a discontinuous step curve, and the second and higher order derivatives are always zero. In contrast, it must be highlighted the existence of the first and higher order derivatives for the smooth function.

### Example 2

In order to illustrate the smoothing transformation for a two-dimensional function, the characteristic curves and equilibrium equations of a metal–oxide–semiconductor (MOS) field-effect transistor are considered. This is a four-terminal device: source (S), gate (G), drain (D), and body (B) which is used for amplifying or switching electronic signals.

From (19) in reference to (2) is obtained:

\(A = - 12.405,\) \({\mathbf{\rm B}} = \left[ {\begin{array}{*{20}c} {3.286} \\ {71.493} \\ \end{array} } \right],\) \({\user2{\Lambda}}^{\left( 1 \right)} = \left[ {\begin{array}{*{20}c} {37.738} \\ { - 1} \\ \end{array} } \right],\) \({\user2{\Lambda}}^{\left( 2 \right)} = \left[ {\begin{array}{*{20}c} {0.6705} \\ { - 1} \\ \end{array} } \right],\) \({\user2{\Lambda}}^{\left( 3 \right)} = \left[ {\begin{array}{*{20}c} {1.403} \\ { - 1} \\ \end{array} } \right],\) \({\user2{\Lambda}}^{\left( 4 \right)} = \left[ {\begin{array}{*{20}c} { - 21.904} \\ { - 1} \\ \end{array} } \right],\) \(c_{1} = 0.438,\) \(c_{2} = - 54.407,\) \(c_{3} = - 15.715,\) \(c_{4} = 1.809,\) \(\beta_{1} = - 42.459,\) \(\beta_{2} = 1.5385,\) \(\beta_{3} = 1.3058,\) \(\beta_{4} = - 54.166\)

*α*) only appears near the breakpoints.

## Comparative analysis and discussion

In this section, an analysis and discussion about the curve fitting accuracy and the overshooting in function derivatives due to the smooth-piecewise model (9), is outlined. In order to have a comparative reference, besides of our proposal, other smoothing alternatives are considered and illustrated.

### Smooth approximation for the absolute value function

### Overshooting in derivatives of the absolute value function approximations

### Comparative example

By this example, the two previously discussed characteristics: curve fitting of breakpoints and overshooting for function derivatives, are explored. Hence, consider a piecewise-linear curve defined by two breakpoints: \(\beta = \left\{ {1,2} \right\}\), and three slopes: \(J = \left\{ {2, - 3,1} \right\}\). In accordance with (1), from these input data the canonical piecewise-linear model description is given by

Smoothing transformations of (24) can be now intuitively achieved by replacing the absolute-value function with any of their approximations (\(lne\), \(lch\), and \(th\)). After applying the corresponding substitutions, we obtain

## Conclusion

The proposed transformation was successfully applied to one-dimensional and two-dimensional piecewise-linear functions. By numerical simulations, it was verified that in comparison with other reported strategies, our smooth-piecewise model has important advantages, like preserving the original parameters of its native canonical piecewise-linear representation, the capability of controlling the smoothness by an artificial parameter (*α*), a lower or equal overshooting for derivatives, and the additional advantage of being expressed in a more reduced mathematical form with only two types of inverse functions (logarithmic and exponential).

## Declarations

### Authors’ contributions

All authors contributed extensively in the development and completion of this article. All authors read and approved the final manuscript.

### Acknowledgements

The authors would like to express their sincere thanks to the anonymous referees for their valuable review of this manuscript.

### Competing interests

The authors declare that they have no competing interests.

**Open Access**This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

## Authors’ Affiliations

## References

- Bacon DW, Watts DG (1971) Estimating the transition between two intersecting straight lines. Biometrika 58(3):525–534View ArticleMATHGoogle Scholar
- Bian S, Menz J (1998) Using piecewise linear interpolations in spherical harmonic analysis. J Geodesy 72(7):473–481ADSView ArticleMATHGoogle Scholar
- Brooks C (2008) Introductory econometrics for finance. Cambridge University Press, Cambridge, pp 462–464View ArticleMATHGoogle Scholar
- Chua LO, Deng AC (1985) Canonical piecewise-linear analysis-II: tracing driving-point and transfer characteristics. IEEE Trans Circuits Syst 32(5):417–444MathSciNetView ArticleMATHGoogle Scholar
- Chua LO, Deng A (1986) Canonical piecewise-linear modeling. IEEE Trans Circuits Syst 33(5):511–525MathSciNetView ArticleGoogle Scholar
- Chua LO, Deng A (1988) Canonical piecewise-linear representation. IEEE T Circuits Syst 35(1):101–111MathSciNetView ArticleMATHGoogle Scholar
- Chua LO, Kang SM (1977) Section-wise piecewise-linear functions: canonical representation, properties and applications. Proc IEEE 65(6):915–929View ArticleGoogle Scholar
- Chua LO, Ying R (1983) Canonical piecewise-linear analysis. IEEE Trans Circuits Syst 30(3):125–140MathSciNetView ArticleMATHGoogle Scholar
- Dai TS, Wang JY, Wei HS (2007) An ingenious, piecewise linear interpolation algorithm for pricing arithmetic average options. Lect Notes Comput SC 4508:262–272View ArticleMATHGoogle Scholar
- Feo OD, Storace M (2004) Pwl identification of dynamical systems: some examples. IEEE Int Sym Circuits Syst 4:665–668Google Scholar
- Feo OD, Storace M (2007) Piecewise-linear identification of nonlinear dynamical systems in view of their circuit implementations. IEEE Trans Circuits Syst I Regular Papers 54(7):1542–1554MathSciNetView ArticleGoogle Scholar
- Griffiths DA, Miller AJ (1973) Hyperbolic regression model based on two phase piecewise-linear regression with a smooth transition between regimes. Commun Stat 2(6):561–569View ArticleMATHGoogle Scholar
- Guzelis G, Goknar I (1991) A canonical representation for piecewise affine maps and its application to circuit analysis. IEEE Trans Circuits Syst 38(11):1342–1354View ArticleMATHGoogle Scholar
- Hasler MJ, Schnetzler C (1989) On the number of solutions of piecewise-linear resistive circuits. IEEE Trans Circuits Syst 36(3):393–402MathSciNetView ArticleGoogle Scholar
- Jimenez-Fernandez VM, Cerecedo-Nunez HH, Vazquez-Leal H, Beltran-Parrazal L, Filobello-Nino UA (2014) A parametric piecewise-linear approach to laser projection. Comput Appl Math 33(3):841–858MathSciNetView ArticleMATHGoogle Scholar
- Julian P, Desages A, Agamennoni O (1999) High-level canonical piecewise linear representation using a simplicial partition. IEEE Trans Circuits I Fundam Theory Appl 46(4):463–480MathSciNetView ArticleMATHGoogle Scholar
- Kahlert C, Chua LO (1990) A generalized canonical piecewise-linear representation. IEEE Trans Circuits Syst 37(3):373–383MathSciNetView ArticleMATHGoogle Scholar
- Kang SM, Chua LO (1978) A global representation of multidimensional piecewise-linear functions with linear partitions. IEEE Trans Circuits Syst 25(11):938–940View ArticleMATHGoogle Scholar
- Kevenaar TAM, Leenaerts DMW, van Bokhoven WMG (1994) Extensions to chua’s explicit piecewise-linear function descriptions. IEEE Trans Circuits I Fundam Theory Appl 41(4):308–314View ArticleGoogle Scholar
- Lazaro M, Santamaria I, Pantaleon C, Sanchez AM, Puente AT, Fernandez T (2001) Smoothing the canonical piecewise-linear model: an efficient and derivable large-signal model for mesfet/hemt transistors. IEEE Trans Circuits I Fundam Theory Appl 48(2):184–192View ArticleGoogle Scholar
- Leenaerts DMW, Van-Bokhoven WMG (1998) Piecewise linear modeling and analysis. Springer, BerlinView ArticleMATHGoogle Scholar
- Li X, Wang S, Yin W (2001) A canonical representation of high-dimensional continuous piecewise-linear functions. IEEE Trans Circuits I Fundam Theory Appl 48(11):1347–1351MathSciNetView ArticleMATHGoogle Scholar
- Magnani A, Boyd SP (2009) Convex piecewise-linear fitting. Optim Eng 10(1):1–17MathSciNetView ArticleMATHGoogle Scholar
- Misener R, Floudas CA (2010) Piecewise-linear approximations of multidimensional functions. J Optim Theory Appl 145(1):120–147MathSciNetView ArticleMATHGoogle Scholar
- Pospisil J (1991) Universal network realising basic piecewise-linear I/V characteristics. Electron Lett 27(5):402–404View ArticleGoogle Scholar
- Russo F (2006) A method based on piecewise linear models for accurate restoration of images corrupted by gaussian noise. IEEE Trans Instrum Meas 55(6):1935–1943View ArticleGoogle Scholar
- Schmidt M, Fung G, Rosales R (2007) Fast optimization methods for l1 regularization: a comparative study and two new approaches. In: Machine learning, vol 4701. Springer, Berlin, p 286–297Google Scholar
- Seber GAF, Wild CJ (1989) Nonlinear regression. Willey, New YorkView ArticleMATHGoogle Scholar
- Yamamura K, Ochiai M (1992) An efficient algorithm for finding all solutions of piecewise-linear resistive circuits. IEEE Trans Circuits-I Fundam Theory Appl 39(3):213–221View ArticleMATHGoogle Scholar