# EZ Math Movie, Language, Mathematics

### Mathematics

abs(n)

This command returns the absolute value of the parameter n. Here is its use:

```a = -4;
printNumber(abs(a));
```

The above code would produce the following output:

`4`

Tutorial: Other (mathematics)

cosine(angle)

This command returns the cosine of the angle given by the parameter angle. Here's an example:

```printNumber(cosine(60));
```

Assuming that angles were set to degree measurement, the above code would print the cosine of 60 degrees:

`.5`

Tutorial: Trigonometry

pi

This is a system variable. It holds the value of pi, about 3.141592653589793. Here is an example of its use:

`printNumber(pi);`

Assuming that the number of decimal places is set to its default, 2, the above code would produce the following output:

`3.14`

power(base, exponent)

This command returns the numeric value of the parameter base raised to the parameter exponent. Here is how it would be used:

`printNumber(power(3, 2));`

The above code would produce the value of 32, as shown here:

`9`

Tutorial: Powers, square roots

randomRealRange(minimum, maximum)

This command returns a random number somewhere between the numeric value parameters minimum and maximum. The command could possibly output the exact numeric value of minimum. It will never output the exact numeric value of maximum, but it could output a numeric value very close to maximum. Here is an example:

`printNumber(randomRealRange(3, 5));`

The above code would print a random value between 3 and 4.99.

Tutorial: A random walk

See: randomX(), randomY()

randomX()

This command will output a random x-coordinate somewhere along the current x-axis. Here is an example:

`x = randomX();`

The above code would produce a value for x somewhere between worldXMin and worldXMax, including worldXMin but not worldXMax. In other words, it works just like this:

`x = randomRealRange(worldXMin, worldXMax);`

randomY()

This command will output a random y-coordinate somewhere along the current y-axis. Here is an example:

`y = randomY();`

The above code would produce a value for y somewhere between worldYMin and worldYMax, including worldYMin but not worldYMax. In other words, it works just like this:

`y = randomRealRange(worldYMin, worldYMax);`

sine(angle)

This command returns the sine of the angle given by the parameter angle. Here's an example:

```printNumber(sine(30));
```

Assuming that angles were set to degree measurement, the above code would print the sine of 30 degrees:

`.5`

Tutorial: Trigonometry

setDegrees()

This command makes EZ Math Movie interpret all angle numeric values to be in units of degrees. This would include angle parameters to the trig functions and angle parameters in turtle graphics commands. It's use is simple:

`setDegrees();`

After the above line is executed, all angles in your program will be considered to be in degrees. By default angles in EZ Math Movie are considered to be in degrees.

This command makes EZ Math Movie think that angle measurements are in radians. This would include arguments to trig functions and turtle graphics commands. Its use is:

`setRadians();`

After the execution of the above code, all angles will be considered to be in radians. This is not the default. The default is degree measurement. So you must issue this command, probably in the before loop code, if you want to work in radians.

See: setDegrees()

sqrt(n)

This command returns the square root of the parameter n. The parameter n must be zero or a positive value. Here is how it is used:

`x = sqrt(49);`

The above code would place the value of 7 into the variable x.

Tutorial: Powers, square roots

tangent(angle)

This command returns the tangent of the angle given by the parameter angle. Here's an example:

```printNumber(tangent(45));
```

Assuming that angles were set to degree measurement, the above code would print the tangent of 45 degrees:

`1`

Tutorial: Trigonometry

twoPi

This is a system variable. It holds the value of 2 times pi, about 6.283185307179586. Here is an example of its use:

`printNumber(twoPi);`

Assuming that the number of decimal places is set to its default, 2, the above code would produce the following output:

`6.28`

### Other sites you may find interesting Like Math and Physics?

Zona Land Education offers explanations, diagrams, and animations on these topics.
And it is all presented in a clear and casual manner. Want to learn about programing computers?

EZ Programing Demos has an animated, slow motion, interactive programing language demonstrator.
The site presents basic ideas at a beginner's level.