Post Reply 
[VA] SRC#005- April, 1st Mean Minichallenge
04-24-2019, 08:54 PM
Post: #27
RE: [VA] SRC#005- April, 1st Mean Minichallenge
Hi Valentin,

(04-21-2019 08:38 PM)Valentin Albillo Wrote:  You're welcome, thanks to you for your interest and awesome posts on this minichallenge. And I agree with you, I'm also enthralled when I find an interesting piece of mathematics that happens to be new to me, so my goal has always been to post the kind of articles and challenges that I myself would like to read and solve.
[...]
I'm glad you enjoyed it all and thanks again for your extensive, very interesting post (from which I also learned interesting things) and for your time, much appreciated. Oh, and welcome to the new forum, for a very first post you did really great!

Wow, thanks for your appreciation!

Quote:
Quote:Why pick one of the original list elements to estimate the solution: we make no assumptions about the domain of \(f\). [...] This is cheaper than e.g. taking the arithmetic mean as an estimate or bracketing the solution by searching the minimum and maximum of {\(x_i\)}.

Cheaper or not, I would've used the minimum/maximum as they're immediately available without search using the available matrix functions and they certainly bracket the solution perfectly. [...]

OK. Replacing in GFM the
Code:
x 1 GET
section by
Code:
x « MIN » STREAM
x « MAX » STREAM
2 →LIST
supplies the required brackets to FINV, no other changes needed. This is all I came up with for the HP48GX. It seems, however, you have something more advanced in mind.

BTW, I unsystematically benchmarked both versions (GFM = original version, GFBM = bracketing version), using Emu48 on Android (authentic speed) to compute the generalized \(exp\) mean of a 100 element uniform random list 'V100':
Code:
1 RDZ             @ seed RAND
1 100 START
RAND
NEXT              @ 100 RANDs on stack
100 →LIST         @ convert to list
'V100' STO
Using an instrumented function counting the number of calls
Code:
0 'C' STO
V100
« 1 'C' STO+ EXP »
GFM   @ or GFBM respectively
shows indeed that bracketing reduces the number of function calls from 11 (12 with a different seed) to 8.

On the other hand, timing the original EXP function using an anonymous timing routine from hpcalc,
Code:
V100
« EXP »
« GFM »  @ or GFBM
XTGS
yields 3.055_s for GFM and 4.439_s for GFBM. Well, probably not too bad a trade of speed for reliability.

Best wishes, Mike
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC#005- April, 1st Mean Minichallenge - Mike (Austria) - 04-24-2019 08:54 PM



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