.ThermoPower.Functions.sqrtReg

Information

This function approximates sqrt(x)*sign(x), such that the derivative is finite and smooth in x=0.
Function Approximation Range
y = sqrtReg(x) y ~= sqrt(abs(x))*sign(x) abs(x) >> delta
y = sqrtReg(x) y ~= x/sqrt(delta) abs(x) << delta

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

Interface

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

Revisions


Generated at 2020-04-09T01:37:39Z by OpenModelicaOpenModelica 1.16.0~dev-268-gc5be668 using GenerateDoc.mos