Skip to main content

Math

Math blocks let you perform basic mathematical operations. They are very useful for calculations.

Integer

123

Type: Value

Definition :

This block allows you to define an integer.

Use :

If we want to define an integer (in another block for example).

Basic operations

1 + 1

Type: Value

Definition :

This block allows you to achieve:

  • addition
  • subtraction
  • multiplication
  • division
  • power

Use :

If we want to perform a simple mathematical operation.

Basic functions

Square root of 9

Type: Value

Definition :

This block allows you to calculate:

  • the square root
  • absolute value
  • negation
  • natural logarithm
  • logarithm to base 10
  • exponential
  • power of 10

Use :

If we want to carry out a slightly more complex mathematical operation.

Trigonometry

sin 45

Type: Value

Definition :

This block allows you to calculate trigonometric functions:

  • sinuses
  • cosine
  • tangent
  • arc-sine
  • arc-cosine
  • arc-tangent

Use :

If we want to carry out trigonometric calculations to make Eliobot draw triangles for example.

Constants

pi

Type: Value

Definition :

This block allows you to retrieve the value of mathematical constants:

  • pi -e
  • phi
  • root of 2
  • root of 1/2
  • infinite

Use :

Advanced mathematical calculations (perimeter of a circle, area of ​​a triangle, etc.).

Test an integer

Test if a number is even

Type: Boolean block

Definition :

This block allows you to test if a number is:

  • even
  • odd
  • positive
  • negative
  • whole
  • first
  • divisible by

Use :

If we want to test a number to perform an action based on its value.

Round

Rounding a number

Type: Value

Definition :

This block allows you to round a number:

  • to the nearest integer
  • to the higher integer
  • to the lower integer

Use :

If we want to round a number to use it as the number of iterations for example, we can do 2 or 3 iterations, but not 3.33.

List operation

List sum

Type: Value

Definition :

This block allows you to perform operations on lists:

  • sum
  • average
  • minimum
  • maximum
  • median
  • majority
  • standard deviation
  • random element

Use :

If we want to perform calculations on a list of numbers. Or if we want to retrieve a random element from a list.

Remainder of a division

Division with remainder

Type: Value

Definition :

This block allows you to recover the remainder of a division (modulo).

Use :

If we want to recover the remainder of a division to carry out an action based on this remainder.

Constrain an integer between two values

Constraint a number

Type: Value

Definition :

This block allows you to constrain a number between two values. This ensures that the number is within a given range.

Use :

If we want to ensure that a number is in a given interval before using it. If we use percentages for example, we want to ensure that the number is between 0 and 100.

Random integer generation

Random number generator

Type: Value

Definition :

This block allows you to generate a random number between two terminals.

Use :

If we want to generate a random number to perform a random action.

Random fraction generation

Random fraction generator

Type: Value

Definition :

This block allows you to generate a random fraction.

Use :

If we want to generate a random fraction to perform a random action.

##atan2

atan2

Type: Value

Definition :

This block allows you to calculate the arctangent of two numbers. It is used to get the angle between two points.

Use :

If we want to calculate the angle between two points to turn Eliobot for example.