17.2.1. Constant Numeric Values and Expressions

After you scope the geometry for your boundary condition, the Magnitude field usually defaults to Constant.

Constant Numeric Values

If the magnitude is a constant numeric value, enter it in the Magnitude field.

Hexadecimal and Octal Numbers

In addition to decimal values, you can enter hexadecimal and octal values in the Magnitude field.

  • Hexadecimal numbers start with 0x (for example, 0x12).

  • Octal numbers start with & (for example, &12).

Constant Mathematical Expressions

If the magnitude is defined by a constant mathematical expression, enter the expression in the Magnitude field. Mechanical then evaluates the expression and applies it to the boundary condition.

The example on the left shows the expression =2 + (3 * 5) + pow(2,3) in the Magnitude field. The example on the right shows that this expression evaluates to a magnitude of 25.

Operators

The equal sign (=) must be used to begin an expression. Additional operators include: +, -, *, /, ^ (for power) and % (integer Modulus). Operator examples are shown here:

2+3
10.5-2.5
3.5*3.3
10.12/1.89
2^10
10%3
2*(3+5)

Operator Precedence

The order of operator precedence is:

  1. Parentheses

  2. Intrinsic functions (like sin or cos)

  3. Power (^)

  4. Multiplication (*), division (/) and integer modulus (%)

  5. Addition (+) and subtraction (-)


Note:  If the decimal separator in the current language is a comma (,) as it is in German, then the separator for the list of parameters of a function is a semicolon (;). For example, if an English expression is =2.5 + pow (1.3, 6), the equivalent German expression is =2,5 + pow (1.3; 6).


Intrinsic Functions

The supported intrinsic functions include the following:

Supported Intrinsic FunctionSample UsageUsage (Angles use current Units setting)
sin(x)sin(3.1415926535/2)Calculate sines and hyperbolic sines.
sinh(x)sinh(3.1415926535/2)
cos(x)cos(3.1415926535/2)Calculate the cosine (cos) or hyperbolic cosine (cosh).
cosh(x)cosh(3.1415926535/2)
tan(x)tan(3.1415926535/4)Calculate the tangent (tan) or hyperbolic tangent (tanh).
tanhtanh(1.000000)
asin(x)asin(0.326960)Calculates the arcsine. (x - Value whose arcsine is to be calculated).
acos(x)acos(0.326960)Calculates the arccosine. (x - Value between –1 and 1 whose arccosine is to be calculated).
atan(x)atan(-862.42)Calculates the arctangent of x (atan) or the arctangent of y/x (atan2). (x,y Any numbers).
atan2(y,x)atan2(-862.420000,78.514900)
pow(x,y)pow(2.0,3.0)Calculates x raised to the power of y. (x – Base y - Exponent).
sqrt(x)sqrt(45.35)Calculates the square root. (x should be a Nonnegative value).
exp(x)exp(2.302585093)Calculates the exponential. (x - Floating-point value).
log(x)log(9000.00)Calculates the natural logarithm. (x - Value whose logarithm is to be found).
log10(x)log10(9000.00)Calculates the common logarithm. (x - Value whose logarithm is to be found).
rand()rand()Generates a pseudo-random number.
ceil(x)ceil(2.8)Calculates the ceiling of a value. It returns a floating-point value representing the smallest integer that is greater than or equal to x. (x - Floating-point value).
ceil(-2.8)
floor(x)floor(2.8)Calculates the floor of a value. It returns a floating-point value representing the largest integer that is less than or equal to x. (x - Floating-point value).
floor(-2.8)
fmod(x,y)fmod(-10.0, 3.0)Calculates the floating-point remainder. The fmod function calculates the floating-point remainder f of x / y such that x = i * y + f, where i is an integer, f has the same sign as x, and the absolute value of f is less than the absolute value of y. (x,y - Floating-point values).