# Math assignments

Math assignments are quizzes that allow you to enter math functions and certain constants.

Before you submit your assignment, you'll be able to preview your answer to see what the grader will see.

You can use basic symbols for addition (+), subtraction (-), multiplication (*), division (/), and power/exponential (^).

You need to use (*) for multiplication every time. For example, "3x" should be "3*x" instead.

## Function Syntax

Math assignments accept the following basic and advanced functions.

You can enter these math functions in the form of function(value). For example, the square root of 17 should be entered as sqrt(17). The cosine function of 5x should be entered as cos(5*x).

### Basic numeric functions

• abs (absolute value)
• max
• min
• mod
• ceiling
• floor
• gcd (greatest common denominator; 2 arguments only, enter three or more arguments as "gcd((a, b, c, d))" or "gcd([a, b, c, d])" e.g. a list/tuple)
• lcm (least common multiple; 2 arguments only, enter three or more arguments as "gcd((a, b, c, d))" or "gcd([a, b, c, d])" e.g. a list/tuple)
• sign (returns -1 if negative, 0 if zero, 1 if positive)

### Exponents

• exp (exponent)
• ln (natural logarithm, base e)
• log (common logarithm, base 10)
• root (2-argument, where root(a, 2) is equivalent to sqrt(a))
• sqrt (square root)

### Trigonometry

• Basic trigonometric functions: cos, cosh, cot, coth, sin, sinh, tan, tanh
• Trigonometric inverses: acos, acosh, acot, acoth, asin, asinh, atan, atan2 (2-argument arctangent), atanh
• deg (converts radians to degrees)
• rad (converts degrees to radians)

### Complex numbers

• arg (returns phase in radians of a complex number)
• conjugate
• im (get imaginary part of a number)
• re (get real part of a number)

### Other functions

• erf (error function)
• binomial

## Allowed constants

Math assignments recognize the following common constants:

• Catalan (Catalan's constant)
• E (note uppercase)
• EulerGamma (Euler-Mascheroni constant)
• GoldenRatio
• I (sqrt(-1) - note uppercase)
• J (sqrt(-1), same as I)
• nan
• oo (infinity)
• pi
• zoo (complex infinity)