Post Reply 
Most impressive/complex/amazing C-series program?
04-04-2018, 11:06 PM
Post: #1
Most impressive/complex/amazing C-series program?
What's the most impressive/complex/amazing/intricate/brilliant program for the 10C/11C/12C/15C/16C in your opinion and why?
Find all posts by this user
Quote this message in a reply
04-04-2018, 11:16 PM
Post: #2
RE: Most impressive/complex/amazing C-series program?
(04-04-2018 11:06 PM)michaelzinn Wrote:  What's the most impressive/complex/amazing/intricate/brilliant program for the 10C/11C/12C/15C/16C in your opinion and why?

Fast and Accurate Trigonometric Functions on the HP-12C

by Gerson Barbosa

Other programs for the 11C and 15C do more, but for the limited resources in the 12C, this is an amazing program and accomplishment.

If you think you know the 12C, spend time with this program and you will certainly learn more than you knew.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-05-2018, 11:30 AM
Post: #3
RE: Most impressive/complex/amazing C-series program?
It must be worth also mentioning Valentin Albillo's
HP-12C Tried & Tricky Trigonometrics (pdf)
as mentioned in this thread.
Find all posts by this user
Quote this message in a reply
04-08-2018, 02:29 AM
Post: #4
RE: Most impressive/complex/amazing C-series program?
(04-05-2018 05:17 PM)Mike (Stgt) Wrote:  The most nugatory?
Yes, a. m. routine uses three registers ...

What's an a.m. routine? I can see some tests in there, and a square root, but the concept's currently beyond me.

(Post 198)

Regards, BrickViking
HP-50g |Casio fx-9750G+ |Casio fx-9750GII (SH4a)
Visit this user's website Find all posts by this user
Quote this message in a reply
04-13-2018, 12:27 AM
Post: #5
RE: Most impressive/complex/amazing C-series program?
      
Hi, brickviking:

(04-08-2018 02:29 AM)brickviking Wrote:  What's an a.m. routine? I can see some tests in there, and a square root, but the concept's currently beyond me.

The code simply computes Pi using the formula:

      Pi = 2 * 2/sqrt(2) * 2/sqrt(2+sqrt(2)) * 2/sqrt(2+sqrt(2+sqrt(2))) * ...

which converges to the 10-digit representation of Pi (3.141592654) using just 17 terms. The algorithm is very clearly seen in this HP-71B equivalent command-line version

      >FIX 9 @ F=0 @ P=2 @ FOR I=1 TO 17 @ F=SQR(2+F) @ P=2*P/F @ NEXT I @ P

            3.141592654

If you want to see the convergence after each term, this simpler implementation I've independently concocted adds an intermediate stop (R/S) and removes the now unneeded test, decreasing the step count from 17 to 14:

      01-       35  CLx
      02-       36  ENTER
      03-        2   2
     *04-       34  X<>Y
      05-        2   2
      06-       40   +
      07-    43 21  SQR
      08-       10   /
      09-    43 36  LSTx
      10-       34  X<>Y
      11-        2   2
      12-       20   *
      13-       31  R/S
      14- 43,33 04  GTO 04

To run it in any HP-12C, set 9 decimals (f 9), go to the top of program memory (GTO 00), and use R/S to see the converging value after each new term, like this:

      f 9
      GTO 00
      R/S      -> 2.828427126
      R/S      -> 3.061467460
      R/S      -> 3.121445154
      R/S      -> 3.136548492
      R/S      -> 3.140331160
                  ---
      R/S      -> 3.141592648
      R/S      -> 3.141592652
      R/S      -> 3.141592654

After pressing R/S sixteen times the value has converged and there's no need to go on, any subsequent R/S would produce the same value (3.141592654) again.

      Note: the original code in the Code panel has one typo. Step 14 appears like this:

            14-43,33 00 RTN

      but though the keycode is correct, it should read GTO 00 instead of RTN, like this:

            14-43,33 00 GTO 00

      because that's what the keycode indicates and there's no RTN instruction in the HP-12C's instruction set as there's no subroutine (GSB) capability either.

