Easter Sunday Trigs ( rpn38-CX)
|
04-10-2016, 07:16 PM
(This post was last modified: 04-10-2016 09:25 PM by Gerson W. Barbosa.)
Post: #29
|
|||
|
|||
RE: Easter Sunday Trigs ( rpn38-CX)
(04-08-2016 10:42 PM)bshoring Wrote: It is interesting that we can use the Net Present Value on a financial calculator to compute sine, up to a point, but as you say, the closer one gets to 90 degrees, the less accurate that method is. These issues are due mostly to cancellation errors. Notice the polynomial cannot be evaluate for zero when using the NPV method, unless this is properly handled. It appears NVP is not as accurate on the HP-12C Platinum as it is on the HP-12C for certain values, judging by a few results which are better on the latter when it should be otherwise. (04-08-2016 10:42 PM)bshoring Wrote: I'd say that the best program is the one you posted on 3 April, 2016. It appears to give the best overall accuracy for the 6 main trig functions. This exercise has been quite an enlightenment for me. That's the one I like best too. However doing calculations with three or four extra digits doesn't prevent cancellation errors from popping up in those critical regions. (04-08-2016 10:42 PM)bshoring Wrote: Thanks! My pleasure! You might also want to take a look at this this HP-17BII equation, in case you haven't seen it yet. The following program is meant for the REAL HP-38C, but it has been tested only on the HP-12C and the HP-12 Prestige. Regards, Gerson. . Trigonometric Functions - REAL HP-38C Code:
Constants: R0: 1.745329252e-02 R1: -8.86096144e-07 R2: 1.3495798e-11 R3: -9.7284-17 R4: 0.199989464 R5: 0.14247163 R6: -0.0606366 ------------------------------------------ Trigonometric Functions: 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 RCL 0 ÷ --> Rad->Deg RCL 0 × --> Deg->Rad ------------------------------------------ Examples: 0.0001 R/S --> 1.000000000 ; cos(0.0001) ; [result on the HP-12C Prestige: 1.000000000] {HP-15C built-in function result: 1.000000000} x≷y --> 1.745329252E-06 ; sin(0.0001) ; [1.745329252E-06] {1.745329252E-06} x≷y ÷ --> 1.745329252E-06 ; tan(0.0001) ; [1.745329252E-06] {1.745329252E-06} 0.9999 GTO 32 R/S --> 89.18970909 ; asin(0.9999) ; [89.18970856] {89.18970856} 0.9999 GTO 38 R/S --> 0.8102914371 ; acos(0.9999) ; [0.8102914375] {0.8102914371} 0.9999 GTO 44 R/S --> 44.99713507 ; atan(0.9999) ; [44.99713506] {44.99713507} 180 RCL 0 × --> 3.141592654 ; 180° = π rad 3.141592654 ENTER 8 / RCL 0 ÷ --> 22.50000001 ; π/8 rad = 22.5° Other examples: sin(0) = 0.000000000 [0.000000000] {0.000000000} cos(0) = 1.000000000 [1.000000000] {1.000000000} tan(0) = 0.000000000 [0.000000000] {0.000000000} sin(1) = 1.745240644E-02 [1.745240644E-02] {1.745240644E-02} cos(1) = 0.9998476952 [0.9998476952] {0.9998476952} tan(1) = 1.745506493E-02 [1.745506493E-02] {1.745506493E-02} sin(15) = 0.2588190451 [0.2588190451] {0.2588190451} cos(15) = 0.9659258263 [0.9659258263] {0.9659258263} tan(15) = 0.2679491924 [0.2679491925] {0.2679491924} sin(0.01) = 1.745329243E-04 [1.745329243E-04] {1.745329243E-04} cos(0.01) = 0.9999999847 [0.9999999848] {0.9999999848} tan(0.01) = 1.745329270E-04 [1.745329270E-04] {1.745329270E-04} sin(30) = 0.5000000002 [0.5000000000] {0.5000000000} cos(30) = 0.8660254037 [0.8660254038] {0.8660254038} tan(30) = 0.5773502695 [0.5773502693] {0.5773502692} sin(60) = 0.8660254034 [0.8660254038] {0.8660254038} cos(60) = 0.5000000001 [0.5000000000] {0.5000000000} tan(60) = 1.732050804 [1.732050808] {1.732050808} sin(75) = 0.9659258263 [0.9659258265] {0.9659258263} cos(75) = 0.2588190451 [0.2588190445] {0.2588190451} tan(75) = 3.732050808 [3.732050808] {3.732050808} sin(89) = 0.9998476951 [0.9998476952] {0.9998476952} cos(89) = 1.745240958E-2 [1.745240611E-2] {1.745240644E-2} tan(89) = 57.28995131 [57.28996271] {57.28996163} sin(89.99) = 0.9999999850 [0.9999999848] {0.9999999848} cos(89.99) = 1.732050808E-4 [1.745508522E-4] {1.745329243E-4} tan(89.99) = 5773.502604 [5728.989416] {5729.577893} sin(89.9999) = 1.000000000 [1.000000000] {1.000000000} cos(89.9999) = 0.000000000 [2.449489743E-6] {1.745329252E-6} tan(89.9999) = Error 0 [408248.2905] {572957.7951} asin(0) = 0.000000000 [0.000000000] {0.000000000} acos(0) = Error 0 [Error 0] {90.00000000} atan(0) = 0.000000000 [0.000000000] {0.000000000} asin(1) = Error 0 [Error 0] {90.00000000} acos(1) = 0.000000000 [0.000000000] {0.000000000} atan(1) = 45.99999997 [45.99999999] {45.00000000} asin(1e10) = 90.00000000 [90.00000000] {89.99999999} atan(0.4142135624) = 22.49999990 [22.49999994] {22.50000000} acos(0.8660254038) = 29.99999997 [30.00000001] {30.00000000} atan(50) = 88.85423719 [88.85423716] {88.85423716} ------------------------------------------ Forensic result: 9 R/S x≷y R/S R/S ÷ GTO 44 R/S GTO 38 R/S GTO 32 R/S --> 9.707005398 [9.008774143] {9.000417403} ------------------------------------------ P.S.: W|A plots for accuracy checking of the polynomials used in this program: Plot sin(x)-(x-0.1666666645x^3+0.008333198583x^5-0.0001971967922x^7),x=0..pi/6 Plot atan(x)-(x-0.3333333333x^3+0.199989464x^5-0.14247163x^7+0.106x^9-0.0606366x^11),x=0..sqrt(2)-1 P.P.S.: FV in lines 53 and 95 has been replaced with PV. The former is the only register left for the user. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 8 Guest(s)