Post Reply 
Easter Sunday Trigs ( rpn38-CX)
04-06-2016, 02:44 AM (This post was last modified: 04-06-2016 02:48 AM by Gerson W. Barbosa.)
Post: #27
RE: Easter Sunday Trigs ( rpn38-CX)
(04-05-2016 04:42 AM)bshoring Wrote:  Thanks for the insight. This satisfies my curiosity that one can compute Sine, Cosine and Tangent using the Net Present Value function.

Here's my short little program based on your knowledge and hard work!

Trig using NPV

Angles in Degrees

R/S --> cos(x)
R/S x<>y --> sin(x)
R/S / --> tan(x)

Constants:

n: 9
R0: 0
R1: 1
R2: 0
R3: -0.166666666666667
R4: 0
R5: 8.333333204E-3
R6: 0
R7: -1.98410348E-4
R8: 0
R9: 2.742018422E-6
R.9: 1.74532925199433e-2

01 - 86 61 9 RCL × .9
02 - 1 1
03 - 24 23 ∆%
04 - 12 i
05 - 24 13 NPV
06 - 31 ENTER
07 - 31 ENTER
08 - 61 ×
09 - 32 CHS
10 - 1 1
11 - 51 +
12 - 24 21 √x
13 - 25 7 00 GTO 00

On RPN-38 CX, it only takes 12 program steps. On my original HP-38C, with slight modification, it also works quite nicely, with similar results. So far the NPV route isn't producing quite the level of accuracy that your fine programs do, but I do find it exciting to think that a built in financial function can be used this way!

If run on an actual HP-12C or HP-38 E/C, the first line could be replaced with 2 lines:
RCL FV
X
(And the constant 1.745329252E-6 needs to loaded into the FV register).

On the HP-12C/38C four coefficients will suffice. Notice range reduction is needed here since the polynomial approximation is accurate enough only from -30 to 30 degrees (the argument is divide by three then a trigonometric relation is used to compute the sine of the original angle). But the program becomes somewhat long: 30 steps and 5 constants.

The computed values of cosine and tangent become poorer and poorer as the angle approaches 90 degrees. In this case, use the complementary angle. For instance, tan 89.9999° = cot(90° - 89.9999°). On the HP-12C:

90 ENTER 89.9999 - R/S x<>y / --> 572.957.7951 ; tan(89.9999°)

75 R/S -> 0.25881904(43) ; cos(75°)
X<>y --> 0.965925826(5) ; sin(75°)
x<> / --> 3.7320508(20) ; tan(75°)

Regards,

Gerson.

Code:

01 - 22 4         RCL 4
02 - 61           ×
03 - 21 5         STO 5
04 - 31           ENTER
05 - 61           ×
06 - 1            1
07 - 24 23        ∆%
08 - 12           i
09 - 3            3
10 - 11           n
11 - 24 13        NPV
12 - 22 5         RCL 5
13 - 61           ×
14 - 31           ENTER
15 - 31           ENTER
16 - 61           ×
17 - 4            4
18 - 61           ×
19 - 32           CHS
20 - 3            3
21 - 51           +
22 - 61           ×
23 - 31           ENTER
24 - 31           ENTER
25 - 61           ×
26 - 32           CHS
27 - 1            1
28 - 51           +
29 - 24 21        √x
30 - 25 7 00      GTO 00

R0: 1
R1: -1.666666667   ;  -1/6
R2: 8.33322556e-03
R3: -0.000197278
R4: 5.817764173e-3 ; pi/540
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Easter Sunday Trigs ( rpn38-CX) - Gerson W. Barbosa - 04-06-2016 02:44 AM



User(s) browsing this thread: 7 Guest(s)