Post Reply 
Easter Sunday Trigs ( rpn38-CX)
03-27-2016, 10:51 PM (This post was last modified: 04-03-2016 09:04 PM by Gerson W. Barbosa.)
Post: #1
Easter Sunday Trigs ( rpn38-CX)
.
Note: A more accurate updated version is available (Post #23).

Trigonometric Functions (RPN-38 CX)


Code:

01 - 21 73 9      STO .9
02 - 31           ENTER
03 - 61           ×
04 - 31           ENTER
05 - 31           ENTER
06 - 31           ENTER
07 - 86 61 8      RCL × .8
08 - 86 51 7      RCL + .7
09 - 61           ×
10 - 86 41 6      RCL − .6
11 - 61           ×
12 - 86 51 0      RCL + .0
13 - 86 61 9      RCL × .9
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
31 - 25 6         x=0
32 - 25 7 00      GTO 00
33 - 31           ENTER
34 - 61           ×
35 - 24 71        1/x
36 - 1            1
37 - 41           −
38 - 25 6         x=0
39 - 25 7 98      GTO 98
40 - 24 71        1/x
41 - 25 7 47      GTO 47
42 - 31           ENTER
43 - 61           ×
44 - 24 71        1/x
45 - 1            1
46 - 41           −
47 - 24 21        √x
48 - 25 6         x=0
49 - 25 7 00      GTO 00
50 - 1            1
51 - 33           x≷y
52 - 25 5         x≤y
53 - 25 7 56      GTO 56
54 - 24 71        1/x
55 - 9            9
56 - 0            0
57 - 21 9         STO 9
58 - 25 33        R↓
59 - 24 71        1/x
60 - 21 73 9      STO .9
61 - 31           ENTER
62 - 61           ×
63 - 51           +
64 - 24 21        √x
65 - 86 41 9      RCL − .9
66 - 21 73 9      STO .9
67 - 31           ENTER
68 - 61           ×
69 - 31           ENTER
70 - 31           ENTER
71 - 31           ENTER
72 - 86 61 5      RCL × .5
73 - 86 41 4      RCL − .4
74 - 61           ×
75 - 86 51 3      RCL + .3
76 - 61           ×
77 - 86 41 2      RCL − .2
78 - 61           ×
79 - 86 51 1      RCL + .1
80 - 61           ×
81 - 3            3
82 - 24 71        1/x
83 - 41           −
84 - 61           ×
85 - 1            1
86 - 51           +
87 - 86 61 9      RCL × .9
88 - 8            8
89 - 25 12        12÷
90 - 61           ×
91 - 86 71 0      RCL ÷ .0
92 - 22 9         RCL 9
93 - 25 6         x=0
94 - 33           x≷y
95 - 33           x≷y
96 - 41           −
97 - 25 7 00      GTO 00
98 - 9            9
99 - 0            0

------------------------------------

R.0: 5.8177641733144E-03
R.1: 0.199999779
R.2: 0.142841665
R.3: 1.107161127E-01
R.4: 0.086263068
R.5: 0.05051923
R.6: 3.281837579E-08
R.7: 5.5538386E-14
R.8: -4.4502E-20

Angles in DEGREES

-90 =< x <= 90

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

GTO 31 R/S --> asin(x)
GTO 42 R/S --> acos(x)
GTO 48 R/S --> atan(x)

------------------------------------------

Constants:

5.817764173E-03 ENTER
3.144E-13 + STO .0

0.199999779 STO .1
0.142841665 STO .2
1.107161127E-01 STO .3
0.086263068 STO .4
0.05051923 STO .5

3.281837579E-08 STO .6
5.5538386E-14 STO .7
-4.4502E-20 STO .9

------------------------------------------

Trigononometric Functions:

Enter angles in degrees, -90 =< x <= 90

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


Inverse Trigonometric Functions:

GTO 35 R/S => arcsin(x)
GTO 44 R/S => arccos(x)
GTO 50 R/S => arctan(x)

------------------------------------------

0.0001 R/S --> 1.000000000 ; cos(0.0001)
x<>y --> 1.745329252E-06 ; sin(0.0001)
/ --> 1.745329252E-06 ; tan(0.0001)

0.9999 GTO 31 R/S --> 89.18960856 ; asin(0.9999)
0.9999 GTO 42 R/S --> 0.8102914371 ; acos(0.9999)
0.9999 GTO 48 R/S --> 44.99713507 ; atan(0.9999)


Other examples:

sin(0.01) = 1.745329243E-04
cos(0.01) = 0.9999999848
tan(0.01) = 1.745329270E-04

sin(30) = 0.5000000000
cos(30) = 0.8660254038
tan(30) = 0.5773502692

sin(60) = 0.500000000(1)
cos(60) = 0.866025403(7)
tan(60) = 1.73205080(7)

sin(89.99) = 0.9999999848
cos(89.99) = 1.7453(38006)E-4
tan(89.99) = 5729.5(49127)

sin(89.9999) = 1.000000000
cos(89.9999) = 1.74(6171960)E-6
tan(89.9999) = 572(681.2838)

asin(0) = 0.000000000
acos(0) = Error 0
atan(0) = 0.000000000

asin(1) = 90.00000000
acos(1) = 0.000000000
atan(1) = 45.00000000

asin(1E10) = 90.00000000

atan(0.4142135624) = 22.50000000

acos(0.8660254038) = 30.00000000

atan(50) = 88.85423716

------------------------------------------

Forensic result:

9 R/S x<>y R/S R/S / GTO 48 R/S GTO 42 R/S GTO 31 R/S --> 9.000000275

------------------------------------------

Edited to fix a couple of typos (two constants inside the code box).
Find all posts by this user
Quote this message in a reply
03-28-2016, 04:07 AM
Post: #2
RE: Easter Sunday Trigs ( rpn38-CX)
Thanks, Gerson ! I'll have fun with this tomorrow.

By the way I appreciate the constant listing you gave in this format:
R.0: 5.8177641733144
R.1: 0.199999779
R.2: 1.142841665
R.3: 1.107161127E-01
R.4: 0.086263068
R.5: 0.05051923
R.6: 3.281837579E-08
R.7: 5.5538386E-14
R.8: -4.4502E-20

All I have to do is copy the whole list and paste to the display and they will automatically be loaded into the correct registers.

Compared to my trusty HP-35, these programs have greater accuracy!


Regards,
Bob
Find all posts by this user
Quote this message in a reply
03-28-2016, 04:29 AM
Post: #3
RE: Easter Sunday Trigs ( rpn38-CX)
(03-28-2016 04:07 AM)bshoring Wrote:  I'll have fun with this tomorrow.

Just wait for the next version. I've added another constant to the sine polynomial. Now the accuracy of sine/cosine/tangent matches that of the inverse functions. See my latest reply to you in the other thread.

Regards,

Gerson.
Find all posts by this user
Quote this message in a reply
03-28-2016, 04:38 AM
Post: #4
RE: Easter Sunday Trigs ( rpn38-CX)
May need some work. I'm getting an Error 0 when running from step 01. Probably when it tries to take a SQRT of a neg number. Also getting strange results with ATAN and ACOS.


Regards,
Bob
Find all posts by this user
Quote this message in a reply
03-28-2016, 04:51 AM (This post was last modified: 03-28-2016 10:27 AM by Gerson W. Barbosa.)
Post: #5
RE: Easter Sunday Trigs ( rpn38-CX)
https://www.dropbox.com/s/vej597n0v1pj11...rpn38?dl=0

Check the link above. I still have to reorder the registers and update the description. The asin address is 33, not 31.

Gerson.

Edited to update the link.
Find all posts by this user
Quote this message in a reply
03-28-2016, 05:01 AM
Post: #6
RE: Easter Sunday Trigs ( rpn38-CX)
These are the correct sine polynomial constants for the program in DropBox:

R8: 2.1E-26
R.8: 4.47569E-20
R.7: 5.55391606E-14
R.6: 3.281837614E-08
Find all posts by this user
Quote this message in a reply
03-28-2016, 05:56 AM
Post: #7
RE: Easter Sunday Trigs ( rpn38-CX)
Loaded the new program & the constants listed in Dropbox. Then loaded the 4 sine constants above. With 89 R/S, I'm getting Error 0.

X contains -3.082331E+17
Y: -555187516.6
X & T: 7921.00


Regards,
Bob
Find all posts by this user
Quote this message in a reply
03-28-2016, 08:40 AM (This post was last modified: 03-28-2016 12:32 PM by Gerson W. Barbosa.)
Post: #8
RE: Easter Sunday Trigs ( rpn38-CX)
(03-28-2016 04:07 AM)bshoring Wrote:  By the way I appreciate the constant listing you gave in this format:
R.0: 5.8177641733144
R.1: 0.199999779
R.2: 1.142841665
R.3: 1.107161127E-01
R.4: 0.086263068
R.5: 0.05051923
R.6: 3.281837579E-08
R.7: 5.5538386E-14
R.8: -4.4502E-20

All I have to do is copy the whole list and paste to the display and they will automatically be loaded into the correct registers.

Awkwardly this doesn't appear to work with the extended registers, as I had already noticed. I've just copied and pasted the first six constants above, but they ended up going into the ordinary registers, R0 through R5 instead of R.0 through R.5. If such is the case, the following might work:

RCL 0 STO.0
RCL 1 STO.1

and so on.

Please notice the second program requires distinct constants in R8 and R.8.

Regards,

Gerson.

P. S.: It appears this won't work either. Not only the constants haven't been copied to the intended registers, but the decimal point has been completely ignored. Thus I have 1142841665 in register 1 instead of 1.142841665, for instance. Setting the decimal point to . did not help.

Furthermore, the constant in R.0 is 5.8177641733144E-03, that is, pi/540. The program in dropbox is just a draft but I'd forgotten the exponent in the previous program (but not in the constants list outside the code box). Also, R.2 in the code box is wrong: 0.142841665, not 1.142841665. My bad, sorry!

Updated dropbox link:

https://www.dropbox.com/s/vej597n0v1pj11...rpn38?dl=0

Still not the final version, but the two flawed constants have been fixed. For asin(x), GTO 33 R/S.
Find all posts by this user
Quote this message in a reply
03-28-2016, 03:55 PM
Post: #9
RE: Easter Sunday Trigs ( rpn38-CX)
Working fine now with the corrected constants.

By the way when I copied the list of constants they all went to the correct registers.


Regards,
Bob
Find all posts by this user
Quote this message in a reply
03-28-2016, 08:31 PM
Post: #10
RE: Easter Sunday Trigs ( rpn38-CX)
I think this is the best version overall, with a better forensic result than even the venerable HP-41. My favorite measurement is ATAN .75 and from that result getting a perfect SIN: .60, COS: .8 and back to TAN: .75.

You did a really nice job! Thanks.

By the way by copying this block of constants in Dropbox and pasting to the display everything loaded into the correct registers, even the 4 extra digits in R.0. In settings I have "Decimal Point" set to "." Not sure if that makes a difference.
R.0: 5.8177641733144E-03
R.1: 0.199999779
R.2: 0.142841665
R.3: 1.107161127E-01
R.4: 0.086263068
R.5: 0.05051923
R8: 2.1E-26
R.8: 4.47569E-20
R.7: 5.55391606E-14
R.6: 3.281837614E-08

Thanks!


Regards,
Bob
Find all posts by this user
Quote this message in a reply
03-29-2016, 03:07 AM (This post was last modified: 03-29-2016 05:01 AM by Gerson W. Barbosa.)
Post: #11
RE: Easter Sunday Trigs (rpn38-CX) - Updated version
.
Trigonometric Functions (RPN-38 CX)

Code:

01 - 21 8         STO 8
02 - 31           ENTER
03 - 61           ×
04 - 31           ENTER
05 - 31           ENTER
06 - 31           ENTER
07 - 86 61 9      RCL × .9
08 - 86 41 8      RCL − .8
09 - 61           ×
10 - 86 51 7      RCL + .7
11 - 61           ×
12 - 86 41 6      RCL − .6
13 - 61           ×
14 - 86 51 0      RCL + .0
15 - 22 61 8      RCL × 8
16 - 21 8         STO 8
17 - 22 61 8      RCL × 8
18 - 4            4
19 - 61           ×
20 - 3            3
21 - 41           −
22 - 22 61 8      RCL × 8
23 - 32           CHS
24 - 31           ENTER
25 - 31           ENTER
26 - 61           ×
27 - 32           CHS
28 - 1            1
29 - 51           +
30 - 24 21        √x
31 - 25 7 00      GTO 00
32 - 25 6         x=0
33 - 25 7 00      GTO 00
34 - 31           ENTER
35 - 61           ×
36 - 24 71        1/x
37 - 1            1
38 - 41           −
39 - 25 6         x=0
40 - 22 73 9      RCL .9
41 - 24 71        1/x
42 - 25 7 50      GTO 50
43 - 25 6         x=0
44 - 25 7 39      GTO 40
45 - 31           ENTER
46 - 61           ×
47 - 24 71        1/x
48 - 1            1
49 - 41           −
50 - 24 21        √x
51 - 25 6         x=0
52 - 25 7 00      GTO 00
53 - 1            1
54 - 33           x≷y
55 - 25 5         x≤y
56 - 25 7 59      GTO 59
57 - 24 71        1/x
58 - 9            9
59 - 0            0
60 - 21 9         STO 9
61 - 25 33        R↓
62 - 24 71        1/x
63 - 21 8         STO 8
64 - 31           ENTER
65 - 61           ×
66 - 51           +
67 - 24 21        √x
68 - 22 41 8      RCL − 8
69 - 21 8         STO 8
70 - 31           ENTER
71 - 61           ×
72 - 31           ENTER
73 - 31           ENTER
74 - 31           ENTER
75 - 86 61 5      RCL × .5
76 - 86 41 4      RCL − .4
77 - 61           ×
78 - 86 51 3      RCL + .3
79 - 61           ×
80 - 86 41 2      RCL − .2
81 - 61           ×
82 - 86 51 1      RCL + .1
83 - 61           ×
84 - 3            3
85 - 24 71        1/x
86 - 41           −
87 - 61           ×
88 - 1            1
89 - 51           +
90 - 22 61 8      RCL × 8
91 - 8            8
92 - 25 12        12÷
93 - 61           ×
94 - 86 71 0      RCL ÷ .0
95 - 22 9         RCL 9
96 - 25 6         x=0
97 - 33           x≷y
98 - 33           x≷y
99 - 41           −

------------------------------------

Trigonometric Functions

R.0: 5.8177641733144e-03
R.1: 0.199999779
R.2: 0.142841665
R.3: 1.107161127e-01
R.4: 0.086263068
R.5: 0.05051923
R.6: 3.2818376136867e-08
R.7: 5.553916059e-14
R.8: 4.4756602e-20
R.9: 2.0935e-26


Angles in DEGREES

-90 =< x <= 90

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


GTO 32 R/S --> asin(x)      0 =< x <= 1
GTO 43 R/S --> acos(x)      0 =< x <= 1
GTO 51 R/S --> atan(x)   1e-50 < x < 1e42


Gerson W. Barbosa - Mar/2016

------------------------------------------

Constants:

R.0: 5.8177641733144e-03
R.1: 0.199999779
R.2: 0.142841665
R.3: 1.107161127e-01
R.4: 0.086263068
R.5: 0.05051923
R.6: 3.2818376136867e-08
R.7: 5.553916059e-14
R.8: 4.4756602e-20
R.9: 2.0935e-26

------------------------------------------

Trigononometric Functions:

Enter angles in degrees, -90 =< x <= 90

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


Inverse Trigonometric Functions:

GTO 32 R/S => arcsin(x) (0 =< x <= 1)
GTO 43 R/S => arccos(x) (0 =< x <= 1)
GTO 51 R/S => arctan(x) (1e-50 < x < 1e42)

------------------------------------------

0.0001 R/S --> 1.000000000 ; cos(0.0001)
x<>y --> 1.745329252E-06 ; sin(0.0001)
/ --> 1.745329252E-06 ; tan(0.0001)

0.9999 GTO 32 R/S --> 89.18960856 ; asin(0.9999)
0.9999 GTO 43 R/S --> 0.8102914371 ; acos(0.9999)
0.9999 GTO 51 R/S --> 44.99713507 ; atan(0.9999)


Other examples:

sin(0.01) = 1.745329243E-04
cos(0.01) = 0.9999999848
tan(0.01) = 1.745329270E-04

sin(30) = 0.5000000000
cos(30) = 0.8660254038
tan(30) = 0.5773502692

sin(60) = 0.5000000000
cos(60) = 0.8660254038
tan(60) = 1.732050808

sin(75) = 0.9659258263
cos(75) = 0.2588190451
tan(75) = 3.732050808

sin(89) = 0.9998476952
cos(89) = 1.745240644E-4
tan(89) = 57.28996163

sin(89.99) = 0.9999999848
cos(89.99) = 1.74532924(0)E-4
tan(89.99) = 5729.577(902)

sin(89.9999) = 1.000000000
cos(89.9999) = 1.7453(45219)E-6
tan(89.9999) = 57295(2.5534)

asin(0) = 0.000000000
acos(0) = 90.00000000
atan(0) = 0.000000000

asin(1) = 90.00000000
acos(1) = 0.000000000
atan(1) = 45.00000000

asin(1e10) = 90.00000000

atan(0.4142135624) = 22.50000000

acos(0.8660254038) = 30.00000000

atan(50) = 88.85423716

------------------------------------------

Forensic result:

9 R/S x<>y R/S R/S / GTO 51 R/S GTO 43 R/S GTO 32 R/S --> 9.000000275

------------------------------------------
Find all posts by this user
Quote this message in a reply
03-29-2016, 03:23 AM (This post was last modified: 03-29-2016 04:41 AM by Gerson W. Barbosa.)
Post: #12
RE: Easter Sunday Trigs ( rpn38-CX)
(03-28-2016 08:31 PM)bshoring Wrote:  I think this is the best version overall, with a better forensic result than even the venerable HP-41. My favorite measurement is ATAN .75 and from that result getting a perfect SIN: .60, COS: .8 and back to TAN: .75.

You did a really nice job! Thanks.

By the way by copying this block of constants in Dropbox and pasting to the display everything loaded into the correct registers, even the 4 extra digits in R.0. In settings I have "Decimal Point" set to "." Not sure if that makes a difference.
R.0: 5.8177641733144E-03
R.1: 0.199999779
R.2: 0.142841665
R.3: 1.107161127E-01
R.4: 0.086263068
R.5: 0.05051923
R8: 2.1E-26
R.8: 4.47569E-20
R.7: 5.55391606E-14
R.6: 3.281837614E-08

Thanks!


Hello Bob,

You might want to try the updated version. Now basic trigs are more accurate, with improved results near 90 degrees. Also, asin(0), asin(1), acos(0) and acos(1) return correct answers instead of Error 0 messages. Hopefully no more mistakes :-)

