Recent changes Random page
GAMING
Gaming
 
WoWWiki
Halopedia
FFXIclopedia
Age of Conan
Warhammer Online
Grand Theft Wiki
See more...

Trigonometry 101

From Robot Battle Wiki

Jump to: navigation, search
This tutorial is in progress
It may be incomplete. Please help by editing it.

Contents

[edit] 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
math This is an inclusive set of numbers. 'Inclusive' means that the numbers 'a' and 'b' are included in the set.
math This is an exclusive set of numbers. 'Exclusive' means that neither numbers 'a' and 'b' are included in the set.
math This is a left-exclusive set of numbers. This means that 'a' is included in the set, but 'b' is not.
math This is a right-exclusive set of numbers. This means that 'b' is included in the set, but 'a' is not.
math 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:math

means "any positive value." Also, any set including this as one of its bounds should be written as 'exclusive' on that end.

[edit] 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.

[edit] 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.

Image:BasicTriangle.jpg

Name Function Definition Domain (valid input values) Range (valid output values) Robot Battle Function
Sine math math math sin
Cosine math math math cos
Tangent math math math 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, math . 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.

[edit] 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: math


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: math

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 math math math asin
Arcosine math math math acos
Arctangent math math math atan, atan2*

[edit] 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?

[edit] 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: math . 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.

[edit] See also

[edit] 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.

Rate this article:
Share this article: