[VA] Short & Sweet Math Challenge #25 "San Valentin's Special: Weird Math"
|
02-28-2021, 10:32 AM
(This post was last modified: 02-28-2021 11:09 AM by J-F Garnier.)
Post: #42
|
|||
|
|||
RE: [VA] Short & Sweet Math Challenge #25 "San Valentin's Special: Weird Math...
Now that the challlenge is closed, let me add some comments:
(02-28-2021 02:18 AM)Valentin Albillo Wrote: My original solution for "Concoction the Third: Weird Integral" Quote:The Sleuthing First, would you have used the Enhanced Math ROM, you could have just typed: >INTEG(1,P,0,GAMMA(LN(P^2-IX))/(GAMMA(LN(IX))+GAMMA(LN(P^2-IX)))) [ENDLINE] After all, you are the one who suggested the use of such shortcuts As I mentioned in my solution, the first aspect I noticed was the speed; I wasn't expecting to get a fast answer on a physical calculator of the 32S class for such complicate-looking equation combining the gamma and log functions. I also noticed that the speed and the answer were independent of the target accuracy (set by the display mode on the 32S - from FIX 1 to FIX 11). That was really weird. BTW, using a slow machine sometimes highlights some aspects that can be missed on faster systems such as Free42. Moving to the HP-71/Emu71, I investigated more: 30 Y=0 @ A=0 @ F=(1+SQR(5))/2 60 DEF FNF(X) 70 A=GAMMA(LN(F*F-X)) @ Y=A/(GAMMA(LN(X))+A) 90 PRINT X;Y 100 FNF=Y 110 END DEF 130 E=.0001 140 DISP INTEGRAL(1,F,E,FNF(IVAR)) 150 END >RUN 1.30901699438 .500000000007 1.09656781074 .169413871978 1.52146617801 .830586128022 1.19554981675 .328227901097 1.422484172 .671772098903 1.02655614795 4.82413106951E-2 1.5914778408 .951758689306 It turned out that only 7 samples were used, whatever was the target accuracy set by the E value. Having some knowledge of the Romberg algorithm, I recognized the first sample to be the midpoint, then the next two samples used for the 1st estimation and the last four samples used for the 2nd estimation. It was quickly obvious that the sample pairs (2-3, 4-5, 6-7) gave values that sum to exactly 1. That gave me the key for the explanation of the speed: the summation for any sample set was the same (and the exact one), so the algorithm reached its termination condition after the first two estimations. Extrapolating to a single sample at the midpoint, I got the symbolic answer: (φ-1) x 1/2 This is of course a consequence of the symmetry of the function to integrate as Werner and Valentin explained. It is interesting to note that my observations had also to do with the HP implementation of the Romberg algorithm: although the samples are non-uniform, they are symmetric relative to the midpoint, and that gave the effect I reported. Thanks for the challenge that was at the intersect of my interests for math puzzles and numerical algorithms (such as used in HP machines). J-F |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)