QCalc.Math

Library of mathematical functions (e.g., sin, cos), where angle is a quantity

Information

This package contains trigonometric functions that have been copied and modified from Modelica.Math to accept or return angle as a quantity.

Extends from Icons.Package (Icon for standard packages (from MSL 3.2.1)).

Package Contents

Name Description
QCalc.Math.acos acos Inverse cosine (-1 ≤ u ≤ 1)
QCalc.Math.asin asin Inverse sine (-1 ≤ u ≤ 1)
QCalc.Math.atan atan Inverse tangent
QCalc.Math.atan2 atan2 Four quadrant inverse tangent
QCalc.Math.atan3 atan3 Four quadrant inverse tangent (with solution closest to given angle y0)
QCalc.Math.cos cos Cosine
QCalc.Math.sin sin Sine
QCalc.Math.tan tan Tangent (u shall not be -π/2 rad, π/2 rad, 3π/2 rad, …)

QCalc.Math.acos QCalc.Math.acos

Inverse cosine (-1 ≤ u ≤ 1)

QCalc.Math.acos

Information

This function returns y = acos(u), with -1 ≤ u ≤ +1, where y is an angle.

Extends from Modelica.Math.Icons.AxisCenter (Basic icon for mathematical function with y-axis in the center).

Inputs

TypeNameDefaultDescription
Realu  

Outputs

TypeNameDescription
Angley[ A]

Modelica definition

function acos "Inverse cosine (-1 ≤ u ≤ 1)" extends Modelica.Math.Icons.AxisCenter; input Real u; output Q.Angle y; algorithm y := Modelica.Math.acos(u)*U.rad; end acos;

QCalc.Math.asin QCalc.Math.asin

Inverse sine (-1 ≤ u ≤ 1)

QCalc.Math.asin

Information

This function returns y = asin(u), with -1 ≤ u ≤ +1, where y is an angle.

Extends from Modelica.Math.Icons.AxisCenter (Basic icon for mathematical function with y-axis in the center).

Inputs

TypeNameDefaultDescription
Realu  

Outputs

TypeNameDescription
Angley[ A]

Modelica definition

function asin "Inverse sine (-1 ≤ u ≤ 1)" extends Modelica.Math.Icons.AxisCenter; input Real u; output Q.Angle y; algorithm y := Modelica.Math.asin(u)*U.rad; end asin;

QCalc.Math.atan QCalc.Math.atan

Inverse tangent

QCalc.Math.atan

Information

This function returns y = atan(u), with -∞ < u < ∞, where y is an angle.

Extends from Modelica.Math.Icons.AxisCenter (Basic icon for mathematical function with y-axis in the center).

Inputs

TypeNameDefaultDescription
Realu  

Outputs

TypeNameDescription
Angley[ A]

Modelica definition

function atan "Inverse tangent" extends Modelica.Math.Icons.AxisCenter; input Real u; output Q.Angle y; algorithm y := Modelica.Math.atan(u)*U.rad; end atan;

QCalc.Math.atan2 QCalc.Math.atan2

Four quadrant inverse tangent

QCalc.Math.atan2

Information

This function returns y = atan2(u1, u2), where y is an angle, such that tan(y) = u1/u2 and y is in the range -π rad < y ≤ π rad. u2 may be zero, provided u1 is not zero. Usually u1, u2 is provided in such a form that u1 = sin(y) and u2 = cos(y).

Extends from Modelica.Math.Icons.AxisCenter (Basic icon for mathematical function with y-axis in the center).

Inputs

TypeNameDefaultDescription
Realu1  
Realu2  

Outputs

TypeNameDescription
Angley[ A]

Modelica definition

function atan2 "Four quadrant inverse tangent" extends Modelica.Math.Icons.AxisCenter; input Real u1; input Real u2; output Q.Angle y; algorithm y := Modelica.Math.atan2(u1, u2)*U.rad; end atan2;

QCalc.Math.atan3 QCalc.Math.atan3

Four quadrant inverse tangent (with solution closest to given angle y0)

QCalc.Math.atan3

Information

This function returns y = atan2(u1, u2, y0), where y is an angle, such that tan(y) = u1/u2 and y is in the range -π rad < y - y0 ≤ π rad. u2 may be zero, provided u1 is not zero.

The difference from atan2() is the optional third argument y0 that specifies which of the infinite many solutions is returned. Note that for the default case (y0 = 0), the result is the same as from atan2().

Extends from Modelica.Math.Icons.AxisCenter (Basic icon for mathematical function with y-axis in the center).

Inputs

TypeNameDefaultDescription
Realu1  
Realu2  
Angley00y shall be in the range: -π < y - y0 ≤ π [ A]

Outputs

TypeNameDescription
Angley[ A]

Modelica definition

function atan3 "Four quadrant inverse tangent (with solution closest to given angle y0)" extends Modelica.Math.Icons.AxisCenter; input Real u1; input Real u2; input Q.Angle y0=0 "y shall be in the range: -π < y - y0 ≤ π"; output Q.Angle y; algorithm y := atan2(u1, u2); if y0 <> 0 then y := y + integer((y0 - y)/U.cyc + 0.5)*U.cyc; end if; // For the default (y0 = 0), return the same result as atan2(). end atan3;

QCalc.Math.cos QCalc.Math.cos

Cosine

QCalc.Math.cos

Information

This function returns y = cos(u), where u is an angle.

Extends from Modelica.Math.Icons.AxisLeft (Basic icon for mathematical function with y-axis on left side).

Inputs

TypeNameDefaultDescription
Angleu [ A]

Outputs

TypeNameDescription
Realy 

Modelica definition

function cos "Cosine" extends Modelica.Math.Icons.AxisLeft; input Q.Angle u; output Real y; algorithm y := Modelica.Math.cos(u/U.rad); end cos;

QCalc.Math.sin QCalc.Math.sin

Sine

QCalc.Math.sin

Information

This function returns y = sin(u), where u is an angle.

Extends from Modelica.Math.Icons.AxisLeft (Basic icon for mathematical function with y-axis on left side).

Inputs

TypeNameDefaultDescription
Angleu [ A]

Outputs

TypeNameDescription
Realy 

Modelica definition

function sin "Sine" extends Modelica.Math.Icons.AxisLeft; input Q.Angle u; output Real y; algorithm y := Modelica.Math.sin(u/U.rad); end sin;

QCalc.Math.tan QCalc.Math.tan

Tangent (u shall not be -π/2 rad, π/2 rad, 3π/2 rad, …)

QCalc.Math.tan

Information

This function returns y = tan(u), where u is an angle (if u is a multiple of (n - 1/2) π rad, then y = tan(u) is ±∞).

Extends from Modelica.Math.Icons.AxisCenter (Basic icon for mathematical function with y-axis in the center).

Inputs

TypeNameDefaultDescription
Angleu [ A]

Outputs

TypeNameDescription
Realy 

Modelica definition

function tan "Tangent (u shall not be -π/2 rad, π/2 rad, 3π/2 rad, …)" extends Modelica.Math.Icons.AxisCenter; input Q.Angle u; output Real y; algorithm y := Modelica.Math.tan(u/U.rad); end tan;