9. Arythmetical Expressions#

9.1. Reserved words and arithmetic expressions of the derived results#

9.1.1. Reserved Words#

The following table shows the format of the reserved words for the predefined functions and an example of them:

Function

Description

Format

Example

Logarithm

Logarithm in base 10

log(A)

log()(<CMPT_DISPLACEMENTS:X><CMPT_DISPLACEMENTS:Y>)

Neperian logarithm

Neperian Logarithm

ln(A)

ln()(<CMPT_DISPLACEMENTS:X><CMPT_DISPLACEMENTS:Y>)

Maximum value

Extracts the maximum value of an array (A)

max(A)

max()(<CMPT_DISPLACEMENTS:X><CMPT_DISPLACEMENTS:Y>)

Minimum value

Extracts the minimum value of an array (A)

min(A)

min()(<CMPT_DISPLACEMENTS:X><CMPT_DISPLACEMENTS:Y>)

Absolute value

Extracts the maximum value of the array elements in absolute value

extremmax(A)

extremmax()(<CMPT_DISPLACEMENTS:X><CMPT_DISPLACEMENTS:Y>)

Minimum absolute value

Extracts the minimum value of the array elements in absolute value

extremmin(A)

extremmin()(<CMPT_DISPLACEMENTS:X><CMPT_DISPLACEMENTS:Y>)

Square Root

Calculates the square root of an expression or number

sqrt(A)

sqrt()(<CMPT_DISPLACEMENTS:X><CMPT_DISPLACEMENTS:Y>)

Operations are not key sensitive

9.1.2. Arithmetic Expressions#

The arithmetic expression may include arithmetic operators such as addition (+), subtraction (-), multiplication (*), division (/) or power (^).

Operation

Description

Format

Examples

Sum

Arithmetic Sum

A+B

<CMPT_DISPLACEMENTS:MAGNITUDE_R>+<CMPT_DISPLACEMENTS:MAGNITUDE_R>

Subtraction

Arithmetic Subtraction

A-B

<CMPT_DISPLACEMENTS:MAGNITUDE_R>-<CMPT_DISPLACEMENTS:MAGNITUDE_R>

Multiplication

Arithmetic Multiplication

A*B

<CMPT_DISPLACEMENTS:MAGNITUDE_R>*<CMPT_DISPLACEMENTS:MAGNITUDE_R>

Division

Arithmetic Division

A/B

<CMPT_DISPLACEMENTS:MAGNITUDE_R>/<CMPT_DISPLACEMENTS:MAGNITUDE_R>

Exponential

Empowerment

A^B

<CMPT_DISPLACEMENTS:MAGNITUDE_R>^<CMPT_DISPLACEMENTS:MAGNITUDE_R>

9.2. Predefined functions and arithmetic expressions of the attributes#

9.2.1. Predefined Functions#

The following table shows the format of the reserved words for the predefined functions and an example of them:

Function

Description

Format

Example

Logarithm

Logarithm in base 10

log(A)

log()log(+)

Neperian logarithm

Neperian Logarithm

ln(A)

ln()ln(+)

Maximum value

Extracts the maximum value of an array (A)

max(A)

max()max(+)

Minimum value

Extracts the minimum value of an array (A)

min(A)

min(+)min(+)

Absolute value

Extracts the maximum value of the array elements in absolute value

extremmax(A)

extremmax()extremmax(+)

Minimum absolute value

Extracts the minimum value of the array elements in absolute value

extremmin(A)

extremmin()extremmin(+)

Square Root

Calculates the square root of an expression or number

sqrt(A)

sqrt()sqrt(+)

*Operations are not key sensitive

9.2.2. Arithmetic Expressions#

The arithmetic expression may include arithmetic expressions such as addition (+), subtraction (-), multiplication (*), division (/) or power (^).

Operation

Description

Format

Example

Sum

Arithmetic Sum

A+B

+

Subtraction

Arithmetic Subtraction

A-B

-

Multiplication

Arithmetic Multiplication

A*B

*

Division

Arithmetic Division

A/B

/

Exponential

Empowerment

A^B

^

9.3. Predefined functions and arithmetic expressions of the Tags.#

The expressions to evaluate are written inside the “Tag Arithmetic Expression” section.

images/figura285_ARYTHMETICAL_EXPRESSIONS.png

Any arithmetic expression to be solved must be enclosed in ={ } and can be composed of numbers, variables and operators.

