A very long HP-17BII equation - Update
|
12-15-2014, 05:48 PM
(This post was last modified: 12-17-2014 01:54 AM by Gerson W. Barbosa.)
Post: #1
|
|||
|
|||
A very long HP-17BII equation - Update
After replacing the batteries of my HP-17BII I entered the equation in message #22 of the original thread (not a single error in the first try, just to show this is possible :-). Then I checked the functions for arguments close to 1 and near zero and noticed a significant loss of accuracy for certain arguments. For example:
sin(0.0000010) 1.7455(0850398)E-8 tan(0.0000010) 1.745(50000000)E-8 asin(0.000001) 5.7295(8368089)E-5 acos(0.999999) 8.1028474(8648)E-2 atan(0.000001) 5.7295(8368089)E-5 This update fixes that: sin(0.0000010) 1.74532925199E-8 tan(0.0000010) 1.74532925199E-8 asin(0.000001) 5.72957795131E-5 acos(0.999999) 8.1028475206(4)E-2 atan(0.000001) 5.72957795131E-5 Also, COS is now slightly more accurate for small arguments and the forensic result is better: Keystrokes Display corresponding HP-42S results 9 DSP ALL X X=9 SIN SIN=1.56434465039E-1 0.15643446504 STO X COS COS=9.99996272738E-1 9.99996272743E-1 STO X TAN TAN=1.74549998553E-2 1.74549998555E-2 STO X MORE ATAN ATAN=9.99996272738E-1 9.99996272744E-1 MORE STO X MORE ACOS ACOS=1.56434567554E-1 1.56434441642E-1 MORE STO X MORE ASIN ASIN=9.00000594679 8.99999864267 Fortunately the HP-17BII solver has the LNP1(x)and EXPM(x) functions, which have allowed for this easy fix: Code:
This takes almost one minute to verify, but once it has been verified all trigonometric and other mathematical functions can be executed without leaving the solver (if the MATH menu is invoked, EXIT will return to the solver and the already verified equation). The equation can be more easily entered into the HP-17BII by entering the following small equation first and then replacing each underlined X with its respective equation: IF(S(SIN):X-SIN:IF(S(COS):COS-X:IF(S(TAN):TAN-X:IF(S(DEG):X*180/PI-DEG:IF(S (RAD):X*PI/180-RAD:IF(S(ASIN):ASIN-(X):IF(S(ACOS):ACOS-(X):ATAN-(X)))))))) sine: Code:
cosine: Code:
tangent: Code:
arcsine: Code:
arccosine: Code:
arctangent: Code:
Running times: SIN: 2.0 s COS: 1.8 s TAN: 2.8 s DEG: 2.3 s RAD: 2.8 s ASIN: 5.3 s ACOS: 8.2 s ATAN: 11.0 s Ranges: SIN, COS, TAN: -999 999 999 999 to 999 999 999 999 (1) ASIN & ACOS: -1 to 1 ATAN: 1E-11 < |X| <= 9.99999999999E-499 (2) (1) For odd multiples of 90 degrees, TAN returns 249999999996, which should be regarded as infinity (2) Exponents equal or greater than 18 will cause UNDERFLOW, but the results will be correct (either -90 or +90 degrees) Some usage examples: 3 X X=3 DEG DEG=171.887338539 ; 3 rad = 171.887338539° STO X TAN TAN=-1.42546543094E-1 ; tan(3 rad) = -1.42546543094E-1 123456789 X COS COS=-9.87688340595E-1 ; cos(123456789) = -9.87688340595E-1 777777777717 +/- X SIN SIN=5.2335956243E-2 ; sin(-777777777717°) = 5.2335956243E-2 0.5 X MORE ACOS 60.0000000002 ; acos(0.5) = 60.0000000002° MORE STO X MORE RAD 1.0471975512 ; acos(0.5) = 1.0471975512 rad shift MATH 3 LN 1.09861228867 2 +/- / EXP EXIT 5.77350269189E-1 MORE STO X MORE ATAN ATAN=30.0000000001 ; atan(exp(-ln(3)/2)) = 30.0000000001° The above equation has been tested on the HP-200LX. On the HP-17BII, replace SIGMA with the Greek letter, as in the picture: You might also want to download a state file for Christoph Gießelink's Emu42 emulator (please change the extension to .e17). P.S.: I forgot to mention that this equation is no so long as the equation in the original thread. Now it's "only" 1133-character long, 50 characters shorter than the older equation. Unlike then, I haven't experienced any "INSUFFICIENT MEMORY" message. The following old threads give a clue about the formulas I used: Mardi Gras Basic Trigs (HP-12C) Easter Sunday Basic Trigs (HP-12C) Formatting has been lost in the tables. I have yet to find out how to fix that. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
A very long HP-17BII equation - Update - Gerson W. Barbosa - 12-15-2014 05:48 PM
RE: A very long HP-17BII equation - Update - Dave Britten - 12-16-2014, 03:41 PM
RE: A very long HP-17BII equation - Update - Thomas Klemm - 06-08-2022, 02:12 PM
RE: A very long HP-17BII equation - Update - Gerson W. Barbosa - 06-08-2022, 11:02 PM
|
User(s) browsing this thread: 3 Guest(s)