[VA] SRC #012a - Then and Now: Probability
|
11-02-2022, 10:56 PM
Post: #84
|
|||
|
|||
RE: [VA] SRC #012a - Then and Now: Probability
Hi, all, After 4 weeks to the day, it seems this SRC #012a has run its course, so time for a few additional comments and a few new results. The aditional comments Gjermund Skailand Wrote:This has been a very interesting thread. This is a sys-rpl version for HP50g of CReth SRC12a. On an actual HP50g the calculation time for the 30 60 problem is 5 min 21sec. p= 9.51234350207E-6 Thank you for your appreciation. Your SysRPL version looks amazing, kinda assembly language, producing the correct 12-digit result at least 10x faster than a physical HP-71B, which is truly awesome. Can someone please confirm that the listing is correct and will produce the stated result in the stated time ? Albert Chan Wrote:For S = R-1, we can treat triangle as without bottom edge (and the 2 corners) [...] It simplified to: Very nice exact symbolic result for that particular case, Albert Chan, congratulations ! Normally this could be construed as going against my stated rules but as you previously posted tons of actual HP-71B code, I'm not complaining. Werner Wrote:Well, to make Valentin's wishes come true, here's an entry that will solve the 30/60 problem on a real 42S, the only vintage RPN calculator able to do it. [...] Estimate of real 42S running time: 3h05m. Thank you very much, Werner, for taking my wishes into consideration and producing such a fine HP-42S solution. Your running time estimation on a physical HP-42S seems to be 3x slower than my solution running on a physical HP-71B but, as you say, optimization would probably reduce the timing considerably and some compromises had to be made to fit it into the available RAM. Nevertheless, running your program in Free42 on my Samsung tablet takes just 4.5 seconds, while still within the rules. The new results As I've stated oftentimes, one of my main goals is to get people who like vintage HP calculators to not consider them as obsolete gadgets only fit for collecting or nostalgia, with no real place in the real world, but as still useful devices which can indeed be used to solve modern problems and best of all, to improve one's sleuthing and programming abilities while attempting the solution, in the way of "Experimental Mathematics" (EM for short); quoting from Wikipedia:
--------------------------------------------------- 5 4 7.986111e-2 20 20 5.006369e-8 40 2.666558e-1 200 5.204890e-2 50 2.666660e-1 1000 6.666566e-2 60 2.666666e-1 2000 6.666667e-2 70 2.666667e-1 10 10 1.317953e-3 30 30 1.289121e-12 100 1.317596e-1 60 9.512344e-6 1000 1.333333e-1 120 1.694782e-3 240 1.531651e-2 300 2.225664e-2 480 3.539453e-2 960 4.368177e-2 P_lim(N) = 4/(3*N) Now we can check additional cases (say N = 7, 13, 22, ... rows) to see if the conjectured formula holds, and if it does we can attempt to find a symbolical proof for it, A. Chan-style ! So far this applies to the probability of being in the bottom row at the end of the walk, but what about the probability in the limit of being in a particular, single location as the number of steps grows indefinitely ? Adding this line to my program will display the resulting probability matrix which gives the probability for each and every grid point, using the FRAC$ keyword from the JPC ROM to output exact rational results:
Rows,Steps=5,100 -> 2.666667e-1
1/15 1/15 1/15 1/10 1/15 1/15 1/10 1/10 1/15 1/30 1/15 1/15 1/15 1/30
Now you may be wondering if there's some way to automatically get the exact probability matrix in the limit for a given number N of rows (for reasonable N and running times,) and indeed there is a simple procedure we might try out. First create a copy of my program and edit these five lines to be as follows:
15 MAT A=(2/(M*(M+1))) @ W=M-1 @ K=1E-6 @ FOR I=1 TO INF @ MAT B=ZER 70 NEXT Y @ NEXT X @ MAT A=A-B @ DIM A(M*M) @ DISP I;CNORM(A) @ IF RES<K THEN 80 75 DIM A(M,M) @ MAT A=B @ NEXT I 80 FOR I=1 TO M @ FOR J=1 TO I @ DISP FRAC$(B(I,J),6);" "; @ NEXT J @ DISP @ NEXT I Once the initialization is over the program then computes the probability matrix for steps 1, 2, 3, ...., comparing each matrix with the previous one. When the difference is less than a hardcoded tolerance (K=1E-6 at line 15) the process is over and the limit probability matrix is output in exact rational form.
Step Difference ---------------------- 1.000000 0.991667 2.000000 0.043056 3.000000 0.020833 4.000000 0.012770 ... 128.000000 0.000001 129.000000 0.000001 Limit Probability matrix: 1/315 2/315 2/315 2/315 1/105 2/135 ... 2/315 1/105 ... 1/105 2/315 1/315 2/315 ... ... ... 2/315 1/315 Now that we have a working program, we can create a simplified version which just checks the difference of the probability for only the top corner location (1,1) at successive steps, simply comparing A(1,1) vs. B(1,1) instead of considering the whole matrices, and once the tolerance is met we simply output B(1,1), the top corner's probability. If we run this simpler and faster program for various numbers of rows, we get:
------------------------------------------------------------------------------ P(1,1) 1/30 1/63 1/108 1/135 1/165 1/198 1/234 1/273 1/315
Well, I hope this has provided a good example of how you can use your vintage HP calc to do some sleuthing and get nice symbolic results in the spirit of Experimental Mathematics. Once you get the numeric results, conjecturing the symbolic ones and afterwards attempting to prove them is that much easier. Regards. V. All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 17 Guest(s)