Happy Atheist Forum

Getting To Know You => Ask HAF => Topic started by: teyla on February 17, 2009, 02:31:47 AM

Title: My trig question :).
Post by: teyla on February 17, 2009, 02:31:47 AM
Well I was working some problems, simple ones.
example being:
Right triangle
hypotenuse = 8
leg 1 = x
leg2=y
angle opposite leg1 1= 36

so we would do

.........Cos36=Y
........-------  ----
...........1..... 8                
6.5=1y
y=6.5

I know it wasn't nessicery to do the problem but I was bored  :D !
my question is:
How can i get the cos36, or sin14 without the calculator? is there an equation i can use?
Title: Re: My trig question :).
Post by: teyla on February 17, 2009, 02:34:45 AM
That's odd..I posted in help desk yet it showed up in two sections... sorry for double post. :unsure:
Title: Re: My trig question :).
Post by: AlP on February 17, 2009, 02:59:38 AM
There's no easy way of expressing sin and cos in terms of a finite number of basic arithmetic operations. It's interesting, when I was learning trig, that's one of the first things I tried to do as well. I tried to find a number I could multiply the angle by that would give me its sine or cosine. It's not that simple unfortunately.

To do it, you have to use an infinite series like a Maclaurin series. That's an infinite number of terms that can be expressed using basic arithmetic that you add together. As an example:

cos(x) = 1 - x^2/2! + x^4/4! -x^6/6! + x^8/8! - ...

The expression on the right is infinite. The more terms you add the more accurate the result. People will often use an approximation of this sort when computing a sine or cosine on a computer. I've done that several times (I'm a software engineer).

x^6 means x * x * x * x * x * x
6! means 6 * 5 * 4 * 3 * 2 * 1
Title: Re: My trig question :).
Post by: AlP on February 17, 2009, 03:15:07 AM
It occurred to me that you might try and verify this for yourself. You need to measure the units of angle in radians rather than degrees to make the Maclaurin series work. In degrees, a full circle is 360. But in math we use another unit called radians because things work out much better that way. In radians, a full circle is 2 * pi. Pi is an interesting math constant that is approximately equal to 3.14. So a full circle is approximately 6.28. 36 degrees would be about 0.63 radians. So if you're computing cos(x) using a Maclaurin series, first you need to convert x into radians (radians = degrees / 180 * pi).
Title: Re: My trig question :).
Post by: teyla on February 17, 2009, 03:18:10 AM
I am confused im sorry.
How can i convert degree's to radians?
Im a slow learner  :P
Title: Re: My trig question :).
Post by: AlP on February 17, 2009, 03:21:28 AM
This is an approximation:

radians = (degrees / 180) * 3.14

This is a better approximation:

radians = (degrees / 180) * 3.1415926535897932384626433832795

The more digits of pi you use, the more accurate the result.

:)
Title: Re: My trig question :).
Post by: teyla on February 17, 2009, 03:27:14 AM
so then it would be for Cos50.


Cos0.872?
if so what do i do after this?
Title: Re: My trig question :).
Post by: AlP on February 17, 2009, 03:41:50 AM
You got the conversion from degrees to radians right.

Now you need to calculate the various parts of the Maclaurin series far enough to get a sufficiently accurate approximation.

The Maclaurin series for cos is:

cos(x) = 1 - x^2/2! + x^4/4! -x^6/6! + x^8/8! - ...

So the various parts are:
x = 0.872

x^2 = 0.872 * 0.872 = 0.760
2! = 2 * 1 = 2

x^4 = 0.872 * 0.872 * 0.872 * 0.872 = 0.578
4! = 4 * 3 * 2 * 1 = 24

x^6 = 0.872 * 0.872 * 0.872 * 0.872 * 0.872 * 0.872 = 0.440
6! = 6 * 5 * 4 * 3 * 2 * 1 = 720

x^8 = 0.872 * 0.872 * 0.872 * 0.872 * 0.872 * 0.872 * 0.872 * 0.872 = 0.334
8! = 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1 = 40320

So now we have (to 5 terms):

cos(x) = 1 - 0.760/2 + 0.578/24 -0.440/720 + 0.334/40320
 = 0.643

