comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: OT: IDL math problem solving
items: Re: OT: IDL math problem solving

OT: IDL math problem solving
type: item
description: Hi, this is not directly related to IDL and partially Off Topic. I found a nice quiz that I put together in a post here: http://blog.marchetto.de/opening-and-closing-lockers If you can't solve it, you can find the solution here: http://blog.marchetto.de/solution-opening-and-closing-locker s The graph that I put in the solution was made with IDL and the code can be found here: http://idl.marchetto.de/opening-and-closing-lockers/ The code is not particularly efficient (not at all!), but given the dimensions of the system, it takes longer to initialize the function graphics than computing with for loops. Please notice that the blog.* webpage is on a RaspPi in my cellar and runs rather slow... Be patient! Cheers, Helder
creator: Helder Marchetto
date: 2015-08-06T19:00:09-00:00

Re: OT: IDL math problem solving
type: item
description: On Thursday, 6 August 2015 12:00:11 UTC-7, Helder wrote: > Hi, > this is not directly related to IDL and partially Off Topic. > I found a nice quiz that I put together in a post here: > > http://blog.marchetto.de/opening-and-closing-lockers > > If you can't solve it, you can find the solution here: > > http://blog.marchetto.de/solution-opening-and-closing-locker s > > The graph that I put in the solution was made with IDL and the code can be found here: > > http://idl.marchetto.de/opening-and-closing-lockers/ > > The code is not particularly efficient (not at all!), but given the dimensions of the system, it takes longer to initialize the function graphics than computing with for loops. > > Please notice that the blog.* webpage is on a RaspPi in my cellar and runs rather slow... Be patient! > > Cheers, > Helder Cool! Fine explanations, and a lovely, clear graphic explaining it all. Thanks, Helder. Now, for a tangent to this tangent, anyone for code golf? (IDL is a fine language for this sport... http://en.wikipedia.org/wiki/Code_golf) Write IDL code to actually do this computation and print the numbers of the open lockers, using as few characters of IDL code as possible. Not looking for pretty or understandable code here! Here's my best shot: o=BYTARR(101)&FOR i=1,100 DO o XOR= INDGEN(101) MOD i EQ 0&PRINT, WHERE(o) (74 characters) I won't spoil the puzzle by printing the actual puzzle result here. Cheers, -Dick Dick Jackson Software Consulting Inc. Victoria, BC, Canada --- http://www.d-jackson.com
creator: Dick Jackson
date: 2015-08-07T02:13:55-00:00

Re: OT: IDL math problem solving
type: item
description: Hi Dick, I find the golf challenge very nice, but I think I cannot compete... without using dirty tricks :-) o=BYTARR(101)&FOR i=1,100 DO o XOR=INDGEN(101)MOD i EQ 0&print,WHERE(o) (71 chars) Spaces are so useless... I like your trick though. There's a lot to learn. Thanks for the (very short) solution. Since you like golfing... Here's another one: Check out http://idl.marchetto.de/calculating-buffons-pi/ It has to do with calculating pi (3.141592...) using a statistical method. The basic idea behind this is: Given a floor with equidistant parallel lines and a stick shorter than the distance between the floor lines, if you through this randomly lots of times and count how often you end up on a line, then you will be able to determine the number pi. I haven't even tried shortening the code. But I'm good at removing spaces ;-) Cheers, Helder On Friday, August 7, 2015 at 4:13:59 AM UTC+2, Dick Jackson wrote: > On Thursday, 6 August 2015 12:00:11 UTC-7, Helder wrote: >> Hi, >> this is not directly related to IDL and partially Off Topic. >> I found a nice quiz that I put together in a post here: >> >> http://blog.marchetto.de/opening-and-closing-lockers >> >> If you can't solve it, you can find the solution here: >> >> http://blog.marchetto.de/solution-opening-and-closing-locker s >> >> The graph that I put in the solution was made with IDL and the code can be found here: >> >> http://idl.marchetto.de/opening-and-closing-lockers/ >> >> The code is not particularly efficient (not at all!), but given the dimensions of the system, it takes longer to initialize the function graphics than computing with for loops. >> >> Please notice that the blog.* webpage is on a RaspPi in my cellar and runs rather slow... Be patient! >> >> Cheers, >> Helder > > Cool! Fine explanations, and a lovely, clear graphic explaining it all. Thanks, Helder. > > Now, for a tangent to this tangent, anyone for code golf? (IDL is a fine language for this sport... http://en.wikipedia.org/wiki/Code_golf) …
creator: Helder Marchetto
date: 2015-08-07T09:16:58-00:00