 The Museum of HP Calculators

HP Articles Forum

TRIG and inverse TRIG functions on the HP-17bII

Posted by W. Bruce Maguire II on 31 July 2001, 7:13 p.m.

The following equations were written to approximate the trig. and inverse trig. functions on an HP-17bII. The error in the trig functions is on the order of 10^(-8), and the error of the ARCTAN function (and the ARCCOS and ARCSIN) reaches a maximum at X=0.494 and X=0.869; the error at those locations is just less than 2*10^(-8). ALL FUNCTIONS ARE ONLY FOR ANGLE BETWEEN 0 AND PI/2 (i.e. 0 and 90 degrees)!

I used the "angle" symbol to represent the angle in the SIN and COS functions. In the listings below I substituted "{angle}" for this non-ascii character. This symbol can be found in the miscellaneous character menu when typing.

To calculate SIN, COS, or TAN, choose the SIN,COS,... equation from the list. Verification will take about 15 (!) seconds. Enter the angle in RADIANS, and solve for ARCSIN or ARCCOS. To solve for TAN, simply solve for SIN, then solve for COS, then hit "/".

To calculate ARCSIN, choose the ARCSIN... equation from the list. Verification will take a while (30- 40seconds or so). Enter X, and solve for the ARCSIN in RADIANS.

To calculate ARCCOS, solve for ARCSIN of the value FIRST, THEN select the ARCCOS equation, and solve for ARCCOS (it's just PI/2 - ARCSIN).

To calculate ARCTAN, choose the ARCTAN... equation from the list. Verification will take about 45 (!!) seconds. Enter X, and solve for ARCTAN in RADIANS.

The following are copied from a printer listing of my equations. HOPEFULLY, I didn't introduce any typos.

I STRONGLY ENCOURAGE YOU TO VERIFY THESE EQUATIONS AFTER TYPING THEM IN! To verify SIN and COS, verify that you get 1/sqrt(2) for the SIN and COS of PI/4. To verify ARCSIN, you must check all three regions of calculation: X in [0, 0.494), X in (0.494, 0.869), and X in (0.869, infinity). Verify ARCTAN the same way you did ARCSIN.

If you would like this information in a text file (for easier reading), please contact me at: Maguire@AnalyticInvestments.com. Thanks!

ALL FUNCTIONS ARE ONLY FOR ANGLE BETWEEN 0 AND PI/2 (i.e. 0 and 90 degrees)!

Have fun typing! And wish---like I did every second ---that you had cut-and-paste!
----------------------------------------------------

SIN,COS,[0,PI/2]: IF(S(SIN):
{angle}-
{angle}^3/6+
{angle}^5/120-
{angle}^7/5040+
{angle}^9/362880-
{angle}^11/39916800+
{angle}^13/6227020800-
{angle}^15/1307674368000+
{angle}^17/355687428096000-SIN:
PI/2-{angle}-
PI/2-{angle}^3/6+
PI/2-{angle}^5/120-
PI/2-{angle}^7/5040+
PI/2-{angle}^9/362880-
PI/2-{angle}^11/39916800+
PI/2-{angle}^13/6227020800-
PI/2-{angle}^15/1307674368000+
PI/2-{angle}^17/355687428096000-COS)

ARCSIN,[0,PI/2]: IF(X<0.494:
X+
1.66666666667E-1*X^3+
7.5E-2*X^5+
4.46428571429E-2*X^7+
3.03819444444E-2*X^9+
2.23721590909E-2*X^11+
1.73527644231E-2*X^13+
1.396484375E-2*X^15+
1.15518008961E-2*X^17-ASIN:
IF(X<0.869:
PI/4+0.5*(2*X*X-1)+
1.66666666667E-1*(2*X*X-1)^3+
7.5E-2*(2*X*X-1)^5+
4.46428571429E-2*(2*X*X-1)^7+
3.03819444444E-2*(2*X*X-1)^9+
2.23721590909E-2*(2*X*X-1)^11+
1.73527644231E-2*(2*X*X-1)^13+
1.396484375E-2*(2*X*X-1)^15+
1.15518008961E-2*(2*X*X-1)^17)-ASIN:
PI/2-((1-X*X)^0.5+
1.66666666667E-1*(1-X*X)^1.5+
7.5E-2*(1-X*X)^2.5+
4.46428571429E-2*(1-X*X)^3.5+
3.03819444444E-2*(1-X*X)^4.5+
2.23721590909E-2*(1-X*X)^5.5+
1.73527644231E-2*(1-X*X)^6.5+
1.396484375E-2*(1-X*X)^7.5+
1.15518008961E-2*(1-X*X)^8.5-ASIN))

ARCCOS: ACOS=PI/2-ASIN

ARCTAN,[0,INF]: IF(ABS(X*X-1)/(X*X+1)<0.494:
PI/4+SGN(X-1)*0.5*(ABS(X*X-1)/(X*X+1)+
1.66666666667E-1*(ABS(X*X-1)/(X*X+1))^3+
7.5E-2*(ABS(X*X-1)/(X*X+1))^5+
4.46428571429E-2*(ABS(X*X-1)/(X*X+1))^7+
3.03819444444E-2*(ABS(X*X-1)/(X*X+1))^9+
2.23721590909E-2*(ABS(X*X-1)/(X*X+1))^11+
1.73527644231E-2*(ABS(X*X-1)/(X*X+1))^13+
1.396484375E-2*(ABS(X*X-1)/(X*X+1))^15+
1.15518008961E-2*(ABS(X*X-1)/(X*X+1))^17)-ATAN:
IF(ABS(X*X-1)/(X*X+1)<0.869:
PI/4+SGN(X-1)*0.5*(PI/4+0.5*(1-8*X*X/SQ(X*X+1)+
1.66666666667E-1*(1-8*X*X/SQ(X*X+1))^3+
7.5E-2*(1-8*X*X/SQ(X*X+1))^5+
4.46428571429E-2*(1-8*X*X/SQ(X*X+1))^7+
3.03819444444E-2*(1-8*X*X/SQ(X*X+1))^9+
2.23721590909E-2*(1-8*X*X/SQ(X*X+1))^11+
1.73527644231E-2*(1-8*X*X/SQ(X*X+1))^13+
1.396484375E-2*(1-8*X*X/SQ(X*X+1))^15+
1.15518008961E-2*(1-8*X*X/SQ(X*X+1))^17))-ATAN:
PI/4+SGN(X-1)*0.5*(PI/2-((4*X*X/SQ(X*X+1))^0.5+
1.66666666667E-1*(4*X*X/SQ(X*X+1))^1.5+
7.5E-2*(4*X*X/SQ(X*X+1))^2.5+
4.46428571429E-2*(4*X*X/SQ(X*X+1))^3.5+
3.03819444444E-2*(4*X*X/SQ(X*X+1))^4.5+
2.23721590909E-2*(4*X*X/SQ(X*X+1))^5.5+
1.73527644231E-2*(4*X*X/SQ(X*X+1))^6.5+
1.396484375E-2*(4*X*X/SQ(X*X+1))^7.5+
1.15518008961E-2*(4*X*X/SQ(X*X+1))^8.5-ATAN))