Jan 11th, 2008, 10:27 AM
Simple Maths Tutorial (Trigonometry)
First post on here and its gonna be a biggy (and hopefully a good one). I have not described uses for the calculations below as Trigonometry can be so broad at times and...well...I'm just too tired to think of any.
First off, what is Trigonometry? Simply, its all to do with calculations of triangles. Finding their side lengths and angles and area is the most basic. I will start with the easiest type of triangle - the Right-Angled Triangle.
Many people should have heard of this before and most should know what it is but for those who don't I'll give a brief overview.
Say I draw a triangle. It has sides A, B and C. The angle between sides B and C is 90 degrees. Pythagoras's Theorem states that the length of side A squared equals the length of side B squared plus the length of side C squared. For those who prefer it written out:
For Example, if side B was length 3, and side C was length 4, side A squared would equal:
3*3 + 4*4
9 + 16
so A would equal the square root of 25 - 5
Back in Pythagoras's day, they did not know about irrational numbers so when someone asked him what if B and C equaled one, he was so angry that he couldn't work out the square root of two that he threw that man off a boat to his death.
You may of heard of Sine and Cosine and Tangent (the function one not the line one) but their uses are often confused. First thing is that they are used ONLY in Right-Angled Triangles. That is why I titled this SOHCAHTOA - a name that will become clear.
The SOH part.
SOH stands for Sine of Angle, Opposite, Hypotenuse. The Hypotenuse (in case you didn't know) is the side that is not perpendicular to any other side in a Right-Angled Triangle. I.E. it is the side that doesnt not have one of its "end points touching" the right angle. The Opposite is the side that is...well...opposite the angle. The Sine of Angle is just that - the Sine of the Angle.
Now you need 2 of these variables to calculate the third but I haven't helped much by just saying Sine, Opposite, Hypotenuse, have I? What you really need is the equation that links the 3 of them.
That O with a line through is the symbol for an angle. Just move the equation round to find which parts you need ( Sine * Hyp. = Opp.),(Opp. / Sine = Hyp.).
You cannot use the right angle as the angle in the equation . Only the other two angles.
You may be asking, "Mike, what good is it to find out the Sine of the angle and not the angle itself?". Well there is a function called the inverse of Sine (normally written as Sine to the power of -1 which is a bit deceptive) to find out an angle when you've been given its Sine.
That is all I'll say on Sine for now. I may come back to it in another time and show you the graph of Sine and where Sine comes from but for now, that is not necessary.
FYI, Sine is normally written Sin.
The CAH part.
Like SOH, CAH is also an acronym. Cosine of Angle, Adjacent, Hypotenuse. This works the same as SOH BUT just using the side adjacent to the angle instead of opposite to it and you should find the Cosine of the angle instead of the Sine. There is also a inverse of Cosine which, again is written with a power of -1. The method of CAH is the same as SOH, just rearrange the part to find what you need.
You will see Cosine written as Cos.
The Last Part of SOHCAHTOA - TOA
Again, this works the same as the last two except that TOA stands for Tangent (written as Tan) of Angle, Opposite, Adjacent. If you haven't spotted it yet, the middle letter of each acronym so far has been the numerator on the right and the and last letter the denominator. Remember this and SOHCAHTOA and you'll be a wizard in Trig in no time...
Tan also has an inverse but the function "Tan" is a strange one. The Tangent of an angle is equal to the Sine of that angel divided by the Cosine of the angle. This produces a slightly strange graph and has what is called "Asymptotes" (spelled incorrectly probably) that is there is points on the graph where it has no value i.e. where the Cosine of the angle is equal to 0 and no real number can be divided by 0.
For gaming, SOHCAHTOA isn't that useful unless you need an angle. Most things, it is easier to find the lengths without it but I put it here anyway.
That's all for Right-Angled Triangles but what good is that if the triangle is not Right-Angled? Well there are a few things to help you there.
The Sine rule
Yup. It's our good old friend Sine again. This time he's back with another rule of his but this time, it is a bit more flexible.
You dont need all 3 parts - only 2. Simple shifting in the equation will help you find parts you need: e.g. Sine a equals Sine b divided by B multiplied by A
To find a side using the Sine Rule, the whole equation can be "flipped upside down" so that the lengths are on top and the angles on the bottom.
e.g. A equals B divided by Sine b multiplied by Sine a
That's the Sine Rule. Easy? Trigonometry is not as ferocious as its name. Time for another rule I think.
Just so I disappoint you now, no, there is no Tangent rule. There is a Cosine rule, however, which is a bit fiddly at times so I'll just go ahead and show you the two forms it's often seen in.
As you can see, you need 3 sides or 2 sides and the angle between the sides to use the Cosine Rule. This works with all sides and angles:
e.g. B squared = A squared + C squared - (2 * A * C * Cosine(b))
And that is that with finding sides and angles so there's just one more thing left.
Area of a Triangle
Most people knows the simple "height * base divided by 2" equation for finding area of a Right-Angled Triangle but we should know now that Trigonometry just doesn't like being confided to just Right-Angled Triangles so it went a little further.
(A * B * Sine of the angle between them) / 2
It looks similar to the previous formula doesn't it? Well that's because the Sine of 90 is 1. Simple as that really.
First one goes out to any moderators reading this. This is just a request but if you find a mistake, I would prefer you to tell me so that I can change it - I will be online often so I should be able to change it quickly.
Second Note. For those you need to use Sine or Cosine or Tan in VB - VISUAL BASIC WORKS IN RADIANS. Unless you've learnt about Radians they're a pain but can be useful if you ever do A-Level maths. To convert between the two, before you use Sine or Cosine etc. on the angle, multiply the angle by (Pi divided by 180). Then use Sine or Cosine etc. to find the correct value. (Generally define Pi as a constant of 3.14 if pin-point accuracy is not required).
Lastly, I have a couple more tutorials I might make in the near future - one is on calculations of linear lines (rolls of the tongue doesn't it?) - finding the gradient of a line etc. - and one on something I'm developing in VB6 - Artificial Neural Networking or for those who speak English - a program that learns from it's mistake, an emulator of the brain etc. I may also do one on circle and oval equations which I have found VERY useful at times.
Click Here to Expand Forum to Full Width
Survey posted by VBForums.