4.1.1.9.1.11. pyfem.util.utilFunctions module

macauley(x: int | float) int | float[source]

Compute the Macaulay bracket operation on a value.

The Macaulay operation returns the input value when positive and zero when negative. Commonly used in mechanics for stress and strain calculations.

Parameters:

x – The input value (int or float)

Returns:

x if x >= 0, else 0

Return type:

The Macauley value

Examples

>>> macauley(5.0)
5.0
>>> macauley(-3.0)
0
>>> macauley(0.0)
0.0
sign(x: int | float) float[source]

Return the sign of a value.

Returns 1.0 for positive or zero values, and -1.0 for negative values.

Parameters:

x – The input value (int or float)

Returns:

1.0 if x >= 0, else -1.0

Return type:

The sign

Examples

>>> sign(5.0)
1.0
>>> sign(-3.0)
-1.0
>>> sign(0.0)
1.0