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

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.

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 σ breakpoints β 1 < β 2 < . . . < β σ , can be represented by the expression . . , σ, and J (i) denoting the slope of the i-th constitutive linear segment in the piecewise-linear function. and more generally, for n-dimensional functions, (1) takes the form where x, B, and (i) are n-dimensional vectors, a, c i and β i are scalars, and " , " 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 twodimensional 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
It follows from (Schmidt et al. 2007) that a smooth approximation for the absolute-value function can be expressed in terms of natural logarithms as Using the property ln (uv) = ln (u) + ln (v) in (3), and simplifying the resulting algebraic expression we have After numerical simulations on (4), a slight deviation from the unity slope of the absolute-value function can be observed. In order to achieve more approximation accuracy, a constant µ is included as being µ = ln (10) an appropriate fitting value.
This simplify (5) as Proof See Appendix A After substituting the absolute-value function of (1) by its equivalent smooth approximation (6), it let us recast the canonical model as Hence, performing an algebraic reduction of (7) yields: that hereafter is denoted as the smooth-piecewise model whose parameters (a,b , and c i ) are the same as the canonical piecewise-linear model, and the parameter α 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 β 1 < β 2 < . . . < β σ , can be transformed into smooth-piecewise function expressed as where the set of (σ + 2) parameters: {A, B, C i } 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 α i at any i-th breakpoint location as with δ being the deviation between the piecewise-linear and the smooth-piecewise functions at Without loss of generality, for an n-dimensional representation of (9), a smooth transformation is derived from (2) and expressed as where both parameters, A and C i , are calculated by using the same equations as for the one-dimensional case (Eqs. (10), (12), respectively), and B is determined as follows:

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.
In order to exemplify how the smoothness can be controlled by fixing the value of the parameter α, a summary of curves (black) for α = {6, 8, 10, 15} is reported in Fig. 1. As reference, the original piecewise-linear curve y CPWL (x), derived from Theorem 1, is also included in this figure (red).
From this figure it can be observed that, when the parameter α 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 α = 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.
Let us start considering a n-channel MOS transistor connected in the common source configuration with v 1 = v GS , v 2 = v DS , and i 2 = i D , where v 1 , v 2 are in volts, and i 2 are in microamperes. We assume that the piecewise-linear description i 2 follows the Shichman-Hodges model for k = 50 µA/V 2 , V t = 1 V , = 0.02 V −1 , and it is expressed in the canonical form of the Chua model (Chua and Deng 1986) as follows: The resulting piecewise-linear characteristic y CPWL (v 1 , v 2 ) = i 2 is shown in Fig. 3. From (19) in reference to (2) is obtained: With the aim of estimating the difference between the piecewise-linear function i 2 and the smooth-piecewise function i 2s , the deviation between their characteristic curves is depicted in Fig. 5 (shadow regions). Similarly, as it happens in the one-dimensional example, the most precise curve fitting is achieved within each linear segment (in the two-dimensional case, each plane) but the deviation (controlled by the smoothing parameter α) 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
As it was exposed in section 2, the proposed smoothing strategy uses an approximation for the absolute-value function based on a natural logarithmic with a Euler's exponential argument, for simplicity, such approximation hereafter will be denoted as lne and it is obtained by recasting (6)  Other reported approximations are, the here denoted, lch (Lazaro et al. 2001) and th (Seber and Wild 1989). The first one based on the natural logarithm of a hyperbolic cosine argument, and the second one directly expressed in terms of a hyperbolic tangent. Both approximations are expressed as Figure 6 shows the absolute-value function abs = |x| and their approximations lne, lch, and th. In all cases, the same curvature (smoothness) is considered (k 1 = 1, k 2 = 1, and k 3 = 0.4). This fact can be graphically observed by the circles that are circumscribed at the breakpoint.
For this example, curve fitting deviations of lne, lch, and th, with respect to the absolute-value function, are shown in Fig. 7 where clearly it can be seen that, in lch and th, a considerable variation is presented, especially far away or in the two quadrants near the breakpoint at x = 0. However, in the close proximity of this point the curve deviation is progressively minimized. In contrast, by lne, the reciprocal behavior can be observed. That is to say, the main deviation is focused at x = 0, and it drops to zero as the curve moves away this point.

Overshooting in derivatives of the absolute value function approximations
In Figs. 8 and 9 the first and second derivatives of functions: lne for k 1 = 1, lch for k 2 = 1 , and th for k 3 = 0.4 are contrasted with the corresponding derivative of absolute-value function. As it was expected, the first derivative for the absolute-value function yields Fig. 7 Curve fitting deviations in lne, lch and th, with respect to the absolute-value function. k 1 = 1, k 2 = 1, and k 3 = 0.4 Fig. 8 First derivatives: lne ′ of lne for k 1 = 1, lch ′ of lch for k 2 = 1, and th ′ of th for k 3 = 0.4 a step function while their second and higher order derivatives are always zero. We can also see that, in the both cases shown in Figs. 8 and 9, derivatives of th exhibit more overshooting than lne and lch. Moreover, it can be noted the same overshooting for lne and lch.

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: β = {1, 2}, and three slopes: J = {2, −3, 1} . 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  (27), are the smooth functions that correspond to lne, lch, and th , respectively. It is important to point that, in order to evaluate these functions under equally conditions, the same smoothness is fixed by the parameters k 1 = 0.1, k 2 = 10, and k 3 = 4. Plots for these functions are depicted in Fig. 10. Curve fitting deviations of (25), (26), and (27), with respect to the reference function (24) can be appreciated in Fig. 11. From this figure it can be seen that a minimum deviation corresponds to (25) and the worst case is given by (27). Figure 12 shows that similarly as it was observed in Figs. 8 and 9, the most pronounced overshooting is due to the th approximation while an equally overshooting corresponds to lne and lch.

Conclusion
The proposed transformation was successfully applied to one-dimensional and twodimensional 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).
In Fig. 13, the graphs of h(x, α) and h(−x, α) for low and high values of the smoothing parameter α (i.e. α = 1 and α = 100) are depicted in dashed and solid line styles, respectively. Their linear approximations are also traced in dot style.
From the above graphs, the following linear approximations are proposed.
where the slope m is unknown.
In accordance with (30) Hence, taking into account that the approximations of (30) are completely valid for huge values of α and x, then an estimated value of ln(1+e (X) ) (X) can be obtained by considering the following limit evaluation: From this result, Eq. (32) can be simplified as where m is given by whose value deviates from the unity slope presented in the absolute-value function of reference (|x|). From here, in order to force an unity slope in both, h(x, α) (for x ≥ 0) and h(−x, α) (for x ≤ 0), a compensation constant µ = ln(10) is included in (29) as which allows recast the approximation (3) in terms of ĥ (x, α) and ĥ (−x, α) as follows: Finally, after algebraic simplifications of (37), it yields

Appendix B
Consider that the canonical piecewise-linear function y cpwl (x) and its smooth-piecewise version y s (x) have the form and Suppose that we do not like that the approximation y s (x) differs from the original function y cpwl (x) too much around to any specific breakpoint β i .