Annex60.Utilities.Math.Functions.inverseXRegularized

# .Annex60.Utilities.Math.Functions.inverseXRegularized

Function that approximates 1/x by a twice continuously differentiable function

## Information

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 Annex60.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 Annex60.Utilities.Math.Functions.Examples.InverseXRegularized for how to efficiently call this function.

#### Interface

>     function inverseXRegularized
>       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;

## Revisions

- August 10, 2015, by Michael Wetter:
  Removed dublicate entry `smoothOrder = 1` and reimplmented the function so it is twice continuously differentiable. This is for issue 302.
- February 5, 2015, by Filip Jorissen:
  Added `smoothOrder = 1`.
- May 10, 2013, by Michael Wetter:
  Reformulated implementation to avoid unrequired computations.
- April 18, 2011, by Michael Wetter:
  First implementation.

Generated at 2026-05-12T20:19:03Z by OpenModelicaOpenModelica 1.26.7 using GenerateDoc.mos