Yes, DECIMAL POINT IS COMMA here. I have yet to test the simulator with other settings.

Regards,

Gerson.

P.S.: Here's the dropbox link to the updated version:

https://www.dropbox.com/s/xmmz3odips4ip6...rpn38?dl=0
Find all posts by this user
Quote this message in a reply
03-29-2016, 05:53 AM
Post: #13
RE: Easter Sunday Trigs ( rpn38-CX)
I like it. Really efficient use of Recall Arithmetic. Extremely accurate.


Regards,
Bob
Find all posts by this user
Quote this message in a reply
03-30-2016, 01:32 AM
Post: #14
RE: Easter Sunday Trigs ( rpn38-CX)
Here's another program written by Willy Kunz, that offers a similar level of accuracy:

Trigonometric Functions for RPN-38 CX
by Willy Kunz

R.0: 5.8177641733144E-03
R.1: 0.199999779
R.2: 0.142841665
R.3: 1.107161127E-01
R.4: 0.086263068
R.5: 0.05051923
R8: 2.1E-26
R.8: 4.47569E-20
R.7: 5.55391606E-14
R.6: 3.281837614E-08
R6: 90
R7: 0.3333333333

Angles in DEGREES

-90 =< x <= 90

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

GTO 33 R/S --> asin(x)
GTO 42 R/S --> acos(x)
GTO 52 R/S --> atan(x)