Regards.
V.
      

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
04-13-2018, 02:32 PM (This post was last modified: 04-13-2018 02:35 PM by Gerson W. Barbosa.)
Post: #6
RE: Most impressive/complex/amazing C-series program?
(04-13-2018 12:27 AM)Valentin Albillo Wrote:        

      01-       35  CLx
      02-       36  ENTER
      03-        2   2
     *04-       34  X<>Y
      05-        2   2
      06-       40   +
      07-    43 21  SQR
      08-       10   /
      09-    43 36  LSTx
      10-       34  X<>Y
      11-        2   2
      12-       20   *
      13-       31  R/S
      14- 43,33 04  GTO 04

To run it in any HP-12C, set 9 decimals (f 9), go to the top of program memory (GTO 00), and use R/S to see the converging value after each new term, like this:

      f 9
      GTO 00
      R/S      -> 2.828427126
      R/S      -> 3.061467460
      R/S      -> 3.121445154
      R/S      -> 3.136548492
      R/S      -> 3.140331160
                  ---
      R/S      -> 3.141592648
      R/S      -> 3.141592652
      R/S      -> 3.141592654

      

On the HP-41C:

01 LBL "V"
02 2
03 STO Y
04 LBL 00
05 SQRT
06 ST/ Y
07 2
08 ST* Z
09 +
10 VIEW Y
11 STOP
12 GTO 00
13 END


Same usage (FIX 9, XEQ ALPHA V ALPHA, R/S, R/S...) and same results. Based on a 12-step program for the HP-12C by Katie Wassermann.

Gerson.
Find all posts by this user
Quote this message in a reply
04-14-2018, 01:13 AM
Post: #7
RE: Most impressive/complex/amazing C-series program?
(04-13-2018 10:47 PM)Mike (Stgt) Wrote:  Hit 16 times R/S?? No - please - no. A counter proposal (print from Emu42 on HP82240B Printer Simulator):
01▶LBL "V"
02 2
03 ENTER
04▶LBL 00
05 SQRT
06 STO÷ ST Y
07 2
08 STO× ST Z
09 VIEW ST Y
10 X=Y?
11 RTN
12 +
13 PSE
14 GTO 00
15 END


Note, I replaced STO Y before LBL 00 with ENTER. Start "V" and have a look. With a printer attached also there. Until it stop without any further ado.

BTW, on the HP-42S it takes few more iterations, on Free42 even several more. We warned, if you take the RAW from V41 to Emu42 the GTO 00 could jump not to LBL 00. Christoph is informed.

As you please:

00 { 30-Byte Prgm }
01▸LBL "V"
02 2
03 STO ST Y
04▸LBL 00
05 SQRT
06 STO÷ ST Y
07 2
08 STO× ST Z
09 X≤Y?
10 RTN
11 +
12 X<>Y
13 XEQ "FWIW"
14 X<>Y
15 GTO 00
16 .END.

2.8284271247461900976033
77448419396 ᴇ0
3.0614674589207181738276
7987224319 ᴇ0
3.1214451522580522855725
57895632356 ᴇ0
3.1365484905459392638142
58044436538 ᴇ0
3.1403311569547529123171
1852433169 ᴇ0
3.1412772509327728680620
19770788214 ᴇ0
3.1415138011443010763285
15059456822 ᴇ0
3.1415729403670913841358
00110270762 ᴇ0
3.1415877252771597006288
54262701918 ᴇ0
3.1415914215111999739979
71763740834 ᴇ0
3.1415923455701177423403
7599415737 ᴇ0
3.1415925765848726656816
06092237874 ᴇ0
3.1415926343385629890954
7826362779 ᴇ0
3.1415926487769856694851
07969277176 ᴇ0
3.1415926523865913458035
25521057964 ᴇ0
3.1415926532889927652719
4304217374 ᴇ0
3.1415926535145931201633
4824328108 ᴇ0
3.1415926535709932088877
18344859772 ᴇ0
3.1415926535850932310689
05795335812 ᴇ0
3.1415926535886182366142
08590772408 ᴇ0
3.1415926535894994880005
34660432656 ᴇ0
3.1415926535897198008471
16201022788 ᴇ0
3.1415926535897748790587
61587618764 ᴇ0
3.1415926535897886486116
72934358286 ᴇ0
3.1415926535897920909999
00771048824 ᴇ0
3.1415926535897929515969
57730221812 ᴇ0
3.1415926535897931667462
21970015082 ᴇ0
3.1415926535897932205335
380299634 ᴇ0
3.1415926535897932339803
6704495048 ᴇ0
3.1415926535897932373420
7429869725 ᴇ0
3.1415926535897932381825
01112133942 ᴇ0
3.1415926535897932383926
07815493116 ᴇ0
3.1415926535897932384451
3449133291 ᴇ0
3.1415926535897932384582
66160292858 ᴇ0
3.1415926535897932384615
49077532844 ᴇ0
3.1415926535897932384623
69806842842 ᴇ0
3.1415926535897932384625
74989170342 ᴇ0
3.1415926535897932384626
26284752218 ᴇ0
3.1415926535897932384626
39108647686 ᴇ0
3.1415926535897932384626
42314621554 ᴇ0
3.1415926535897932384626
43116115022 ᴇ0
3.1415926535897932384626
43316488388 ᴇ0
3.1415926535897932384626
4336658173 ᴇ0
3.1415926535897932384626
43379105066 ᴇ0
3.1415926535897932384626
433822359 ᴇ0
3.1415926535897932384626
43383018608 ᴇ0
3.1415926535897932384626
43383214286 ᴇ0
3.1415926535897932384626
43383263206 ᴇ0
3.1415926535897932384626
43383275436 ᴇ0
3.1415926535897932384626
43383278494 ᴇ0
3.1415926535897932384626
43383279258 ᴇ0
3.1415926535897932384626
4338327945 ᴇ0
3.1415926535897932384626
43383279498 ᴇ0
3.1415926535897932384626
4338327951 ᴇ0
3.1415926535897932384626
43383279514 ᴇ0
3.1415926535897932384626
43383279516 ᴇ0


Perhaps it is possible to do it without the external program FWIW (SHOW is not programmable).

Gerson.

P.S.: Here is a link to Katie Wasserman's original HP-12C program:

http://www.hpmuseum.org/cgi-sys/cgiwrap/...118#101119
Find all posts by this user
Quote this message in a reply
04-14-2018, 03:40 AM (This post was last modified: 04-14-2018 03:57 AM by Gamo.)
Post: #8
RE: Most impressive/complex/amazing C-series program?
To me the most impressive program is finding the root of unlimited polynomial equation that used the NPV IRR build-in functions in HP-12C was program by Valentin This is very amazing that it make 12C very powerful.
SOLVE for HP-12C is a nice one to have too. The Newton's Method program for 12C

Gamo
Find all posts by this user
Quote this message in a reply
04-14-2018, 09:29 AM
Post: #9
RE: Most impressive/complex/amazing C-series program?
(04-14-2018 05:31 AM)Mike (Stgt) Wrote:  
(04-14-2018 01:13 AM)Gerson W. Barbosa Wrote:  00 { 30-Byte Prgm }
01▸LBL "V"
...
13 XEQ "FWIW"
...

I assume this is a special one for Free42 only, as on HP-42S a FIX 11 before and a VIEW Y within the routine would be sufficient, wouldn't it?

Yes, that’s for Free42 only. VIEW Y on Free42 would exhibit only the first 12 significant digits. The FWIW program is mentioned in this thread, but it’s not available in the Free42 website anymore.

Gerson.
Find all posts by this user
Quote this message in a reply
04-14-2018, 10:14 AM
Post: #10
RE: Most impressive/complex/amazing C-series program?
(04-14-2018 09:29 AM)Gerson W. Barbosa Wrote:  Yes, that’s for Free42 only. VIEW Y on Free42 would exhibit only the first 12 significant digits. The FWIW program is mentioned in this thread, but it’s not available in the Free42 website anymore.

