# Trigonometry 101

*27*pages on

this wiki

## Primer on Mathematical Notation Used in this Article

Where possible, this document tries to stick to general mathematical guidelines on notation, so those familiar with it can probably skip this section. However, since most of this isn't taught in the United States Public Education Curriculum until the Calculus level, this is put in here for sake of completeness.

Notation | What it means |

This is an inclusive set of numbers. 'Inclusive' means that the numbers 'a' and 'b' are included in the set. | |

This is an exclusive set of numbers. 'Exclusive' means that neither numbers 'a' and 'b' are included in the set. | |

This is a left-exclusive set of numbers. This means that 'a' is included in the set, but 'b' is not. | |

This is a right-exclusive set of numbers. This means that 'b' is included in the set, but 'a' is not. | |

This is an infinite number. An infinite number can be either positive or negative. You will generally see these as parts of the above set notations. For example:
means "any positive value." Also, any set including this as one of its bounds should be written as 'exclusive' on that end. |

## What is Trigonometry?

Trigonometry is the study of the mathematics involved with angles related to triangles. It is used very heavily in algebra, geometry, and calculus.

### What Are The Basic Trigonometric Functions (Sine, Cosine, and Tangent)?

The basic trigonometric functions are the basic parts of how we use trigonometry in mathematics in every day use.

Name | Function Definition | Domain (valid input values) | Range (valid output values) | Robot Battle Function |

Sine | sin | |||

Cosine | cos | |||

Tangent | tan |

It should be noted that in Robot Battle, and most other programming languages, the valid Domains for these functions are made to be, in use, . It does this, by wrapping the values around to fit in the real domain. It does this by subtracting or adding 360 degrees until it is in range. For instance 270° = -90°, since 270 - 360 = -90.

### What Are The Inverse Trigonometric Functions (Arcsine, Arccosine, Arctangent)?

Inverse functions are functions that provide a translation from the result of a function back into a value that was passed in to it. For instance:

In mathematics, inverse functions are usually represented (as above) by inserting a -1 super-script between the function name and its parenthesis. This is because with multiplication, this is the natural way to do it:

But in computer programming it is often difficult to represent a super-script in a quick and efficiently typed manner, so computer scientists usually use the classical naming, 'Arc' Trigonometric functions, which comes from the classical Greek word for 'inverse.'

The inverse functions for trigonometry don't have simple relationships to the actual lengths and angles that the basic functions do, and were only formally defined after the definition of Calculus. Thankfully, most calculators and computers actually implement the underlying calculus into a simple way to do it.

Name | Function Definition | Domain (valid input values) | Range (valid output values) | Robot Battle Function |

Arcsine | asin | |||

Arcosine | acos | |||

Arctangent | atan, atan2* |

## How to use it in Robot Battle

It's all well and good that they work the way they do, but how do you *use* them?

### Atan versus Atan2

Technically, atan will only return angles in the first and forth quadrants (if you don't know what that means: up and to the right, or down and to the left). This is because it really doesn't have enough information, because it is only passed a single value: . Because of the division, the signs (positive or negative) of both X and Y are lost, and only their total sign is left. For this reason, it is complex and often error prone to convert the result of atan into a real usable value.

For this reason, Robot Battle 1.4 simplified things greatly by adding a function called atan2, which takes two parameters, x and y (Note: In that order). This function does the heavy lifting for you, and returns the proper angle. Unless you really know what you're doing, and have a really good reason, you should always use atan2 instead of atan.

## See also

- Wikipedia:Trigonometry - The wikipedia article on Trigonometry
- Wikibooks:Algebra:Trigonometry - Trigonometry on the algebra wikibook

## Disclaimer

It should be pointed out that **this document in no way is meant as a replacement for a real education**. Don't try to use it as an excuse to sleep through your High School trig class.