01 - 21 73 9 STO .9
02 - 31 ENTER
03 - 61 ×
04 - 31 ENTER
05 - 31 ENTER
06 - 31 ENTER
07 - 22 61 8 RCL × 8
08 - 86 41 8 RCL − .8
09 - 61 ×
10 - 86 51 7 RCL + .7
11 - 61 ×
12 - 86 41 6 RCL − .6
13 - 61 ×
14 - 86 51 0 RCL + .0
15 - 86 61 9 RCL × .9
16 - 31 ENTER
17 - 31 ENTER
18 - 61 ×
19 - 4 4
20 - 61 ×
21 - 32 CHS
22 - 3 3
23 - 51 +
24 - 61 ×
25 - 31 ENTER
26 - 31 ENTER
27 - 61 ×
28 - 32 CHS
29 - 1 1
30 - 51 +
31 - 24 21 √x
32 - 25 7 00 GTO 00
33 - 25 6 x=0
34 - 25 7 00 GTO 00
35 - 31 ENTER
36 - 61 ×
37 - 24 71 1/x
38 - 1 1
39 - 41 −
40 - 24 71 1/x
41 - 25 7 49 GTO 49
42 - 25 6 x=0
43 - 25 7 98 GTO 98
44 - 31 ENTER
45 - 61 ×
46 - 24 71 1/x
47 - 1 1
48 - 41 −
49 - 24 21 √x
50 - 25 6 x=0
51 - 25 7 00 GTO 00
52 - 1 1
53 - 33 x≷y
54 - 25 5 x≤y
55 - 25 7 58 GTO 58
56 - 24 71 1/x
57 - 9 9
58 - 0 0
59 - 21 9 STO 9
60 - 25 33 R↓
61 - 24 71 1/x
62 - 21 73 9 STO .9
63 - 31 ENTER
64 - 61 ×
65 - 51 +
66 - 24 21 √x
67 - 86 41 9 RCL − .9
68 - 21 73 9 STO .9
69 - 31 ENTER
70 - 61 ×
71 - 31 ENTER
72 - 31 ENTER
73 - 31 ENTER
74 - 86 61 5 RCL × .5
75 - 86 41 4 RCL − .4
76 - 61 ×
77 - 86 51 3 RCL + .3
78 - 61 ×
79 - 86 41 2 RCL − .2
80 - 61 ×
81 - 86 51 1 RCL + .1
82 - 61 ×
83 - 22 41 7 RCL − 7
84 - 61 ×
85 - 1 1
86 - 51 +
87 - 86 61 9 RCL × .9
88 - 8 8
89 - 25 12 12÷
90 - 61 ×
91 - 86 71 0 RCL ÷ .0
92 - 22 9 RCL 9
93 - 25 6 x=0
94 - 33 x≷y
95 - 33 x≷y
96 - 41 −
97 - 25 7 00 GTO 00
98 - 22 6 RCL 6
99 - 25 7 00 GTO 00


