Math Block
  • 06 Aug 2021
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Math Block

  • Dark
    Light
  • PDF

Article summary

The Math operators with their respective blocks are as follows:

Number Input:

   This block represents a number when it is given as input. 

Input 

Output

Block Layout

Generated Code

Number

Number

0

 

Arithmetic Operator:

It is used to perform the arithmetic operations: Addition (+), Subtraction (-), Multiplication (x), Division, Power (^), Reminder.

Input 

Output

Block Layout

Generated Code

Variable or number for all

 

Choose the type of arithmetic operation

Number


1 + 1

1 - 1

1 * 1

1 / 1

Math.pow(1, 1)

64 % 10

 

Advance Operator:

Advance Operator performs the following Operations: Square Root,Absolute, Negative, Round Of up or down, Random Number Generator, Even/Odd, Random Fraction Number.

Input 

Output

Block Layout

Generated Code

Variable or number for all

 

Choose the type of advance operations.

Returns The number for all except number check block

Returns The boolean (true or false) for number check block







Math.sqrt(9)

Math.abs(9)

-9

Math.log(9)

Math.log(9) / Math.log(10)

Math.exp(9)

Math.pow(10,9)


Math.round(3.1)

Math.ceil(3.1)

Math.floor(3.1)


Math.min(Math.max(50, 1), 100)


0 % 2 == 0

0 % 2 == 1

mathIsPrime(0)

0 % 1 == 0

0 > 0

0 < 0

0 % 0 == 0


Math.random()





[].reduce(function(x, y)

{return x + y;});

Math.min.apply(null, []);

Math.max.apply(null, []);

mathMean([]);

mathMedian([]);

mathModes([]);

mathStandardDeviation([]);

mathRandomList([]);


Math.min(Math.max(50, 1), 100);

 

Constant Values:

In this block, constant values are provided as inputs to perform operations pertaining to equations. 

Input 

Output

Block Layout

Generated Code

 Any constant

Returns the number value equal to the constant.



Math.PI

Math.E

(1 + Math.sqrt(5)) / 2

Math.SQRT2

Math.SQRT1_2

Infinity

 

Degree Operation:

The Degree Operations are used to perform trigonometric operations. They are: sin, cos, tan, arcsin, arccos, arctan.

Input 

Output

Block Layout

Generated Code

Choose the type of operation

 

 

Degree value as variable or number

Returns the degree operation result value as a number




Math.sin(45 / 180 * Math.PI)

Math.cos(45 / 180 * Math.PI)

Math.tan(45 / 180 * Math.PI)

Math.asin(45) / Math.PI * 180

Math.acos(45) / Math.PI * 180

Math.atan(45) / Math.PI * 180

Was this article helpful?

What's Next
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence