|
-
Mar 22nd, 2003, 06:09 AM
#1
Thread Starter
Addicted Member
Finding trig ratios
hey guys,
i've been wondering how calculators find the trig ratios, anyone know?
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
-
Mar 22nd, 2003, 07:45 AM
#2
Fanatic Member
you mean the 6 identities at different angles?

prog_tom
JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
http://physics.sviesoft.com/forum
-
Mar 23rd, 2003, 03:15 AM
#3
Fanatic Member
-
Mar 23rd, 2003, 08:45 PM
#4
Fanatic Member
that series converges VERY slowly for large x. i guess they make it close to 0 by taking angle mod 6.2832...
Massey RuleZ! ^-^__  Cheers!  __^-^ Massey RuleZ!
Did you know that...
The probability that a random rational number has an even denominator is 1/3 (Salamin and Gosper 1972)? This result is independently verified by me (2002)!
-
Mar 24th, 2003, 03:29 AM
#5
Fanatic Member
-
Mar 24th, 2003, 12:42 PM
#6
Lively Member
Well.
It is right that there are some serries to find the values of trig functions, but i don't think they are used in calculators.
It is more likely that calculators only check up the values of the trig functions in pre-defined tables.
But computer programs use those serries.
-
Mar 25th, 2003, 02:45 AM
#7
New Member
-
Mar 28th, 2003, 08:27 PM
#8
Frenzied Member
There are series which converge pretty fast if you do a little work first.
For angles in radians.
sin(x) = x - x3/3! + x5/5! - x7/7! . . .
cos(x) = 1 - x2/2! + x4/4! . . .
There are series used for exponentials and other transcendental functions.
With a little fooling around, you can get x to be less than one prior to using the series. For x less than one the above converge very fast.
A modern computer might use the above series as is, generating the coefficients as required, and testing for a term too small to be bothered with. I do not think this approach is used.
There are methods which determine adjusted coefficients, allowing for the use of an approximating polynomial. When this method is used, the coefficients are stored as constants. I think this is the modern method.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
-
Apr 2nd, 2003, 04:26 AM
#9
Thread Starter
Addicted Member
Thanks Guys!
Thanks a lot guys!
Guv
what do you mean by:
With a little fooling around, you can get x to be less than one prior to using the series. For x less than one the above converge very fast.
Sql_Lall
i didn't get what you were saying about taking mods man, would you mind explaining?
thanks guys
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
-
Apr 2nd, 2003, 04:46 AM
#10
-
Apr 2nd, 2003, 09:28 AM
#11
Fanatic Member
Sine and cosine are periodic functions, that's why it can be 'mod'ded. The period is 2 * pi.
[edit]
Not only they are periodic, but they are also symmetrical within a carefully chosen period. It is possible to get x always between 0 and half pi, the rest of the domain [0, 2 * pi> will be covered by mirroring the resulting graph.
[/edit]
Last edited by riis; Apr 2nd, 2003 at 09:32 AM.
-
Apr 2nd, 2003, 05:14 PM
#12
Frenzied Member
TheAlchemist:Trigometric identities can be used to reduce find a useful value less than one when evaluating a power series. Following in degrees just because most people are mare familiar with degrees. The power series require an angle in radians.
Sin(x) = - sin(x) Can be used to simplify logic, allowing use of absolute value of x.
Sin(x) = sin(x - 360) Already mentioned in getting x less than 360.
Sin(x) = - sin(x - 180) Can be used to get an angle less than 180
Sin(x) = sin(180 - x) Might be handy for angles less than 180 and greater than 90
Sin(x) = - cos(x - 90) Can be used to get an angle less than 90
Sin(x) = cos(90 - x) Handy to further reduce angles greater than 45 and less than 90. also handy for angles less than 180 and greater than 90.
In practical problems, angles are usually not more than 90 degrees. A Select Case True Statement could be used. The test for absolute value less than 45 might be first, and test for absolute value less than 90 second.
Reduction techniques are also used for other transcendental functions. Consider the exponential function.
ex = [ ex/2 ]2
e1.3567 = e * e0.3567
e5.6479 = e5 * e0.6479
For the exponential function, I am not sure what method is best. In machine language, dividing by powers of 2 can be done by shifting, making it reasonable to reduce the exponent by using a power of two as a divisor.
Perhaps the best method might be to start by using the product of einteger and efraction. Then express the integer as a binary number. For example, the following.
e13.9876 = e8 * e4 * e * e.9876
The last term might be computed as [ e.4938 ]2
The following might be used.
e4 = [ e2 ]2
e8 = [ e4 ]2
Precalculated powers of e might be stored in a table. For large values of x, divison by a power of two might be used first followed by the above.
BTW: I did a lot of coding for basic mathematical functions, matrix algebra, differential equations, et cetera in the 1950's and early 1960's. Due to limited memory and slow processors, a lot of analysis was done to decide on the best method. More code could cut processing time at the expense of memory. Since then nobody does any analysis. You can find all sorts of published algorithms with a description of the up & down sides of each. A modern CPU is so fast and memory is so cheap that it probably does not matter how you do it for most applications.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
-
Apr 2nd, 2003, 11:56 PM
#13
Thread Starter
Addicted Member
Thanks again guys!
i knew of Mod Arithmetic but i have never seen it in the light that you described it Sql_Lall, i'm enlightened!!
Guv, thanks a lot, i really don't know how else to say it.
anyway i've been having a lot of fun with Taylors and Maclaurins series lately!!! Newtons method is also a very interesting way of arriving at a solution iteratively.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|