Regards,
Bob
Find all posts by this user
Quote this message in a reply
03-30-2016, 02:48 AM (This post was last modified: 03-30-2016 02:50 AM by Gerson W. Barbosa.)
Post: #15
RE: Easter Sunday Trigs ( rpn38-CX)
(03-29-2016 05:53 AM)bshoring Wrote:  I like it. Really efficient use of Recall Arithmetic. Extremely accurate.

Well, perhaps not that efficient. It's always possible to squeeze in another step if one needs to. As I prefer sine first, I've managed to insert an x<>y instruction between √x and GTO 00 (step 30).

Code:

16 - 21 8         STO 8
17 - 21 51 8      STO + 8
18 - 3            3
19 - 22 8         RCL 8
20 - 22 61 8      RCL × 8
21 - 41           −
22 - 61           ×
23 - 31           ENTER
24 - 31           ENTER
25 - 61           ×
26 - 32           CHS
27 - 1            1
28 - 51           +
29 - 24 21        √x
30 - 33           x≷y
31 - 25 7 00      GTO 00

New usage:

R/S: sine
R/S x<>y: cosine
R/S x<>y /: tangent

Tangent now requires an extra keystroke, but I don't mind as sine is used most often, I think.

Regards,

Gerson. [/code]
Find all posts by this user
Quote this message in a reply
03-30-2016, 03:28 AM (This post was last modified: 03-30-2016 05:43 AM by Gerson W. Barbosa.)
Post: #16
RE: Easter Sunday Trigs ( rpn38-CX)
(03-30-2016 01:32 AM)bshoring Wrote:  Here's another program written by Willy Kunz, that offers a similar level of accuracy:

Trigonometric Functions for RPN-38 CX
by Willy Kunz

R.0: 5.8177641733144E-03
R.1: 0.199999779
R.2: 0.142841665
R.3: 1.107161127E-01
R.4: 0.086263068
R.5: 0.05051923
R8: 2.1E-26
R.8: 4.47569E-20
R.7: 5.55391606E-14
R.6: 3.281837614E-08
R6: 90
R7: 0.3333333333

Angles in DEGREES

-90 =< x <= 90

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

GTO 33 R/S --> asin(x)
GTO 42 R/S --> acos(x)
GTO 52 R/S --> atan(x)

01 - 21 73 9 STO .9
02 - 31 ENTER
03 - 61 ×
04 - 31 ENTER
05 - 31 ENTER
06 - 31 ENTER
07 - 22 61 8 RCL × 8
08 - 86 41 8 RCL − .8
09 - 61 ×
10 - 86 51 7 RCL + .7
11 - 61 ×
12 - 86 41 6 RCL − .6
13 - 61 ×
14 - 86 51 0 RCL + .0
15 - 86 61 9 RCL × .9
16 - 31 ENTER
17 - 31 ENTER
18 - 61 ×
19 - 4 4
20 - 61 ×
21 - 32 CHS
22 - 3 3
23 - 51 +
24 - 61 ×
25 - 31 ENTER
26 - 31 ENTER
27 - 61 ×
28 - 32 CHS
29 - 1 1
30 - 51 +
31 - 24 21 √x
32 - 25 7 00 GTO 00
33 - 25 6 x=0
34 - 25 7 00 GTO 00
35 - 31 ENTER
36 - 61 ×
37 - 24 71 1/x
38 - 1 1
39 - 41 −
40 - 24 71 1/x
41 - 25 7 49 GTO 49
42 - 25 6 x=0
43 - 25 7 98 GTO 98
44 - 31 ENTER
45 - 61 ×
46 - 24 71 1/x
47 - 1 1
48 - 41 −
49 - 24 21 √x
50 - 25 6 x=0
51 - 25 7 00 GTO 00
52 - 1 1
53 - 33 x≷y
54 - 25 5 x≤y
55 - 25 7 58 GTO 58
56 - 24 71 1/x
57 - 9 9
58 - 0 0
59 - 21 9 STO 9
60 - 25 33 R↓
61 - 24 71 1/x
62 - 21 73 9 STO .9
63 - 31 ENTER
64 - 61 ×
65 - 51 +
66 - 24 21 √x
67 - 86 41 9 RCL − .9
68 - 21 73 9 STO .9
69 - 31 ENTER
70 - 61 ×
71 - 31 ENTER
72 - 31 ENTER
73 - 31 ENTER
74 - 86 61 5 RCL × .5
75 - 86 41 4 RCL − .4
76 - 61 ×
77 - 86 51 3 RCL + .3
78 - 61 ×
79 - 86 41 2 RCL − .2
80 - 61 ×
81 - 86 51 1 RCL + .1
82 - 61 ×
83 - 22 41 7 RCL − 7
84 - 61 ×
85 - 1 1
86 - 51 +
87 - 86 61 9 RCL × .9
88 - 8 8
89 - 25 12 12÷
90 - 61 ×
91 - 86 71 0 RCL ÷ .0
92 - 22 9 RCL 9
93 - 25 6 x=0
94 - 33 x≷y
95 - 33 x≷y
96 - 41 −
97 - 25 7 00 GTO 00
98 - 22 6 RCL 6
99 - 25 7 00 GTO 00

Where have you found that one? It appears to be based upon my previous version, the one that borrows the sine polynomial constants from the 12C Platinum program. What are the results for cos(60), cos(89.9999) and tan(89.9999)?

I too did consider placing the 1/3 constant in a register, thus saving two steps, same for the 90 constant used for error handling, but I decided to refrain myself from using more common registers. The error handling solution I eventually came up with for the cases acos(0) and asin(1) uses one of the sine polynomial constants.

Anyway, I prefer my latest version with the recent modification to make sine show up first.

Regards,

Gerson.
Find all posts by this user
Quote this message in a reply
03-30-2016, 05:17 AM (This post was last modified: 03-30-2016 05:37 AM by Gerson W. Barbosa.)
Post: #17
RE: Easter Sunday Trigs (rpn38-CX) - Updated version
.
Trigonometric Functions (RPN-38 CX)

Code:

01 - 21 8         STO 8
02 - 31           ENTER
03 - 61           ×
04 - 31           ENTER
05 - 31           ENTER
06 - 31           ENTER
07 - 86 61 9      RCL × .9
08 - 86 41 8      RCL − .8
09 - 61           ×
10 - 86 51 7      RCL + .7
11 - 61           ×
12 - 86 41 6      RCL − .6
13 - 61           ×
14 - 86 51 0      RCL + .0
15 - 22 61 8      RCL × 8
16 - 21 8         STO 8
17 - 21 51 8      STO + 8
18 - 3            3
19 - 22 8         RCL 8
20 - 22 61 8      RCL × 8
21 - 41           −
22 - 61           ×
23 - 31           ENTER
24 - 31           ENTER
25 - 61           ×
26 - 32           CHS
27 - 1            1
28 - 51           +
29 - 24 21        √x
30 - 33           x≷y
31 - 25 7 00      GTO 00
32 - 25 6         x=0
33 - 25 7 00      GTO 00
34 - 31           ENTER
35 - 61           ×
36 - 24 71        1/x
37 - 1            1
38 - 41           −
39 - 25 6         x=0
40 - 22 73 9      RCL .9
41 - 24 71        1/x
42 - 25 7 50      GTO 50
43 - 25 6         x=0
44 - 25 7 39      GTO 40
45 - 31           ENTER
46 - 61           ×
47 - 24 71        1/x
48 - 1            1
49 - 41           −
50 - 24 21        √x
51 - 25 6         x=0
52 - 25 7 00      GTO 00
53 - 1            1
54 - 33           x≷y
55 - 25 5         x≤y
56 - 25 7 59      GTO 59
57 - 24 71        1/x
58 - 9            9
59 - 0            0
60 - 21 9         STO 9
61 - 25 33        R↓
62 - 24 71        1/x
63 - 21 8         STO 8
64 - 31           ENTER
65 - 61           ×
66 - 51           +
67 - 24 21        √x
68 - 22 41 8      RCL − 8
69 - 21 8         STO 8
70 - 31           ENTER
71 - 61           ×
72 - 31           ENTER
73 - 31           ENTER
74 - 31           ENTER
75 - 86 61 5      RCL × .5
76 - 86 41 4      RCL − .4
77 - 61           ×
78 - 86 51 3      RCL + .3
79 - 61           ×
80 - 86 41 2      RCL − .2
81 - 61           ×
82 - 86 51 1      RCL + .1
83 - 61           ×
84 - 3            3
85 - 24 71        1/x
86 - 41           −
87 - 61           ×
88 - 1            1
89 - 51           +
90 - 22 61 8      RCL × 8
91 - 8            8
92 - 25 12        12÷
93 - 61           ×
94 - 86 71 0      RCL ÷ .0
95 - 22 9         RCL 9
96 - 25 6         x=0
97 - 33           x≷y
98 - 33           x≷y
99 - 41           −

------------------------------------

Trigonometric Functions

R.0: 5.817764173314432e-03
R.1: 0.199999779
R.2: 0.142841665
R.3: 1.107161127e-01
R.4: 0.086263068
R.5: 0.05051923
R.6: 3.2818376136867e-08
R.7: 5.553916059e-14
R.8: 4.4756602e-20
R.9: 2.0935e-26


Angles in DEGREES

-90 =< x <= 90

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


GTO 32 R/S --> asin(x)      0 =< x <= 1
GTO 43 R/S --> acos(x)      0 =< x <= 1
GTO 51 R/S --> atan(x)   1e-50 < x < 1e42


by Gerson W. Barbosa - Mar/2016

------------------------------------------

Constants:

R.0: 5.817764173314432e-03
R.1: 0.199999779
R.2: 0.142841665
R.3: 1.107161127e-01
R.4: 0.086263068
R.5: 0.05051923
R.6: 3.2818376136867e-08
R.7: 5.553916059e-14
R.8: 4.4756602e-20
R.9: 2.0935e-26

------------------------------------------

Trigononometric Functions:

Enter angles in degrees, -90 =< x <= 90

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


Inverse Trigonometric Functions:

GTO 32 R/S => arcsin(x) (0 =< x <= 1)
GTO 43 R/S => arccos(x) (0 =< x <= 1)
GTO 51 R/S => arctan(x) (1e-50 < x < 1e42)

------------------------------------------

0.0001 R/S --> 1.745329252E-06 ; sin(0.0001)
x<>y --> 1.000000000 ; cos(0.0001)
/ --> 1.745329252E-06 ; tan(0.0001)

0.9999 GTO 32 R/S --> 89.18960856 ; asin(0.9999)
0.9999 GTO 43 R/S --> 0.8102914371 ; acos(0.9999)
0.9999 GTO 51 R/S --> 44.99713507 ; atan(0.9999)

RCL .0 540 × --> 3.141592654 ; pi


Other examples:

sin(0.01) = 1.745329243E-04
cos(0.01) = 0.9999999848
tan(0.01) = 1.745329270E-04

sin(30) = 0.5000000000
cos(30) = 0.8660254038
tan(30) = 0.5773502692

sin(60) = 0.8660254038
cos(60) = 0.5000000000
tan(60) = 1.732050808

sin(75) = 0.9659258263
cos(75) = 0.2588190451
tan(75) = 3.732050808

sin(89) = 0.9998476952
cos(89) = 1.745240644E-2
tan(89) = 57.28996163

sin(89.99) = 0.9999999848
cos(89.99) = 1.74532924(0)E-4
tan(89.99) = 5729.577(902)

sin(89.9999) = 1.000000000
cos(89.9999) = 1.7453(45219)E-6
tan(89.9999) = 57295(2.5534)

asin(0) = 0.000000000
acos(0) = 90.00000000
atan(0) = 0.000000000

asin(1) = 90.00000000
acos(1) = 0.000000000
atan(1) = 45.00000000

asin(1e10) = 90.00000000

atan(0.4142135624) = 22.50000000

acos(0.8660254038) = 30.00000000

atan(50) = 88.85423716

------------------------------------------

Forensic result:

9 R/S R/S x<>y R/S x<>y / GTO 51 R/S GTO 43 R/S GTO 32 R/S --> 9.000000282

------------------------------------------

This is essentially the previous version with different usage. Now sin(x) is displayed first. The slightly different forensic result is due to the extra two digits in the constant in R.0 (pi/540). If you prefer the older usage just delete the line and subtract 1 from the address of the inverse functions (GTO 31 R/S; GTO 42 R/S; GTO 50 R/S).
Find all posts by this user
Quote this message in a reply
03-31-2016, 12:45 AM
Post: #18
RE: Easter Sunday Trigs ( rpn38-CX)
Very nice program. I saved it as "Trigs2.2 (sin in X)".

After playing with it for a while, I decided I still like having sin in Y and cos in X, so I deleted line 30 and updated my instructions. Saved that as "Trigs2.3 (cos in X)".

Since I now have several Trig programs and each has different line numbers to GOTO for ASIN, ACOS & ATAN, I came up with an interesting way to remind myself where they are for a given program, so I don't have to write it down. Since HP financial calculators have special 1-byte registers (0-20) for recording the number of cash flows I decided to use Nj registers 0-2 to store those line numbers. If I forget where ATAN starts, I can just tap the display briefly to bring up the Register View and I can see 31, 42, 50, per the image attached.

I spoke to Willy about the problem with pasting registers to the display. He's aware of the problem and hopes to fix it in the next update of the app. In the meantime, a workaround is to go into SETTINGS (tap the wrench icon) and for the Decimal Point, select the first option "." And then hit SAVE before attempting to paste registers. Then after copying you can always set the decimal point setting to your preference.

I find that I can copy this whole block of constants (I usually do a Clear All first):

R.0: 5.817764173314432e-03
R.1: 0.199999779
R.2: 0.142841665
R.3: 1.107161127e-01
R.4: 0.086263068
R.5: 0.05051923
R.6: 3.2818376136867e-08
R.7: 5.553916059e-14
R.8: 4.4756602e-20
R.9: 2.0935e-26
R0: 0. 31 (ASIN GOTO reminder)
R1: 0. 42 (ACOS GOTO reminder)
R2: 0. 50 (ATAN GOTO reminder)

And when I paste to the display, all of these values go into the desired locations. Even the 31, 42 and 50 go into the Nj registers for 0-2.

Hope it works for you. Makes life a lot easier. After the next app update for RPN-38 CX, it shouldn't matter which decimal point setting you use.


Attached File(s) Thumbnail(s)
   


