Math Component
  • 13 Feb 2023
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Math Component

  • Dark
    Light
  • PDF

Article Summary

The Math component consists of math operators with their specific functions. They are as follows:

Number Input

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

InputOutputBlock LayoutGenerated Code
NumberNumbernumberblock
0

Arithmetic Operators

This block is used to perform the Arithmetic operations: Addition (+), Subtraction (-), Multiplication (x), Division, Power (^), and Remainder.

InputOutputBlock LayoutGenerated Code
Variable or Number for all of the operations
Choose the type of arithmetic operation from the dropdown list
Number  remainderblock
1 + 1

1 - 1

1 * 1

1 / 1

Math.pow(1, 1)

64 % 10

Advance Operators

The Advance operator blocks perform the following operations:

InputOutputBlock LayoutGenerated Code
Variable or Number for all of the operations
Choose the type of Advance operator from the dropdown list
Returns number for all of these operations 
Math.sqrt(9)

Math.abs(9)

-9

Math.log(9)

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

Math.exp(9)

Math.pow(10,9)

Variable or Number
Choose the type of Advance operator from the dropdown list
Returns number for all of these operations 
Math.round(3.1)

Math.ceil(3.1)

Math.floor(3.1)

Variable or Number
Choose the type of Advance operator from the dropdown list
Returns boolean (true or false)
 
0 % 2 == 0

0 % 2 == 1

mathIsPrime(0)

0 % 1 == 0

0 > 0

0 < 0

0 % 0 == 0

Variable or Number
Choose the type of Advance operator from the dropdown list
Returns number for all of these operations

 
[].reduce(function(x, y)

{return x + y;});

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

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

mathMean([]);

mathMedian([]);

mathModes([]);

mathStandardDeviation([]);

mathRandomList([]);

Variable or NumberReturns numberconstraint
Math.min(Math.max(50, 1), 100);

Variable or NumberReturns NumberRandom Integer
mathRandomInt(1, 100)

Variable or NumberReturns NumberRandom fraction
 Math.random()

Constant Values

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

InputOutputBlock LayoutGenerated Code
Choose any constant from the dropdown listReturns the number value equal to the constant.



Math.PI

Math.E

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

Math.SQRT2

Math.SQRT1_2

Infinity

Degree Operators

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

InputOutputBlock LayoutGenerated 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, a super-smart generative AI, opening up ways to have tailored queries and responses