Trig
Moderator:Moderators
-
- Sir Posts-alot
- Posts:4186
- Joined:Fri Jun 04, 2004 4:10 pm
Is it possible to.., wait of course its possible. How do you calulate Sin, ArcSin, Cos, ArcCos and Tan, ArcTan without tables or a calculator?
- marshallh
- Moderator
- Posts:2986
- Joined:Sat Sep 10, 2005 2:17 pm
- 360 GamerTag:marshallh
- Location:here and there
- Contact:
By using a certain algorithm. That's what they use to make the tables od olde.
This website explains how calculators get these answers
http://www.hpmuseum.org/journals/9100iprg.htm
This website explains how calculators get these answers
http://www.hpmuseum.org/journals/9100iprg.htm
Circular Routines
The circular routines (sin, cos, tan), the inverse circular routines (arcsin, arccos, arctan) and the polar to rectangular and rectangular to polar conversions are all accomplished by iterating through a transformation which rotates the axes. Any angle may be represented as an angle between 0 and 1 radian plus additional information such as the number of times pi/2 has been added or subtracted, and its sign. The basic algorithm for the forward circular function operates on an angle whose absolute value is less than 1 radian, but prescaling is necessary to indicate quadrant.
To obtain the scaling constants, the argument is divided by 2, the integer part discarded and the remaining fraction of the circle multiplied by 2. Then pi/2 is subtracted from the absolute value until the angle is less than 1 radian. The number of times pi/2 is subtracted, the original sign of the argument, and the sign upon completion of the last subtraction make up the scaling constants. To preserve the quadrant information the scaling constants are stored in the core memory.
The algorithm produces tan. Therefore, in the Model 9100A, cos is generated as 1/sqrt(1 + tan2) and sin as tan/sqrt(1 + tan2)
Sin could be obtained from the relationship sin = sqrt(1-cos2) for example, but the use of the tangent relationship preserves the 12 digit accuracy for very small angles, even in the range of < 10-12. The proper signs of the functions are assigned from the scaling constants.
For the polar to rectangular functions, cos and sin are computed and multiplied by the radius vector to obtain the X and Y coordinates. In performing the rectangular to polar function, the signs of both the X and Y vectors are retained to place the resulting angle in the right quadrant.
Prescaling must also precede the inverse circular functions, since this routine operates on arguments less than or equal to 1. The inverse circular algorithm yields arctangent functions, making it necessary to use the trigonometric identity. sin-1(x) = tan-1(x/sqrt(1 - x2)).
If a cos-1(x) is desired, the arcsin relationship is used and a scaling constant adds pi/2 after completion of the function. For arguments greater than 1, the arccotangent of the negative reciprocal is found which yields the arctangent when pi/2 is added.
you can approximate sine with the maclauren series
its a sum from n=0 to infinity, so it might take a while to calculate. i just wrote a test on this stuff. not. fun.
cosine has a similar series, and you can get tan by dividing them. oh, and just to screw with you, X is in radians.
-----
basically there is no real way to do it thas both easy and 100% accurate
its a sum from n=0 to infinity, so it might take a while to calculate. i just wrote a test on this stuff. not. fun.
cosine has a similar series, and you can get tan by dividing them. oh, and just to screw with you, X is in radians.
-----
basically there is no real way to do it thas both easy and 100% accurate
"Linux is only free if your time is worthless"
- Mr. Hawkins
- Posts:61
- Joined:Sat Nov 12, 2005 7:32 pm
- Location:Way down South