Modelica.Math.Special

Library of special mathematical functions

Information

This sublibrary contains functions to compute often used mathematical operators that cannot be expressed analytically.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
Modelica.Math.Special.erf erf Error function erf(u) = 2/sqrt(pi)*Integral_0_u exp(-t^2)*d
Modelica.Math.Special.erfc erfc Complementary error function erfc(u) = 1 - erf(u)
Modelica.Math.Special.erfInv erfInv Inverse error function: u = erf(erfInv(u))
Modelica.Math.Special.erfcInv erfcInv Inverse complementary error function: u = erfc(erfcInv(u))
Modelica.Math.Special.sinc sinc Unnormalized sinc function: sinc(u) = sin(u)/u

Modelica.Math.Special.erf

Error function erf(u) = 2/sqrt(pi)*Integral_0_u exp(-t^2)*d

Information

Syntax

Special.erf(u);

Description

This function computes the error function erf(u) = 2/sqrt(pi)*Integral_0_u exp(-t^2)*dt numerically with a relative precision of about 1e-15. The implementation utilizes the formulation of the Boost library (53-bit implementation of erf.hpp, developed by John Maddock). Plot of the function:

For more details, see Wikipedia.

Example

  erf(0)    // = 0
  erf(10)   // = 1
  erf(0.5)  // = 0.520499877813047

See also

erfc, erfInv, erfcInv.

Inputs

NameDescription
uInput argument

Outputs

NameDescription
y= 2/sqrt(pi)*Integral_0_u exp(-t^2)*dt

Modelica.Math.Special.erfc

Complementary error function erfc(u) = 1 - erf(u)

Information

Syntax

Special.erfc(u);

Description

This function computes the complementary error function erfc(u) = 1 - erf(u) with a relative precision of about 1e-15. The implementation utilizes the formulation of the Boost library (53-bit implementation of erf.hpp developed by John Maddock). Plot of the function:

If u is large and erf(u) is subtracted from 1.0, the result is not accurate. It is then better to use erfc(u). For more details, see Wikipedia.

Example

  erfc(0)    // = 1
  erfc(10)   // = 0
  erfc(0.5)  // = 0.4795001221869534

See also

erf, erfInv, erfcInv.

Inputs

NameDescription
uInput argument

Outputs

NameDescription
y= 1 - erf(u)

Modelica.Math.Special.erfInv

Inverse error function: u = erf(erfInv(u))

Information

Syntax

Special.erfInv(u);

Description

This function computes the inverse of the error function erf(u) = 2/sqrt(pi)*Integral_0_u exp(-t^2)*dt numerically with a relative precision of about 1e-15. Therefore, u = erf(erfInv(u)). Input argument u must be in the range (otherwise an assertion is raised):

-1 ≤ u ≤ 1

If u = 1, the function returns Modelica.Constants.inf.
If u = -1, the function returns -Modelica.Constants.inf
The implementation utilizes the formulation of the Boost library (erf_inv.hpp, developed by John Maddock).
Plot of the function:

For more details, see Wikipedia.

Example

  erfInv(0)            // = 0
  erfInv(0.5)          // = 0.4769362762044699
  erfInv(0.999999)     // = 3.458910737275499
  erfInv(0.9999999999) // = 4.572824958544925

See also

erf, erfc, erfcInv.

Inputs

NameDescription
uInput argument in the range -1 <= u <= 1

Outputs

NameDescription
y= inverse of error function

Modelica.Math.Special.erfcInv

Inverse complementary error function: u = erfc(erfcInv(u))

Information

Syntax

Special.erfInv(u);

Description

This function computes the inverse of the complementary error function erfc(u) = 1 - erf(u) with a relative precision of about 1e-15. Therefore, u = erfc(erfcInv(u)) and erfcInv(u) = erfInv(1 - u). Input argument u must be in the range (otherwise an assertion is raised):

0 ≤ u ≤ 2

If u = 2, the function returns -Modelica.Constants.inf.
If u = 0, the function returns Modelica.Constants.inf
The implementation utilizes the formulation of the Boost library (erf_inv.hpp, developed by John Maddock).
Plot of the function:

For more details, see Wikipedia.

Example

  erfcInv(1)         // = 0
  erfcInv(0.5)       // = 0.4769362762044699
  erfInv(1.999999)   // = -3.4589107372909473

See also

erf, erfc, erfInv.

Inputs

NameDescription
uInput argument

Outputs

NameDescription
yerfcInv(u)

Modelica.Math.Special.sinc

Unnormalized sinc function: sinc(u) = sin(u)/u

Information

Syntax

Special.sinc(u);

Description

This function computes the unnormalized sinc function sinc(u) = sin(u)/u. The implementation utilizes a Taylor series approximation for small values of u. Plot of the function:

For more details, see Wikipedia.

Example

  sinc(0)   // = 1
  sinc(3)   // = 0.0470400026866224

Inputs

NameDescription
uInput argument

Outputs

NameDescription
y= sinc(u) = sin(u)/u
Automatically generated Tue Apr 05 09:37:05 2016.