o Example format: ={expression_to_resolve} *If this format is not used, it will be interpreted as text directly.

It is important to note that the comma, period and comma settings depend on how they are configured on your computer. It can be changed in Windows (Control Panel -> Region -> Additional Settings).

images/figura286_ARYTHMETICAL_EXPRESSIONS.png

Within the arithmetic expression, you can define:

9.3.1. Standard Field#

You can add the variables that already exist in the “Field Name” list (standard variables) although the most common is CONTOUR, which is the plotted value in the mesh.

images/figura287_ARYTHMETICAL_EXPRESSIONS.png

With the attribute tool you can add new user-defined variables to the “Field Name” list.

An example of an arithmetic expression with a single variable would be:

o Format example: ={CONTOUR::ENTITY}

Standard variables can return a scalar or an array.

For example, in the CONTOUR variable when plotting with the option “In grid position” several values appear in the element and in that case it returns an array instead of a scalar, or for example, if the label is in elements and offsets are plotted CONTOUR::ENTITY will return an array with the offsets of the nodes of that element.

If the user wants to define an array with several values, the format to define it would be to delimit the array values by the character configured in Windows as list separator, and put the values between square brackets [ ].

o Format example: [500;ID;2] *Variables that return an array inside another array cannot be used.

9.3.2. Predefined Functions#

The following table shows the format of the reserved words for the predefined functions and an example of them:

Function

Description

Format

Example

Logarithm

Logarithm in base 10

log(A)

={log(CONTOUR::ENTITY)}={log(10*2)}  ={log([2.3;-0.3])}

Neperian logarithm

Neperian Logarithm

ln(A)

={ln(CONTOUR::ENTITY^2)}  ={ln(10*2)}

Maximum value

Extracts the maximum value of an array (A)

max(A)

={max(CONTOUR::ENTITY)*-1}={max([2.3;-0.3])}

Minimum value

Extracts the minimum value of an array (A)

min(A)

={min(-CONTOUR::ENTITY)}={min([2.3;-0.3])}

Absolute value

Extracts the maximum value of the array elements in absolute value

extremmax(A)

={extremmax(CONTOUR::ENTITY^2)}  ={extremmax([2.3;-0.3])}

Minimum absolute value

Extracts the minimum value of the array elements in absolute value

extremmin(A)

={extremmin(-CONTOUR::ENTITY)}  ={extremmin([2.3;-0.3])}

Square Root

Calculates the square root of an expression or number

sqrt(A)

={sqrt(CONTOUR::ENTITY)}={sqrt(4)} o ={sqrt([4;9])}

Operations are not key sensitive

9.3.3 Arithmetic Expressions#

The arithmetic expression may include arithmetic operators such as addition (+), subtraction (-), multiplication (*), division (/) or power (^).

Operation

Description

Format

Example

Sum

Arithmetic Sum

A+B

={CONTOUR::ENTITY+CONTOUR::ENTITY+7}

Subtraction

Arithmetic Subtraction

A-B

={CONTOUR::ENTITY-CONTOUR::ENTITY-5.57}

Multiplication

Arithmetic Multiplication

A*B

={CONTOUR::ENTITY0.17CONTOUR::ENTITY}

Division

Arithmetic Division

A/B

={11.17/CONTOUR::ENTITY/CONTOUR::ENTITY}

Exponential

Empowerment

A^B

={CONTOUR::ENTITY^2}

9.3.4. Numerical Constants#

Within this expression, whole numbers, decimals, signed and unsigned numbers can be identified, and the expression NaN is also accepted as numeric.

Scientific notation is allowed to express very large numbers.

o Example of format: ={6.5E-8} *This format only serves as input for a large number that you want to insert and will never act on variables, only on numbers.

9.3.5. Numerical Format#

3 types of numeric formatting are accepted as output to be displayed on the label.

  • No formatting: If no formatting is required, the expression is: ={Expression}

  • Floating: It is indicated before the closing brace of the expression according to the following nomenclature: ={Expression,%.2f}

  • Scientific notation: It is indicated before the closing brace of the expression according to the following nomenclature. ={Expression,%.2e}

In the float format and in the scientific notation format the 2 indicates the number of decimal places that appear, the “f” is the floating point and the exponential “e”.

o Example: ={CONTOUR::ENTITY^2,%.2f}