# Mathematics

The blocks in the mathematics category are used to activate calculations. The results of the calculations can be used, for example, as values for variables. Most mathematic blocks relate to general mathematical calculations, and should be self-explanatory.

### Blocks

#### Facts and Figures

Use the number block to enter any number into your program, or assign this number to a variable as a value. This program assigns the number 12 to the variable age : #### Simple calculations

This block has the structure value - operator - value. The available operators are +-÷× and ^. The operator can be selected via the drop down menu. It can be applied directly to numbers, or to values of variables. Example: This block outputs the result 144 (12^2).

#### Specialized calculations

This block applies the type of calculation selected from the drop down menu to the number behind it or the variable behind it. The available operations are:

• Square root,
• Sum,
• Natural logarithm,
• Exponential functions with the base e (e^1, e^2,...),
• Exponential functions with the base 10 (10^1, 10^2,...),
• Changing sign (multiplying by -1.

e here is Euler’s number. This block takes the square root of 16 and sets the variable to the result. #### Trigonometric functions

This block works similarly to the block described above, with the difference that the trigonometric functions sine, cosine, tangent, and their inverse functions are used. The number indicated or the value of the variable indicated is therefore inserted into the function selected in the drop down menu, and the result can then be processed in the program. In addition, there is also the block arctan2 of X: ... Y: ..., which makes it possible to use two real numbers (to be entered as X and Y) to output a function value for the arctan2 in a range of 360°.

#### Frequently used constants

This block works similarly to the number block, however you do not enter the numerical value here yourself. Instead, frequently used constants (such as π) are saved here as defaults. The constants can be selected via the drop down menu.

#### Remainder of a division

The remainder of ... block is used to output the remainder of a division. This program assigns the variable remainder to the remainder of the devision of 3:2, or 1: #### Round

The round ... block can be used to round an entered decimal number of the value of an entered variable to a whole number. You can choose from three options in the drop down menu:

• use “round” for standard rounding (e.g. 4.5 to 5)
• use “round up” for rounding up (e.g. 5.1 to 6)
• use “round down” for rounding down (e.g. 5.9 to 5).

#### Evaluating lists

You can use the ... of the list block to output

• the sum of all values in a list with “sum,”
• the smallest value in a list with “min,”
• the largest value in a list with “max,”
• the average of all values in a list with “average,”
• the median of a list with “median,”
• the most frequent value in a list with “mode,”
• the standard deviation of all values in a list with “standard deviation,”
• a random value from a list with “random item”

. You can select all of these options using the drop down menu for the block: #### Constrain input values

The constrain ... from ... to block allows you to constrain input values to a certain interval. Before an input value is processed, a test is conducted to check whether it is in the defined interval. There are three options for handling an entered value:

• The value is in the interval, so it is transmitted without change.
• The value is below the lower limit for the interval, so this lower limit is transmitted.
• The value is above the upper limit for the interval, so this upper limit is transmitted.

In this example, the block is used to constrain the value for the variable speed to the speeds supported by the motor: #### Generate random values

The two blocks random number from ... to... and random break  output a random value. The random number from ... to...  block outputs a number from the defined interval. The block random break, in contrast, outputs a value between 0.0 (and may include this number) and 1.0 (may not include this number).