Hmm. Yes, I removed that program after I implemented full-precision Copy and SHOW, figuring those changes made it redundant. I didn't think about printing full precision, though. Gerson, if you could send me your copy, I'll put it back.
Visit this user's website Find all posts by this user
Quote this message in a reply
04-14-2018, 11:23 AM (This post was last modified: 04-14-2018 11:24 AM by Gerson W. Barbosa.)
Post: #11
RE: Most impressive/complex/amazing C-series program?
(04-14-2018 10:14 AM)Thomas Okken Wrote:  
(04-14-2018 09:29 AM)Gerson W. Barbosa Wrote:  Yes, that’s for Free42 only. VIEW Y on Free42 would exhibit only the first 12 significant digits. The FWIW program is mentioned in this thread, but it’s not available in the Free42 website anymore.

Hmm. Yes, I removed that program after I implemented full-precision Copy and SHOW, figuring those changes made it redundant. I didn't think about printing full precision, though. Gerson, if you could send me your copy, I'll put it back.


Here it is:


00 { 404-Byte Prgm }
01▸LBL "FWIW"
02 GTO 01
03▸LBL 00
04 "↓ bin≤16 dec≤34"
05 34
06 "↓ grouping size"
07 34
08 "↓ 1=SCI 3=ENG"
09 3
10 RTN
11▸LBL 01
12 REAL?
13 GTO 02
14 GTO 10
15▸LBL 02
16 X=0?
17 GTO 10
18 X<>Y
19 STO ".Y."
20 R↓
21 STO ".X."
22 R↓
23 STO ".Z."
24 R↓
25 STO ".T."
26 LASTX
27 STO ".L."
28 R↑
29 XEQ 00
30 STO ".M."
31 R↓
32 STO ".G."
33 R↓
34 1
35 -
36 STO ".J."
37 CLA
38 R↓
39 SIGN
40 LASTX
41 ABS
42 ENTER
43 LOG
44 ENTER
45 X≥0?
46 GTO 03
47 FP
48 X=0?
49 GTO 03
50 R↓
51 IP
52 1
53 -
54 ENTER
55▸LBL 03
56 R↓
57 IP
58 STO ".E."
59 RCL ".M."
60 MOD
61 STO- ".E."
62 STO- ".J."
63 R↓
64 RCL ".E."
65 10↑X
66 X=0?
67 GTO 08
68 ÷
69 ×
70 AIP
71 FS? 28
72 ├"."
73 FC? 28
74 ├","
75 LASTX
76 FP
77 RCL ".G."
78 X<>Y
79▸LBL 04
80 10
81 ×
82 AIP
83 FP
84 DSE ".J."
85 X=0?
86 GTO 06
87 DSE ST Y
88 GTO 04
89 ALENG
90 22
91 X≤Y?
92 GTO 05
93 X<>Y
94 RCL+ ".G."
95 X<Y?
96 GTO 05
97 R↓
98 LASTX
99 RCL+ ".J."
100 X≥Y?
101 ├"[LF]"
102▸LBL 05
103 ├" "
104 RCL ".G."
105 R↑
106 GTO 04
107▸LBL 06
108 ALENG
109 22
110 X≤Y?
111 GTO 07
112 10
113 POSA
114 X<0?
115 ├"[LF]"
116▸LBL 07
117 ├" ᴇ"
118 RCL ".E."
119 AIP
120 GTO 09
121▸LBL 08
122 "Went out of"
123 ├" range! :("
124▸LBL 09
125 AVIEW
126 CLA
127 RCL ".L."
128 STO ST L
129 RCL ".T."
130 RCL ".Z."
131 RCL ".Y."
132 RCL ".X."
133 CLV ".M."
134 CLV ".G."
135 CLV ".J."
136 CLV ".E."
137 CLV ".L."
138 CLV ".T."
139 CLV ".Z."
140 CLV ".Y."
141 CLV ".X."
142▸LBL 10
143 END
Find all posts by this user
Quote this message in a reply
04-14-2018, 01:14 PM
Post: #12
RE: Most impressive/complex/amazing C-series program?
Thanks! I put it back and also updated the annotated listing.
Visit this user's website Find all posts by this user
Quote this message in a reply
04-14-2018, 03:09 PM (This post was last modified: 04-14-2018 03:09 PM by Gerson W. Barbosa.)
Post: #13
RE: Most impressive/complex/amazing C-series program?
(04-13-2018 12:27 AM)Valentin Albillo Wrote:  
      Pi = 2 * 2/sqrt(2) * 2/sqrt(2+sqrt(2)) * 2/sqrt(2+sqrt(2+sqrt(2))) * ...

