From Test-Scratch-Wiki

This page is in question to whether it is useful or not. You can discuss whether you want it deleted or not on its talk page.Reason: Isn't that relevant to Scratch |

**Mathematics** is the study, usage, and representation of numerical values -- this can be anything from counting to multiplication. There are many branches of mathematics, but the ones we will limit ourselves to are arithmetic, algebra, geometry, trigonometry, and calculus. Mathematics is particularly relevant to programming, as many algorithms and problems can be broken down into a series of mathematical problems.

This page is *not* a detailed explanation of all mathematics up to calculus. This page offers a brief overview of the fundamental branches of mathematics.

## In Scratch

Scratch has many ways of performing mathematical operations on numbers through its Operators Blocks. This block category contains mostly reporter and boolean.

More fundamentally, everything Scratch does *is* mathematics under the hood, because all calculations on a computer involve some form of mathematical arithmetic or logic. *Every* block that Scratch has is really, in some sense, just a collection of mathematical statements. For instance [pen down]] has to calculate exactly what area of the screen to color, while Point towards () has to change what a sprite's costume looks like. What's cool about Scratch is that you do not have to worry about the complicated mathematics behind these things because the Scratch Team has already done it for you! You can spend more time doing what is fun: making projects.

That being said, it is still important to understand the mathematics behind it because there isn't always a Scratch block for what you want to do. One example is that Scratch does not have blocks that let you create 3D games -- a solid understanding of mathematics will let you create those blocks. Another example is the non-existent block

`point towards x: () y: () // category=motion`

Scratch does not come with the block but it can often be useful, and is readily created with some knowledge of trigonometry.

## Algebra

Algebra is the study of manipulating symbols and numbers. It is often the first thing taught (after Arithmetic) and is fundamental to being a powerful programmer. If you've used Scratch's variables you've been using algebra without even knowing it. The basic tenant of Algebra is "we can use a variable instead of a number".

## Geometry

Geometry is the study of points, lines, shapes, and forms. This can be anything from calculating the length of a line to finding the volume of a three-dimensional shape. Geometry is one of the oldest branches and was used extensively by mathematicians until algebra became the favored representation.

Geometry is perhaps most well known as encompassing a large number of formulas. A list of the most useful formulas can be found here.

## Trigonometry

*Main article: Trigonometry*

Trigonometry is the study of triangles — specifically, the ratios of sides of right-angled triangles. The foundation of Trigonometry are the Trig (short for "Trigonometry) functions: Sine, Cosine, and Tangent. These three functions are remarkably useful for a large range of problems regarding angles and distances. For instance, we can use trigonometry to calculate the angle between two sprites.

## Calculus

Calculus is the study of the infinitesimal and how to use it to find the slope and area of curves. While calculus is a fundamental part of mathematics, and has applied in many areas of Computer Science, it is not terribly relevant to Scratch. However, it is worth mentioning in an article about mathematics,and is mainly used in geometry, making it useful, if, for say, you wanted to find out the area of your vector curve to know how to size it.

An example application of calculus is calculating the cubic root of a number. Scratch does not directly offer a cubic root function (though there is a neat, faster workaround). The way we solve this is with something called Newton's method. What this tells us is that we can find the cubic root of a number **n** by making a guess x_{1} and then plugging that guess into the formula

`x`

_{i+1} = x_{i} + (n - x^{3}) / 3x^{2}

By plugging in the value we get out back into the formula, we'll get closer and closer to the cubic root of n.