Skip to main content
Skip table of contents

Mathematical Functions

LabMaestro’s expression system includes various mathematical functions, such as trigonometric and rounding functions. This page presents these functions and includes simple practical examples.

Thank you for your interest in LabMaestro Public Beta! The page you are trying to access is under development. We are working on comprehensive documentation to help you make the most of our software. If you require any help, please feel free to contact us via email at

Trigonometric Functions

The following regular trigonometric functions are implemented in the expression system:

Sine, implemented with the function sin()
Cosine, implemented with the function cos()
Tangent, implemented with the function tan()
Arctangent, implemented with the function atan().

Please note that the trigonometric functions are operated in rad and not degrees. These functions take one argument (an angle in radiant) and return the result in radiant.

Example 1

If you want to make a grating oscillate between -30 and 30 degrees at a frequency of one oscillation per second over time (T), you can use the implement this mathematical function with the following expression:



and insert it in a grating's Orientation.Degrees field:

Rounding Functions

The following rounding function is implemented in the expression system:

Round down, implemented as the function floor().

This takes one double or float argument and returns the first integer value rounding down. This function It is also useful to convert a floating type variable when an expression requires an integer.

For example:


would return 1.

You can round up by adding 1 to the result.


would return 2.

Conditional Functions

The following conditional functions are implemented in the expression system:

Return the smallest of two values, implemented as min(value1,value2)
Return the largest of two values, implemented as max(value1,value2),

They take two arguments are return the minimum or maximum respectively.

For example:


would return 2.

You can find the minimum of more than two values by nesting min() functions.


would return -1.

Example 2

In a drifting dot pattern, if you wanted the dot population to match the time elapsed, but never exceed 8 dots, you could write the following expression:


And enter it in the DriftingDots' Population field.

Other Functions

Many other useful mathematical functions are implemented within the expression system. Here is the list and a short description:

Logarithm, returns the log in base e of the number provided, implemented as log()
Logarithm base 10, returns the log in base 10 of the number provided, implemented as log10()
Power of a base number, implemented as pow(base,power). Roots can be implemented as decimal powers.
Absolute value of a number, turns negative numbers into positive numbers while leaving positive numbers (and zero) unchanged, implemented as abs()
sign, returns -1 for negative numbers, 1 for positive numbers including 0, implemented as sign()

Example 3

This returns the square root of 100:


Example 4

Here is an expression which shows many functions in use:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.