\(\pi\) and \(\sqrt{2}\) have always been close friends, it appears :-)


\(\frac{\rm{\pi}+{\rm{\pi}}^{2}+{\rm{\pi}}^{3}+{\rm{\pi}}^{4}-{\left({2}^{6}+{2}^{7}\right)}^{-1}}{\sqrt{2}}=100.0000001402465\)

The near-integer result above might be just a coincidence, though.

Gerson.
Find all posts by this user
Quote this message in a reply
04-15-2018, 12:31 AM
Post: #14
RE: Most impressive/complex/amazing C-series program?
(04-14-2018 03:09 PM)Gerson W. Barbosa Wrote:  
(04-13-2018 12:27 AM)Valentin Albillo Wrote:  
      Pi = 2 * 2/sqrt(2) * 2/sqrt(2+sqrt(2)) * 2/sqrt(2+sqrt(2+sqrt(2))) * ...

\(\pi\) and \(\sqrt{2}\) have always been close friends, it appears :-)


\(\frac{\rm{\pi}+{\rm{\pi}}^{2}+{\rm{\pi}}^{3}+{\rm{\pi}}^{4}-{\left({2}^{6}+{2}^{7}\right)}^{-1}}{\sqrt{2}}=100.0000001402465\)

The near-integer result above might be just a coincidence, though.

Gerson.

Dude, you must be exceedingly bored.... LOL.

Though I must admit that is a very suspicious looking number.... and most often, these are not coincidences, though looking again at the equation.... nah, you were just bored.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-15-2018, 01:37 AM
Post: #15
RE: Most impressive/complex/amazing C-series program?
(04-15-2018 12:31 AM)rprosperi Wrote:  Dude, you must be exceedingly bored.... LOL.

Though I must admit that is a very suspicious looking number.... and most often, these are not coincidences, though looking again at the equation.... nah, you were just bored.

You couldn’t be more right :-)

Fill the stack with pi, then repeat * + three times. It shouldn’t be difficult to recognize the first five significant digits. Divide by the square root of 2. Then press the square root key. That’s our 10.

pi 34 y^x pi EEX 12 * 3 / - EEX 16 / —> 7.9999999953

Ten more of these and we can make one of those nerd clocks. An original one.

Perhaps next time I get bored :-)
Find all posts by this user
Quote this message in a reply
04-15-2018, 09:51 AM (This post was last modified: 04-16-2018 03:41 PM by EdS2.)
Post: #16
RE: Most impressive/complex/amazing C-series program?
(04-14-2018 03:09 PM)Gerson W. Barbosa Wrote:  \(\frac{\rm{\pi}+{\rm{\pi}}^{2}+{\rm{\pi}}^{3}+{\rm{\pi}}^{4}-{\left({2}^{6}+{2}^{7}\right)}^{-1}}{\sqrt{2}}=100.0000001402465\)

