# Objective

After working through this lesson, you’ll be able to:

• Use Math operators and symbols to construct expressions and perform calculations.

• Use the Lua Math Library.

# Math Operators

 Symbol Operation + Addition - Subtraction * Multiplication / Division ^ Exponentiation % Modulo Operator () Parenthesis

# Order of Operations

 Operation Symbol Parenthesis () Exponent ^ Multiplication, Division (left to right) * / Addition, Subtraction (left to right) + -

# Math Library

 ​ ​ math.abs() returns the absolute value of a number math.cos() returns the cosine value for a given value in radians math.sin() returns the sine value for a given value in radians math.tan() returns the tangent value for a given value in radians math.acos() returns the inverse cosine value for a given value in radians math.asin() returns the inverse sine value for a given value in radians math.tan() returns the inverse tangent value for a given value in radians math.ceil() returns the integer no greater than the given value math.floor() returns the integer no less than the given value math.deg() convert from radians to degrees math.rad() convert from degrees to radians math.exp(myval) returns e (the base of natural logarithms) raise to the power myval math.log() returns the inverse of math.exp() math.modf() returns the integral and fractional parts of a given number math.sqrt() returns the square root of a given number. math.random() generates pseudo random numbers uniformly distributed math.huge() represents infinity+ math.pi() returns the constant Pi