|HP-17BII - 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 HP-17BII from a zero-feedback local seller. No blister case, but it came with a shrink-wrapped 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 HP-42S like that...
I tried W. B. Maguire's Improved TRIG. and INVERSE TRIG. functions for the HP-17BII . 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 HP-42S.
As I got curious to know how a polynomial approximation would perform on the HP-17BII 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.
x (deg) HP-17BII HP-42S
0.000000 0.00000000000E+00 0.00000000000E+00
0.000001 1.74532925199E-08 1.74532925199E-08
0.000110 1.91986217719E-06 1.91986217719E-06
0.022000 3.83972426002E-04 3.83972426004E-04
3.330000 5.80867495978E-02 5.80867495977E-02
14.44000 2.49366025115E-01 2.49366025115E-01
25.55000 4.31298587031E-01 4.31298587031E-01
30.00000 5.00000000000E-01 5.00000000000E-01
36.66000 5.97065256389E-01 5.97065256389E-01
47.77000 7.40452782677E-01 7.40452782677E-01
58.88000 8.56086728293E-01 8.56086728292E-01
69.99000 9.39632912698E-01 9.39632912698E-01
81.11000 9.87986852775E-01 9.87986852778E-01
88.88000 9.99808950038E-01 9.99808950038E-01
89.99900 9.99999999848E-01 9.99999999848E-01
89.99990 9.99999999998E-01 9.99999999998E-01
90.00000 1.00000000000E+00 1.00000000000E+00
The input range is [-90..90]. The maximum absolute error in this equation is 5.8E-14. 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
[X] => X=50.3538888531
This almost matches the HP-42S 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(1-x^2), acos(x) = 90 - asin(x);
atan(x) = asin(x/sqrt(1+x^2))
The atan(x) equation below is accurate in the range [-(2-sqrt(3))..(2-sqrt(3))] (max absolute error = 6.4E-14):
As we have seen, the lack of trigonometric functions on the HP-17BII was solved brilliantly years ago. Anyway, I hope these equations might be useful to anyone who wants to get back to the subject.