The near-integer result above might be just a coincidence, though.
Remarkable. Wolfram Alpha offers
45/2 - 53/(4 π) - 18/sqrt(π) + (23 sqrt(π))/4 + 26 π≈100.000000140246501794
which is, I guess, the same number. [Edit: no, it's different]
Find all posts by this user
Quote this message in a reply
04-15-2018, 11:23 AM
Post: #17
RE: Most impressive/complex/amazing C-series program?
(04-15-2018 12:31 AM)rprosperi Wrote:  Dude, you must be exceedingly bored.... LOL.
Using your post as input.

I always think that bored people are boring as well. Instead I am amazed by the way Gerson, Valentin and others have a question or a path to find some formulas.

Like "ok, today I'll try to get the best approximation of 100 using combination of PI and square root, then refining with other numbers". What I appreciate in this case is the quest itself. Is that they have a quest to accomplish (that is pretty fancy when solved). Too many times I see people saying "I do not know what to do".

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
04-15-2018, 10:10 PM
Post: #18
RE: Most impressive/complex/amazing C-series program?
(04-15-2018 01:37 AM)Gerson W. Barbosa Wrote:  You couldn’t be more right :-)

Fill the stack with pi, then repeat * + three times. It shouldn’t be difficult to recognize the first five significant digits. Divide by the square root of 2. Then press the square root key. That’s our 10.

pi 34 y^x pi EEX 12 * 3 / - EEX 16 / —> 7.9999999953

Ten more of these and we can make one of those nerd clocks. An original one.

Perhaps next time I get bored :-)

This kind of mental/mathematical wandering has always made me wonder how much more interesting this kind of meandering would be with an infinite precision calculator. You could immediately tell if indeed you found some kind of sequence of consequence if it produced, e.g. 100 or 8 exactly for the types of problems listed above, or if they're just numbers that coincidentally look close to those numbers.

But of course, with an infinite precision calculator, you could simply press the "PI" button, then sit back, smile and relax, having very quickly accomplished an amazing feat indeed. Smile

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-15-2018, 11:58 PM
Post: #19
RE: Most impressive/complex/amazing C-series program?
Curious. On my Mac using "bc".

Code:

scale=500

pi=4*a(1)
(pi+pi^2+pi^3+pi^4-(2^6+2^7)^-1)/sqrt(2)
100.0000001402465485643435538654358155348292535185675836388305142940\
21874718088039643504074409446291082933664799360836642574325138079136\
97358242195961250129522853095557711449806699432867804248529345133033\
59652630055412228180509664524861498572421166990352185158080606832136\
23836556188625160710784246733785399167613787293233053952343171544792\
12367462994938966048698078961843540834555564764215350642957810850433\
57092407645335324807173127161654417402581881219560223971745507741352\
5588443957564911031670940936
Find all posts by this user
Quote this message in a reply
04-17-2018, 01:32 AM
Post: #20
RE: Most impressive/complex/amazing C-series program?
.
Hi, EdS2:

(04-15-2018 09:51 AM)EdS2 Wrote:  
(04-14-2018 03:09 PM)Gerson W. Barbosa Wrote:  \(\frac{\rm{\pi}+{\rm{\pi}}^{2}+{\rm{\pi}}^{3}+{\rm{\pi}}^{4}-{\left({2}^{6}+{2}^{7}\right)}^{-1}}{\sqrt{2}}=100.0000001402465\)

The near-integer result above might be just a coincidence, though.
Remarkable. Wolfram Alpha offers
45/2 - 53/(4 π) - 18/sqrt(π) + (23 sqrt(π))/4 + 26 π≈100.000000140246501794
which is, I guess, the same number. [Edit: no, it's different]

Indeed they're different:

    (\(\pi+\pi^2+\pi^3+\pi^4-(2^6+2^7)^{-1})/\sqrt{2}\) = 100.000000140246548564343[...]

45/2-53/(4\(\pi\))-18/\(\sqrt{\pi}\)+23\(\sqrt{\pi}\)/4+26\(\pi\) = 100.000000140246501794052[...]


Wolfram Alpha's attempt is very poor as it uses far too many digits (13, plus 4 instances of \(\pi\)) and operations (again, 13) to get a mere 9 digits, "100.000000".

V.
.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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