Function that approximates y=1 ⁄ x inside the interval -δ ≤ x ≤ δ. The approximation is twice continuously differentiable with a bounded derivative on the whole real line.
See the plot of IDEAS.Utilities.Math.Functions.Examples.InverseXRegularized for the graph.
For efficiency, the polynomial coefficients
a, b, c, d, e, f
and
the inverse of the smoothing parameter deltaInv
are exposed as arguments to this function.
Typically, these coefficients only depend on parameters and hence
can be computed once.
They must be equal to their default values, otherwise the function
is not twice continuously differentiable.
By exposing these coefficients as function arguments, models
that call this function can compute them as parameters, and
assign these parameter values in the function call.
This avoids that the coefficients are evaluated for each time step,
as they would otherwise be if they were to be computed inside the
body of the function. However, assigning the values is optional
as otherwise, at the expense of efficiency, the values will be
computed each time the function is invoked.
See
IDEAS.Utilities.Math.Functions.Examples.InverseXRegularized
for how to efficiently call this function.
function inverseXRegularized extends Modelica.Icons.Function; input Real x "Abscissa value"; input Real delta(min = Modelica.Constants.eps) "Abscissa value below which approximation occurs"; input Real deltaInv = 1/delta "Inverse value of delta"; input Real a = -15*deltaInv "Polynomial coefficient"; input Real b = 119*deltaInv^2 "Polynomial coefficient"; input Real c = -361*deltaInv^3 "Polynomial coefficient"; input Real d = 534*deltaInv^4 "Polynomial coefficient"; input Real e = -380*deltaInv^5 "Polynomial coefficient"; input Real f = 104*deltaInv^6 "Polynomial coefficient"; output Real y "Function value"; end inverseXRegularized;
smoothOrder = 1
and reimplmented the function so it is twice continuously differentiable.
This is for
issue 302.
smoothOrder = 1
.