Valhalla Legends Archive

Member Forums => Yoni's Math Forum => Topic started by: ObsidianWolf on January 22, 2004, 11:25 AM

Title: Pythagorean theorem
Post by: ObsidianWolf on January 22, 2004, 11:25 AM
A squared + B squared = C squared

So in Programming it would be roughly

((A x A) + (B x B))/2 = C Squared?
Title: Re:Pythagorean theorem
Post by: ObsidianWolf on January 22, 2004, 11:47 AM
nm, Solved my own question by looking in earlier posts.  

Pythagoras theorem: c^2 = a^2 + b^2
Trigonometry: c = a/sin(alpha) = b/sin(beta) = a/cos(beta) = b/cos(alpha)
Title: Re:Pythagorean theorem
Post by: K on January 22, 2004, 12:21 PM
And don't forget the law of cosines too!  :P
triangle with sides a, b, c, each side opposite it's respective angle A, B, C.

a2 = b2 + c2 - 2bc*cos(A)

Edit: changed sign.  See reply below.  That's what I get for trying to do things from memory.
Edit2: changed angle.  See further below.  I will now hide myself in shame for even posting to begin with.
Title: Re:Pythagorean theorem
Post by: Yoni on January 22, 2004, 01:24 PM
Close enough, but it's really
a² = b² + c² - 2bc*cos(A)

The sign on the cosine is negative, and the angle in the cosine on the right of the equation is opposite the side that's squared on the left of the equation.

Edit: Note that the Pythagorean theorem can be viewed as a special case of the cosine theorem for A = 90 degrees. (Then cos(A) = 0.)
Title: Re:Pythagorean theorem
Post by: ObsidianWolf on January 22, 2004, 02:08 PM
Will your way produce any more of an accurate answer Yoni?  If so Ill use that instead.
Title: Re:Pythagorean theorem
Post by: Yoni on January 22, 2004, 03:05 PM
A more accurate answer?? This isn't about accuracy or precision, it's a theorem that helps you find an expression for the ratio between parts of the triangle. You should use it if it's useful for what you're trying to solve, or something else if it's not. Accuracy or precision are a different matter, and they don't depend on the way you used to reach the solution.

Btw K, you're still taking the cosine of the wrong angle :P
Title: Re:Pythagorean theorem
Post by: ObsidianWolf on January 22, 2004, 03:42 PM
Im using it to find a value between lat longs.  if the value falls in a certain range then i pass it along to mapper routine.