.ThermoPower.Functions.squareReg

Information

This function approximates x^2*sgn(x), such that the derivative is non-zero in x=0.

FunctionApproximationRange
y = regSquare(x)y ~= x^2*sgn(x)abs(x) >> delta
y = regSquare(x)y ~= x*deltaabs(x) << delta

With the default value of delta=0.01, the difference between x^2 and regSquare(x) is 41% around x=0.01, 0.4% around x=0.1 and 0.005% around x=1.

Interface

function squareReg
  extends Modelica.Icons.Function;
  input Real x;
  input Real delta = 0.01 "Range of significant deviation from x^2*sgn(x)";
  output Real y;
end squareReg;

Revisions


Generated at 2024-04-19T18:16:02Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos