(12C) Trigonometric Functions - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (12C) Trigonometric Functions (/thread-6483.html) |
(12C) Trigonometric Functions - Gerson W. Barbosa - 06-30-2016 08:09 PM Program 01- 3 3 34- 16 CHS 67- 36 ENTER 02- 44 11 STO n 35- 1 1 68- 36 ENTER 03- 10 ÷ 36- 40 + 69- 45 6 RCL 6 04- 44 14 STO PMT 37- 43 33 40 g GTO 40 70- 20 × 05- 43 35 g x=0 38- 36 ENTER 71- 9 9 06- 43 33 13 g GTO 13 39- 20 × 72- 48 . 07- 36 ENTER 40- 22 1/x 73- 4 4 08- 20 × 41- 1 1 74- 22 1/x 09- 1 1 42- 30 − 75- 40 + 10- 24 ∆% 43- 43 21 g √x 76- 20 × 11- 44 12 STO i 44- 43 35 g x=0 77- 45 5 RCL 5 12- 42 13 f NPV 45- 43 33 00 g GTO 00 78- 30 − 13- 45 14 RCL PMT 46- 1 1 79- 20 × 14- 20 × 47- 34 x≷y 80- 45 4 RCL 4 15- 36 ENTER 48- 43 34 g x≤y 81- 40 + 16- 36 ENTER 49- 43 33 52 g GTO 52 82- 20 × 17- 20 × 50- 22 1/x 83- 3 3 18- 4 4 51- 9 9 84- 22 1/x 19- 20 × 52- 0 0 85- 30 − 20- 16 CHS 53- 44 13 STO PV 86- 20 × 21- 3 3 54- 33 R↓ 87- 1 1 22- 40 + 55- 22 1/x 88- 40 + 23- 20 × 56- 44 14 STO PMT 89- 45 14 RCL PMT 24- 36 ENTER 57- 36 ENTER 90- 20 × 25- 36 ENTER 58- 20 × 91- 2 2 26- 20 × 59- 40 + 92- 20 × 27- 16 CHS 60- 43 21 g √x 93- 45 0 RCL 0 28- 1 1 61- 45 14 RCL PMT 94- 10 ÷ 29- 40 + 62- 30 − 95- 45 13 RCL PV 30- 43 21 g √x 63- 44 14 STO PMT 96- 43 35 g x=0 31- 43 33 00 g GTO 00 64- 36 ENTER 97- 34 x≷y 32- 36 ENTER 65- 20 × 98- 34 x≷y 33- 20 × 66- 36 ENTER 99- 30 − Constants R0: 1.745329252e-02 R1: -8.86096144e-07 R2: 1.3495798e-11 R3: -9.7284-17 R4: 0.199991241 R5: 0.14251795 R6: -0.0616468 These should be stored manually: 1.745329252 EEX CHS 2 STO 0 8.86096144 CHS EEX CHS 7 STO 1 1.3495798 EEX CHS 11 STO 2 9.7284 CHS EEX CHS 17 STO 3 .199991241 STO 4 .14251795 STO 5 .0616468 CHS STO 6 Take care not pressing Σ+ as this will change the contents of registers R1 through R6. Usage Angles in DEGREES -90 =< x =< 90 R/S --> cos(x) R/S x≷y --> sin(x) R/S ÷ --> tan(x) GTO 32 R/S --> asin(x) 0 =< x < 1 GTO 38 R/S --> acos(x) 0 < x <= 1 GTO 44 R/S --> atan(x) 1e-50 < x < 1e50, x=0 (On the HP-12C Platinum, GTO 032, GTO 038 and GTO 044, respectively) RCL 0 ÷ --> Rad->Deg RCL 0 × --> Deg->Rad Examples: 30 R/S --> 0.866025404 ; cos(30 deg) x≷y --> 0.500000000 ; sin(30 deg) x≷y ÷ --> 0.577350270 ; tan(30 deg) 0.5 GTO 32 R/S --> 29.99999998 ; asin(0.5) = 30 deg 0.5 GTO 38 R/S --> 60.00000002 ; acos(0.5) = 60 deg 1 GTO 44 R/S --> 44.99999997 ; atan(1) = 45 deg RCL 0 180 × --> 3.141592654 ; π 3 ÷ --> 1.047197551 ; π÷3 RCL 0 ÷ --> 59.99999999 ; π÷3 rad = 60 deg R/S --> 0.500000001 ; cos(π÷3 rad) = 1÷2 x≷y --> 0.866025403 ; sin(π÷3 rad) = 1÷2×√3 x≷y ÷ --> 1.732050804 ; tan(π÷3 rad) = √3 5 1/x GTO 44 R/S --> 11.30993251 ; atan(1÷5) = 11.30993251 deg RCL 0 × --> 0.197395561 ; atan(1÷5) = 0.197395561 rad 16 × STO FV --> 3.158328968 239 1/x GTO 44 R/S --> 0.239725192 ; atan(1÷239) = 0.239725192 deg RCL 0 × --> 0.004183994 ; atan(1÷239) = 0.004183994 rad 4 × CHS RCL FV + --> 3.141592992 (3.141592652 on the HP-12C Platinum) ; π = 16×atan(1÷5) - 4×atan(1÷239) Accuracy comparison with the HP-15C and the HP-35: Sin(x): x (deg) HP-12C HP-12C Platinum HP-15C (1982) HP-35 (1972) ------------------------------------------------------------------------ 0.000000 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000010 1.745329252E-07 1.745329252E-07 1.745329252E-07 1.745000000E-07 0.000110 1.919862177E-06 1.919862177E-06 1.919862177E-06 1.919800000E-06 0.022000 3.839724258E-04 3.839724261E-04 3.839724260E-04 3.839723931E-04 3.330000 5.808674960E-02 5.808674961E-02 5.808674960E-02 5.808674961E-02 14.44000 2.493660251E-01 2.493660252E-01 2.493660251E-01 2.493660250E-01 25.55000 4.312985869E-01 4.312985871E-01 4.312985870E-01 4.312985871E-01 36.66000 5.970652564E-01 5.970652564E-01 5.970652564E-01 5.970652561E-01 47.77000 7.404527823E-01 7.404527827E-01 7.404527827E-01 7.404527828E-01 58.88000 8.560867284E-01 8.560867283E-01 8.560867283E-01 8.560867285E-01 69.99000 9.396329131E-01 9.396329128E-01 9.396329127E-01 9.396329127E-01 81.11000 9.879868530E-01 9.879868529E-01 9.879868528E-01 9.879868527E-01 88.88000 9.998089502E-01 9.998089500E-01 9.998089500E-01 9.998089499E-01 89.99000 9.999999850E-01 9.999999848E-01 9.999999848E-01 9.999999848E-01 89.99900 1.000000000E+00 9.999999998E-01 9.999999998E-01 9.999999998E-01 90.00000 1.000000000E+00 1.000000000E+00 1.000000000E+00 1.000000000E+00 Tan(x): x (deg) HP-12C HP-12C Platinum HP-15C (1982) HP-35 (1972) ------------------------------------------------------------------------ 0.000000 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000010 1.745329252E-07 1.745329252E-07 1.745329252E-07 1.745000000E-07 0.000110 1.919862177E-06 1.919862177E-06 1.919862177E-06 1.919800000E-06 0.022000 3.839724258E-04 3.839724544E-04 3.839724543E-04 3.839724542E-04 3.330000 5.818499267E-02 5.818499268E-02 5.818499267E-02 5.818499266E-02 14.44000 2.575006491E-01 2.575006492E-01 2.575006491E-01 2.575006490E-01 25.55000 4.780471796E-01 4.780471799E-01 4.780471798E-01 4.780471798E-01 36.66000 7.442915883E-01 7.442915884E-01 7.442915883E-01 7.442915880E-01 47.77000 1.101686576E+00 1.101686577E+00 1.101686578E+00 1.101686578E+00 58.88000 1.656411391E+00 1.656411391E+00 1.656411391E+00 1.656411391E+00 69.99000 2.745986127E+00 2.745986120E+00 2.745986117E+00 2.745986119E+00 81.11000 6.393166511E+00 6.393166491E+00 6.393166451E+00 6.393166426E+00 88.88000 5.115045162E+01 5.115043114E+01 5.115042993E+01 5.115042860E+01 89.99000 5.773502604E+04 5.728989416E+04 5.729577951E+05 5.729655162E+04 89.99900 Error 0 5.735393346E+05 5.729577951E+05 5.730193057E+05 90.00000 Error 0 Error 0 9.999999999E+99 9.999999999E+99 ArcTan(x): x HP-12C HP-12C Platinum HP-15C (1982) HP-35 (1972) ----------------------------------------------------------------------- 0.00000 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.00011 6.302535741E-03 6.302535739E-03 6.302535721E-03 6.302535688E-03 0.15500 8.810733019E+00 8.810732983E+00 8.810732986E+00 8.810732984E+00 0.26795 1.500004317E+01 1.500004315E+01 1.500004317E+01 1.500004317E+01 0.41421 2.249982576E+01 2.249982574E+01 2.249982578E+01 2.249982579E+01 0.57735 2.999998843E+01 2.999998845E+01 2.999998843E+01 2.999998843E+01 0.77700 3.784720679E+01 3.784720675E+01 3.784720677E+01 3.784720676E+01 0.88800 4.160507644E+01 4.160507646E+01 4.160507646E+01 4.160507646E+01 1.00000 4.499999997E+01 4.499999999E+01 4.500000000E+01 4.500000000E+01 1.22200 5.070548705E+01 5.070548704E+01 5.070548702E+01 5.070548702E+01 1.48880 5.611145719E+01 5.611145720E+01 5.611145723E+01 5.611145722E+01 2.11100 6.465265739E+01 6.465265738E+01 6.465265735E+01 6.465265735E+01 4.88800 7.843782363E+01 7.843782359E+01 7.843782359E+01 7.843782360E+01 7.55500 8.246000676E+01 8.246000683E+01 8.246000683E+01 8.246000679E+01 99.9990 8.942705958E+01 8.942705557E+01 8.942705557E+01 8.942705555E+01 7777.77 8.999266614E+01 8.999263291E+01 8.999263339E+01 8.999263337E+01 1.0E+05 9.000000000E+01 8.999942704E+01 8.999942704E+01 8.999942704E+01 Edited to change subject line. RE: (HP-12C, 12C Platinum, 38C) Trigonometric Functions - rprosperi - 07-01-2016 02:15 AM Great post Gerson, thank you for the time and effort to post the full program, detailed instructions and comparison of results. I believe the program has been posted before, but having this all in one place with all the background material included makes it a clear and handy resource. RE: (HP-12C, 12C Platinum, 38C) Trigonometric Functions - Gerson W. Barbosa - 07-01-2016 06:14 PM (07-01-2016 02:15 AM)rprosperi Wrote: I believe the program has been posted before, but having this all in one place with all the background material included makes it a clear and handy resource. I am glad you have appreciated it. Actually much background material is missing. Rather than plain Taylor series, this program is based on polynomial approximations on limited ranges, which are then expanded to the full working ranges by means of trigonometric identities. This is better explained in an old version of this program: Fast and Accurate Trigonometric Functions on the HP-12C The "fast" part is ok, but the "accurate" term has been somewhat innaccurately used there (even this later version, despite the higher-degree polynomials, doesn't offer always full accuracy). An earlier version of the current program has been posted here. The whole thread is interesting taking a look at as more background information is available there, including some ideas and suggestions from Bob Shoring and Willy Kunz, the author of the RPN-38 CX Simulator, which made into this program and the one written specifically for the simulator. Best regards, Gerson. Edited to fix a typo. RE: (HP-12C, 12C Platinum, 38C) Trigonometric Functions - bshoring - 07-18-2016 10:25 PM It's a wonderful program. The forensic test arcsin (arccos (arctan (tan (cos (sin (9) ) ) ) ) ) on the RPN-38 CX Simulator of the HP-38C gives me 9.000000330, which is pretty good for a financial calculator! I get that by entering 9, then R/S X<>Y (to get SIN) R/S (to get COS) R/S / (to get TAN) GTO 44 R/S (to get ATAN) GTO 38 R/S (to get ACOS) GTO 32 R/S (to get ASIN) Thanks for writing it! |