Regards,
Bob
Find all posts by this user
Quote this message in a reply
03-31-2016, 04:43 AM
Post: #19
RE: Easter Sunday Trigs ( rpn38-CX)
(03-31-2016 12:45 AM)bshoring Wrote:  Very nice program. I saved it as "Trigs2.2 (sin in X)".

After playing with it for a while, I decided I still like having sin in Y and cos in X, so I deleted line 30 and updated my instructions. Saved that as "Trigs2.3 (cos in X)".

Thanks! Alternatively you can replace line 30 with a GTO 00 instruction, so that the entry point of the inverse functions don't change.

(03-31-2016 12:45 AM)bshoring Wrote:  Since I now have several Trig programs and each has different line numbers to GOTO for ASIN, ACOS & ATAN, I came up with an interesting way to remind myself where they are for a given program, so I don't have to write it down. Since HP financial calculators have special 1-byte registers (0-20) for recording the number of cash flows I decided to use Nj registers 0-2 to store those line numbers. If I forget where ATAN starts, I can just tap the display briefly to bring up the Register View and I can see 31, 42, 50, per the image attached.

Nice trick! I will it with other programs.

(03-31-2016 12:45 AM)bshoring Wrote:  I spoke to Willy about the problem with pasting registers to the display. He's aware of the problem and hopes to fix it in the next update of the app. In the meantime, a workaround is to go into SETTINGS (tap the wrench icon) and for the Decimal Point, select the first option "." And then hit SAVE before attempting to paste registers. Then after copying you can always set the decimal point setting to your preference.

Perhaps both "," and "." should be interpred as radix points. Thus,

R.0: 5,817764173314432e-03
R.1: 0.199999779
R.2: 0,142841665

would be converted either to

R.0: 5.817764173314432e-03
R.1: 0.199999779
R.2: 0.142841665

or

R.0: 5,817764173314432e-03
R.1: 0,199999779
R.2: 0,142841665

depending on the user settings.

(03-31-2016 12:45 AM)bshoring Wrote:  After the next app update for RPN-38 CX, it shouldn't matter which decimal point setting you use.

It would be nice if the next update includes the last version of Trigs, the one that leaves sine in X. Sure, the library already includes Valentin Albillo's famous HP-12C Tried & Tricky Trigonometrics. Speed is not a problem anymore, but results in radians are rather inconvenient for those of us who use mostly degrees.

Best regards,

Gerson.
Find all posts by this user
Quote this message in a reply
03-31-2016, 07:22 PM
Post: #20
RE: Easter Sunday Trigs ( rpn38-CX)
(03-31-2016 04:43 AM)Gerson W. Barbosa Wrote:  
(03-31-2016 12:45 AM)bshoring Wrote:  Very nice program. I saved it as "Trigs2.2 (sin in X)".

After playing with it for a while, I decided I still like having sin in Y and cos in X, so I deleted line 30 and updated my instructions. Saved that as "Trigs2.3 (cos in X)".

Thanks! Alternatively you can replace line 30 with a GTO 00 instruction, so that the entry point of the inverse functions don't change.

(03-31-2016 12:45 AM)bshoring Wrote:  Since I now have several Trig programs and each has different line numbers to GOTO for ASIN, ACOS & ATAN, I came up with an interesting way to remind myself where they are for a given program, so I don't have to write it down. Since HP financial calculators have special 1-byte registers (0-20) for recording the number of cash flows I decided to use Nj registers 0-2 to store those line numbers. If I forget where ATAN starts, I can just tap the display briefly to bring up the Register View and I can see 31, 42, 50, per the image attached.

Nice trick! I will it with other programs.

(03-31-2016 12:45 AM)bshoring Wrote:  I spoke to Willy about the problem with pasting registers to the display. He's aware of the problem and hopes to fix it in the next update of the app. In the meantime, a workaround is to go into SETTINGS (tap the wrench icon) and for the Decimal Point, select the first option "." And then hit SAVE before attempting to paste registers. Then after copying you can always set the decimal point setting to your preference.

Perhaps both "," and "." should be interpred as radix points. Thus,

R.0: 5,817764173314432e-03
R.1: 0.199999779
R.2: 0,142841665

would be converted either to

R.0: 5.817764173314432e-03
R.1: 0.199999779
R.2: 0.142841665

or

R.0: 5,817764173314432e-03
R.1: 0,199999779
R.2: 0,142841665

depending on the user settings.

(03-31-2016 12:45 AM)bshoring Wrote:  After the next app update for RPN-38 CX, it shouldn't matter which decimal point setting you use.

It would be nice if the next update includes the last version of Trigs, the one that leaves sine in X. Sure, the library already includes Valentin Albillo's famous HP-12C Tried & Tricky Trigonometrics. Speed is not a problem anymore, but results in radians are rather inconvenient for those of us who use mostly degrees.

Best regards,

Gerson.
Gerson, I think some of those issues, with respect to radix may be addressed in the next update as well as some other improvements. I agee with you on Trig. I'd rather work in degrees. If you have any ideas, feel free to email Willy. He's a very nice guy and very responsive. Very open to suggestions and he just wants to make the best emulators he possibly can. Just don't ask him for anything Abdroid. He's not into that system.

I'm having fun with your trig programs. As a financial guy I didn't begin to learn about trig functions until a year or two ago. Your programs have been a good learning experience for me.

Thanks!


Regards,
Bob
Find all posts by this user
Quote this message in a reply
Post Reply 




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