Just doing cos(50) on my calculator also gives me 0.643. So the Maclaurin series approximation was accurate to at least 3 significant digits in this case.
Title: Re: My trig question :).
Post by: teyla on February 17, 2009, 04:09:50 AM
i worked it out and it looks like it works.
This surely can't apply to sine and tangent correct?
if so how?
im very curious! I can use this information and it would be very helpful to me!
Title: Re: My trig question :).
Post by: AlP on February 17, 2009, 04:15:02 AM
The Maclaurin series for sin(x) is:

sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ...

I don't know a series for tan(x). That doesn't mean there isn't one. I just don't know. Maybe someone can help me out here?
Title: Re: My trig question :).
Post by: AlP on February 17, 2009, 04:24:03 AM
Oh jeez I'm being a dumb ass. I forgot your original question which was whether you could express sin, cos and tan in terms of basic arithmetic.

I showed you how to do it with sin and cos.

Then I got lost in the Maclaurin series. This is useful:

tan(x) = sin(x) / cos(x)

That is, the tangent of an angle is equal to its sine divided by its cosine. Since we can express the sine and cosine as Maclaurin series, we can express the tangent as one Maclaurin series divided by another:

sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ...
cos(x) = 1 - x^2/2! + x^4/4! -x^6/6! + x^8/8! - ...

and tan(x) = sin(x) / cos(x)

so tan(x) = (x - x^3/3! + x^5/5! - x^7/7! + ...) / (1 - x^2/2! + x^4/4! -x^6/6! + x^8/8! - ...)

I hope that makes sense :)
Title: Re: My trig question :).
Post by: teyla on February 17, 2009, 04:35:24 AM
let me try to work each of these out so that I will; A. have it engraved in my mind and B.checked for errors.

1. SINE TEST

sin40
40/180*(pi)=0.6977
o.6977-0.6997^2/2!=0?
i think i have meet a flaw...:brick:
Title: Re: My trig question :).
Post by: teyla on February 17, 2009, 04:40:09 AM
Quote from: "teyla"let me try to work each of these out so that I will; A. have it engraved in my mind and B.checked for errors.

1. SINE TEST

sin40
40/180*(pi)=0.6977
o.6977-0.6997^2/2!=0?
i think i have meet a flaw...:upset:
Title: Re: My trig question :).
Post by: AlP on February 17, 2009, 05:06:17 AM
I think maybe I should have told you about the rules of precedence in math language. Sorry, I don't know what you know and what you don't.

If I say:

a+b

I mean a added to b. What about this:

a*b+c

Do I mean a multiplied by b then added to c? Or maybe I mean a multiplied by the addition of b and c? It's ambiguous unless we agree on some rules. For example lets pick some numbers for a, b and c:

a=2
b=3
c=4

If I multiply a and b first I get 2*3 which is 6. Then I add c and I get 6+4 which is 10.

That's one interpretation. Now lets say I do b+c first. 3+4 is 7 so b+c is 7. Then if I multiply it by 2 I get 14 which is different from the 10 that I got in the previous paragraph.

The problem is there is ambiguity as to what we mean by a*b+c. In math we have some ways of resolving the ambiguity. One way is to use parentheses like this. These are both true:

(a+b)*c = (2*3)+4 = 6 + 4 = 10
a+(b*c) = 2+(3*4) = 2 + 12 = 14

Do you see how the parentheses resolve the ambiguity? But it gets more confusing. Sometimes we don't use them but agree that certain operators are more important. If I say

a+b*c

Multiplication has a higher "precedence". So if I write that I always mean:

a+(b*c)

rather than:

(a+b)*c

So I'll be explicit and not use any implied operator precedence rules and write the Maclaurin series like this:

so tan(x) = (x - (x^3)/(3!) + (x^5)/(5!) - (x^7)/(7!) + ...) / (1 - (x^2)/(2!) + (x^4)/(4!) -(x^6)/(6!) + (x^8)/(8!) - ...)

Don't worry if that didn't make sense. I just tried to teach you like a week of math in one night. It'll make sense soon enough.
Title: Re: My trig question :).
Post by: SSY on February 18, 2009, 08:49:05 PM
I always use BODMAS

Brackets then
Division then
Multiplication then
Adding then
Subtraction

At least that was when I learnt it, you stop thinking about it after a while and it becomes second nature to do it that way and combine the operators for speed.