Feigenbaum for the HP15C [LONG] Message #4 Posted by Valentin Albillo on 4 June 2004, 6:48 a.m., in response to message #1 by Valentin Albillo
Hi,
Just to prove the point, here's a conversion of my 4liner HP71B program to the HP15C !
Despite the obvious (and large) differences in language level (lowlevel RPN vs. highlevel BASIC), numerical precision (10digit vs. 12digit) and above all, speed (1530x slower), the HP15C is perfectly up to the task, delivering Feigenbaum's constant correct to 4 digits in 18 min., which fares well compared to the 71B results (6 digits in 3.3 min.).
Also, the HP15C program is much more compact, at 60+ bytes (47 steps) versus 71B's 174 bytes (4 multistatement lines), i.e. just 1/3rd the size (RPN strikes again!). Listing follows with a few pertinent comments:
01 LBL A 14 LBL 0 25 RCL 1 36 GTO 0
02 MATRIX 1 15 2 26 RCL 4 37 RTN
03 CLX 16 STOx 5 27 RCL 0 38 LBL 1
04 STO 1 17 RCL 0 28 / 39 RCL 5
05 7 18 RCL 1 29 STO 2 40 STO 6
06 STO 3 19 RCL/ 2 30 R/S 41 CLX
07 2 20 RCL+ 0 31 RCL 0 42 LBL 2
08 STO 5 21 ENTER 32 STO 1 43 X^2
09 3.2 22 SOLVE 1 33 RCL 4 44 
12 STO 2 23 STO 4 34 STO 0 45 DSE 6
13 FIX 6 24 RCL 0 35 DSE 3 46 GTO 2
47 RND
To use, simply press RUN with no inputs. The program will compute and display the increasingly accurate value of Feigenbaum's constant for each iteration, stopping for you to see it. Press R/S to go on with the next iteration. After completing all 7 iterations, the program will stop displaying the last computed superstable a value, a = 1.401146+, which is the SOLVEd root of the corresponding 256thdegree polynomial.
Results:
Iteration F value Iteration time

1 3.218510 17 sec.
2 4.385687 50
3 4.600945 65
4 4.655086 83
5 4.666256 162
6 4.667830 234
7 4.669803 477
Last result is 4.669+, accurate to 4 digits within 1 ulp.
Notes:
 As the HP15C uses 10digit precision instead of HP71B's 12digit, we can't get a result accurate to more than 45 significant digits, so just 7 iterations will suffice. Besides, we don't need to find the highdegree polynomials' roots to full 10digit precision, thus steps 13 FIX 6 and 47 RND provide early termination for 22 SOLVE 1, saving much time at no cost in final accuracy.
 The highdegree polynomial that is being SOLVEd is computed at steps 3847. Notice the very tight loop 4246 which is once again a superb practical demonstration of classic RPN's stack capabilities at its best: no matter how high the degree of the polynomial, the repeated subtraction at step 44 never exhausts the provision of a values, thanks to toplevel replication, where T is replicated continuously as the stack drops and drops. If literally coded in RPL this loop would collapse the stack in no time !
 The ever bigger polynomials' roots are found using the powerful SOLVE instruction at step 22. In a running program, SOLVE behaves like a test: if a root is found, the next step is executed, else it is skipped. Normally this must be taken into account, but for this particular program, the root always exists and SOLVE always finds it for the number of iterations considered, so there's no need to code the possibility of it failing.
 Last but not least, notice how every advanced feature of the HP15C instruction set helps to reduce step count and increase speed, from the matrix instruction at step 02, to recall arithmetic everywhere, to being able to use any numbered register for loop indexing purposes.
In conclusion, I hope you'll agree that the mere fact that this kind of computation is feasible in the HP15C in reasonable times and with such a small, simple program, is but another proof of the outstanding quality of this wonderful machine. As "Moulin Rouge!"'s Zidler himself would say on behalf of the HP15C: "A magnificent, opulent, tremendous, stupendous, gargantuan success"
Best regards from V.
Edited: 4 June 2004, 7:55 a.m.
