4.7.1.1. Math
RecurDyn supports the following functions of Math
4.7.1.1.1. ABS
The ABS function returns the absolute value of the input value.
Format
ABS(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{ABS(x)}\,=\left| x\, \right|\)
Example
4.7.1.1.2. ACOS
The ACOS function returns the inverse cosine, in radians, of the input value. The input must be a real number. The returned value is within the range of -π ~ π.
Format
ACOS(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{ACOS=co}{{\text{s}}^{-1}}\left( x \right)\)
Example
As shown in the following figure, the ACOS function calculates the inverse cosine (in radians) of Marker 1 on the InertiaMarker’s x-axis.
ACOS( DX(1,2)/DM(1,2) ) <Argument: (1)body1.marker1, (2)body2.marker2 >
![../_images/image04919.png](../_images/image04919.png)
4.7.1.1.3. AINT
The AINT function returns the closest integer that is less than the input value.
Format
AINT(x)
Arguments definition
x |
A real number or a function that returns a real number |
Example
4.7.1.1.4. ANINT
The ANINT function returns the closest integer to the input value.
Format
ANINT(x)
Arguments definition
x |
A real number or a function that returns a real number |
Example
4.7.1.1.5. ASIN
The ASIN function returns the inverse sine, in radians, of the input value. The input must be a real number. The returned value is within the range of -π/2 ~ π/2.
Format
ASIN(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{ASIN=si}{{\text{n}}^{-1}}\left( x \right)\)
Example
As shown in the following figure, the ASIN function calculates the inverse sine (in radians) of Marker 1 on the InertiaMarker’s x-axis.
ASIN( DY(1,2)/DM(1,2) ) <Argument: (1)body1.marker1, (2)body2.marker2 >
![../_images/image05318.png](../_images/image05318.png)
4.7.1.1.6. ATAN
The ATAN function returns the inverse tangent, in radians, of the input value. The input must be a real number. The returned value is within the range of -π/2 ~ π/2.
Format
ATAN(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{ATAN =ta}{{\text{n}}^{-1}}\left( x \right)\)
Example
As shown in the following figure, the ATAN function calculates the inverse tangent (in radians) of Marker 1 on the InertiaMarker’s x-axis.
ATAN( DY(1,2)/DX(1,2) ) <Argument: (1)body1.marker1, (2)body2.marker2 >
![../_images/image05518.png](../_images/image05518.png)
4.7.1.1.7. ATAN2
The ATAN2 function returns the inverse tangent, in radians, of the input values. Both input values (numerator and denominator) must be real numbers. The returned value is within the range of -π ~ π.
Format
ATAN2(dx, dy)
Arguments definition
dx |
A real number or a function that returns a real number |
dy |
A real number or a function that returns a real number |
Formulation
\(\text{ATAN2}=\left\{ \begin{matrix} \text{ta}{{\text{n}}^{-1}}\text{(dy/dx)} \\ \text{ta}{{\text{n}}^{-1}}\text{(dy/dx)+ }\!\!\pi\!\!\text{ } \\ \text{ta}{{\text{n}}^{-1}}\text{(dy/dx)- }\!\!\pi\!\!\text{ } \\ \text{+ }\!\!\pi\!\!\text{ /2} \\ \text{- }\!\!\pi\!\!\text{ /2} \\ \text{undefined} \\ \end{matrix} \right.\,\,\,\,\,\,\,\,\,\,\,\,\,\,\begin{matrix} dx>0,\,\,\,\,dy>0 \\ dx>0,\,\,\,\,dy<0 \\ dx<0,\,\,\,\,dy<0 \\ dx>0,\,\,\,\,\,dy=0 \\ dx<0,\,\,\,\,dy\,=0 \\ dx=0,\,\,\,\,dy\,=0 \\ \end{matrix}\)
Example
As shown in the following figure, the ATAN2 function calculates the inverse tangent (in radians) of Marker 1 on the InertiaMarker’s x-axis.
ATAN2( DY(1,2),DX(1,2) ) <Argument: (1)body1.marker1, (2)body2.marker2 >
![../_images/image05518.png](../_images/image05518.png)
4.7.1.1.8. COS
The COS function returns the cosine of the input value. The input must be a real number. The returned value is within the range of -1 - 1.
Format
COS(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{COS = cos}\left( \text{x} \right)\)
Example
4.7.1.1.9. COSH
The COSH function returns the hyperbolic cosine of the input value.
Format
COSH(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{COSH}=\frac{{{e}^{x}}+{{e}^{-x}}}{2}\)
Example
4.7.1.1.10. DIM
The DIM function returns the actual value if the difference between x and y is positive and returns 0 if the difference between x and y is negative.
Format
DIM(x, y)
Arguments definition
x |
A real number or a function that returns a real number |
y |
A real number or a function that returns a real number |
Formulation
\(\text{DIM }=\left\{ \begin{matrix} 0, \\ x-y, \\ \end{matrix} \right.\text{ }\begin{matrix} x\text{ }\le \,\,y \\ x\text{ }>\text{ }y \\ \end{matrix}\,\)
Example
4.7.1.1.11. DTOR
The DTOR function converts a degree value to a radian value.
Format
DTOR
Formulation
\(\text{DTOR=}\pi /\text{180}{}^\circ\)
Example
DTOR*180=3.141592
Caution
If d is inserted at the end of a real number (such as 180d) in an expression, then it is recognized as a degree and automatically converted to a radian value. Therefore, 180d*DTOR returns an incorrect calculation.
4.7.1.1.12. EXP
The EXP function returns the natural logarithm (base e) constant raised to the input value.
Format
EXP(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{EXP}={{e}^{x}}\)
Example
4.7.1.1.13. IF
The arithmetic IF function assigns the conditions for calculating functions and returns the value for those functions when the given conditions are satisfied.
Format
IF(fl: f2, f3, f4)
Arguments definition
f1 |
Defines the equation that provides the conditions under which to derive the value of the function. |
f2 |
Returns the calculated values when f1 < -IFT. This must be a real number or a function that returns a real number. |
f3 |
Returns the calculated values when IFT ≥ f1 ≥ -IFT. This must be a real number or a function that returns a real number. |
f4 |
Returns the calculated values when f1 > IFT. This must be a real number or a function that returns a real number. |
IFT (If Tolerance): When an If clause is calculated, the IFT value functions as a parameter that modifies the conditions so that they respond to 0 by allowing a slight range because the result of Expression1 may not be exactly 0. The input values for these parameters can be found on the General page in the Simulation Settings.
Formulation
\(IF(fl:f2,f3,f4)=\left\{ \begin{matrix} f2, \\ f3, \\ f4, \end{matrix} \right. \begin{matrix} \, \, \, \, \text{when } f1 \le -IFT \\ \, \, \, \, \, \, \, \text{when } -IFT \leq f1 \leq IFT \\ \, \, \, \,\text{when } IFT \le f1 \end{matrix}\)
Example
The following Example conditionally defines the different values according to the value of the time.
IF(TIME-2.0:-1.0, 0.0, 1.0)
Expression1 = TIME - 2.0
Expression2 = -1.0
Expression3 = 0
Expression4 = 1.0
TIME < (2.0 - IF Tolerance) Result: IF = -1.0
TIME >= (2.0 - IF Tolerance) and TIME <= (2.0 + IF Tolerance) Result: IF = 0.0
TIME > (2.0 + IF Tolerance) Result: IF = 1.0
Figure 4.39 Example result using the IF function
4.7.1.1.14. LOG
The LOG function returns the natural logarithm of the input value.
Format
LOG(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(LOG=lo{{g}_{e}}(x)\)
Example
4.7.1.1.15. LOG10
The LOG10 function returns the base-10 logarithm of the input value.
Format
LOG10(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{LOG10=lo}{{\text{g}}_{\text{10}}}\text{(}x\text{)}\)
Example
4.7.1.1.16. MAX
The MAX function returns the largest of the input values.
Format
MAX(x1, x2)
Arguments definition
x1 |
A real number or a function that returns a real number |
x2 |
A real number or a function that returns a real number |
Formulation
\(\text{MAX=max(}x\text{1, }x\text{2)}\)
Example
4.7.1.1.17. MIN
The MIN function returns the smallest of the input values.
Format
MIN(x1, x2)
Arguments definition
x1 |
A real number or a function that returns a real number |
x2 |
A real number or a function that returns a real number |
Formulation
\(\text{MIN=min(}x\text{1, }x\text{2)}\)
Example
4.7.1.1.18. MOD
The MOD function returns the remainder when x is divided by y.
Format
MOD(x, y)
Arguments definition
x |
A real number or a function that returns a real number |
y |
A real number or a function that returns a real number |
Formulation
\(\text{MOD=}x-\text{int}(x/y)\cdot y\)
Example
4.7.1.1.19. PI
The PI function returns pi (π).
Format
PI
Formulation
\(\text{PI}=3.1415926......\)
Example
4.7.1.1.20. RTOD
The RTOD function converts a radian value to a degree value.
Format
RTOD
Formulation
\(\text{RTOD=180}{}^\circ \text{/}\pi\)
Example
RTOD*pi=180
4.7.1.1.21. SIGN
The SIGN function returns an absolute value that has the magnitude x and the sign of y.
Format
SIGN(x, y)
Arguments definition
x |
A real number or a function that returns a real number |
y |
A real number or a function that returns a real number |
Formulation
\(\text{SIGN=}\left\{ \begin{matrix} \left| x \right|(y\ge 0) \\ -\left| x \right|(y<0) \\ \end{matrix} \right.\)
Example
4.7.1.1.22. SIN
The SIN function returns the sine of the input value. The returned value is within the range of -1-1.
Format
SIN(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{SIN=sin}\left( x \right)\)
Example
4.7.1.1.23. SINH
The SINH function returns the hyperbolic sine of the input value.
Format
SINH(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{SINH}=\frac{{{e}^{x}}-{{e}^{-x}}}{2}\)
Example
4.7.1.1.24. SQRT
The SQRT function returns the square root of the input value.
Format
SQRT(x)
x |
|
Formulation
\(\text{SQRT}=\sqrt{x}\)
Example
4.7.1.1.25. TAN
The TAN function returns the tangent of the input value.
Format
TAN(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{TAN=tan}\left( x \right)\)
Example
4.7.1.1.26. TANH
The TANH function returns the hyperbolic tangent of the input value.
Format
TANH(x)
Arguments definition
x |
A real number or a function that returns a real number |
Formulation
\(\text{TANH=}\frac{{{e}^{x}}-{{e}^{-x}}}{{{e}^{x}}+{{e}^{-x}}}\)
Example