.Modelica.Fluid.Utilities.regRoot

Information

This function approximates sqrt(abs(x))*sgn(x), such that the derivative is finite and smooth in x=0.

FunctionApproximationRange
y = regRoot(x)y ~= sqrt(abs(x))*sgn(x)abs(x) >>delta
y = regRoot(x)y ~= x/sqrt(delta)abs(x) << delta

With the default value of delta=0.01, the difference between sqrt(x) and regRoot(x) is 16% around x=0.01, 0.25% around x=0.1 and 0.0025% around x=1.

Interface

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

Revisions


Generated at 2024-12-23T19:25:42Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos