HP17BII  trig equations suggestions Message #1 Posted by Gerson W. Barbosa on 30 Dec 2006, 5:49 p.m.
Two weeks ago I got an unused HP17BII from a zerofeedback local seller. No blister case, but it came with a shrinkwrapped manual in English, which of course I have already opened. All for less than $55, shipping included. Not a big deal, but here they typically sell for twice this price. If I only could find an HP42S like that...
I tried W. B. Maguire's Improved TRIG. and INVERSE TRIG. functions for the HP17BII . I tested both his sine and cosine functions. They work nicely, only the running time is about 1.9 seconds, not bad but too long when compared to the instant answers we get on the HP42S.
As I got curious to know how a polynomial approximation would perform on the HP17BII Solver I tried the equation below. The running time dropped to about 0.7 seconds. Actually, I should have replaced the Taylor's series in the original equation with mine and check how it would behave. Anyway, the polynomial approximation approach appears to be more tailored to this task than the Taylor's Series, regarding speed (no pun intended :) I haven't tested the inverse functions, but I guess the gain in speed would be more significant.
SIN=L(SX:X*(5.8177641733
1E3+L(X2:SQ(X))*(3.281
8376137E8+G(X2)*(5.5539
1606E14+G(X2)*(2.0935E
26*G(X2)4.47566E20))))
)*(34*SQ(G(SX)))
Some examples:
Sin(x):
x (deg) HP17BII HP42S

0.000000 0.00000000000E+00 0.00000000000E+00
0.000001 1.74532925199E08 1.74532925199E08
0.000110 1.91986217719E06 1.91986217719E06
0.022000 3.83972426002E04 3.83972426004E04
3.330000 5.80867495978E02 5.80867495977E02
14.44000 2.49366025115E01 2.49366025115E01
25.55000 4.31298587031E01 4.31298587031E01
30.00000 5.00000000000E01 5.00000000000E01
36.66000 5.97065256389E01 5.97065256389E01
47.77000 7.40452782677E01 7.40452782677E01
58.88000 8.56086728293E01 8.56086728292E01
69.99000 9.39632912698E01 9.39632912698E01
81.11000 9.87986852775E01 9.87986852778E01
88.88000 9.99808950038E01 9.99808950038E01
89.99900 9.99999999848E01 9.99999999848E01
89.99990 9.99999999998E01 9.99999999998E01
90.00000 1.00000000000E+00 1.00000000000E+00
The input range is [90..90]. The maximum absolute error in this equation is 5.8E14. The difference of up to three units in the last significant digit are due to rounding errors.
It's interesting to notice this simple sine equation allows for the computation of all six functions. The inverse sine function can be solved iteratively:
For instance, let's compute asin(0.77):
45 [X] ; first estimate
.77 [SIN]
[X] => X=50.3538888531
This almost matches the HP42S answer: 50.353888853
The remaining functions can be computed using trigonometric identities:
cos(x) = sin(90  x);
tan(x) = sin(x)/cos(x);
acos(x) = asin(sqrt(1x^2), acos(x) = 90  asin(x);
atan(x) = asin(x/sqrt(1+x^2))
The atan(x) equation below is accurate in the range [(2sqrt(3))..(2sqrt(3))] (max absolute error = 6.4E14):
ATAN=X*(1+L(X2:SQ(X))*(
0.33333333333+G(X2)*(0.1
9999999631+G(X2)*(0.142
8565387+G(X2)*(0.1110748
114+G(X2)*(0.0641264*G(X
2)0.08991517))))))*57.2
957795131
As we have seen, the lack of trigonometric functions on the HP17BII was solved brilliantly years ago. Anyway, I hope these equations might be useful to anyone who wants to get back to the subject.
Gerson.
