Math Operators

The dimension of Math Operators measures the use of mathematical operators and functions in your projects. These operators are essential for performing calculations, making decisions based on numerical values, and manipulating data. Mastery of these operators allows you to create more dynamic and interactive projects in Scratch.

If you get 1 point...

At the most basic level, you can use arithmetic operators to perform simple calculations. These include addition, subtraction, multiplication, and division. Here's a basic example showing these operators in use:

                    when green flag clicked
                    set [result v] to ((5) + (3))
                    say (result) for (3) secs
                    set [result v] to ((10) - (2))
                    say (result) for (3) secs
                    set [result v] to ((4) * (2))
                    say (result) for (3) secs
                    set [result v] to ((8) / (2))
                    say (result) for (3) secs
                

In this example, each arithmetic operation is executed sequentially, and the result is displayed on the screen. This demonstrates basic arithmetic calculations using Scratch's mathematical blocks.

If you get 2 points...

To achieve 2 points, the project has to include a mathematical formula, such as implementing the Pythagorean Theorem or using Linear Equations. Here's an example using the Pythagorean Theorem to calculate the hypotenuse of a right triangle:

                    when green flag clicked
                    set [a v] to (3)
                    set [b v] to (4)
                    set [hypotenuse v] to ([sqrt v] of (((a)*(a)) + ((b)*(b))))
                    say (hypotenuse) for (3) secs
                

In this example, the project calculates the hypotenuse of a right triangle where sides 'a' and 'b' are 3 and 4 units respectively. The formula used is the Pythagorean Theorem: a² + b² = c², where 'c' is the hypotenuse. The square root function is applied to get the value of the hypotenuse.

If you get 3 points...

Beyond basic arithmetic and comparison, Scratch allows for more advanced string manipulations using operators for handling text. These include joining strings, finding the length of a string, and checking if a string contains another string. Here's how you can use these string operators:

                    when green flag clicked
                    set [text1 v] to [Hello]
                    set [text2 v] to [World]
                    set [combinedText v] to (join (text1) (text2))
                    say (combinedText) for (3) secs
                    set [textLength v] to (length of (combinedText))
                    say (textLength) for (3) secs
                    if <(combinedText) contains [Hello]> then
                    say [Text contains 'Hello'] for (3) secs
                    else
                    say [Text does not contain 'Hello'] for (3) secs
                    end
                

In this example, we demonstrate how to concatenate strings, find the length of the concatenated string, and check if a string contains a specific substring. These operations are useful for manipulating and processing text data in your Scratch projects.

If you get 4 points...

For advanced projects, you can use trigonometric functions to perform calculations involving angles. Scratch supports functions for sine, which are useful for solving triangles using the Law of Sines. Here's an example of how to implement the Law of Sines to find an unknown side of a triangle:

                    when green flag clicked
                    set [angle A v] to (30)
                    set [angle B v] to (45)
                    set [side a v] to (10)
                    set [side b v] to ((side a)*(([sin v] of (angle A))/([sin v] of (angle B))))
                    say (join [Side b is ] (side b)) for (3) secs
                


In this example, the program calculates the length of side 'b' of a triangle using the Law of Sines: (a/sin A) = (b/sin B). Given angle A, angle B, and side a, the length of side b is computed and displayed. This demonstrates the use of the sine function to solve problems involving triangles.