91,156 reputation
15157391
bio website
location Oregon, USA
age
visits member for 2 years, 3 months
seen 1 hour ago

Happy New Year!


(also known as Spartacus)

Project Euler


See those two pins? Well today I'm going to... stick them in you.

Ok, let me come clean: Mr.Wizard is actually an alias of mine... I'm glad I can finally confess. ― Sjoerd C. de Vries

No, I'm Spatac... I mean, Mr.Wizard! ― R.M

I'm Mr.W, and so's my wife! ― acl


@Spartacus, it was not fixable. ― rcollyer

check again; I just fixed it. :-p ― Spartacus


"This is the internet, where the men are men, the women are men and the children are FBI agents..." ― yoda Dec 18 '11 at 6:06


"My main purpose of being here is in collecting the votes. I'd even go further and say that this is my main purpose in life." ― Leonid Shifrin


"I am making some voodoo dance and invoking the rain God while we talk" ― belisarius


Some people are fortunate. Others get married. ― belisarius


It's not that easy to do the untangling even manually though. – Szabolcs

Maybe you could turn it into a puzzle and let other people do the untangling :-) – Heike

I could make a web based game, and feed all my graphs to the visitors.
SE is a big game, isn't it? :D – Szabolcs


"ListContourPlot crush on simple 5-points data" (Question title)

"Yes, this must be love at first sight."ruebenko


... but I am working with a large body of code written by an incompetent fool (i.e. myself, several years ago...) – Simon Woods


I was tempted to edit your title: "Do rules rule?" But my nose is still bleeding as a result of a limerick. – belisarius



Apr
16
comment Mathematica not recognising closed forms as specific values
Closely related: mathematica.stackexchange.com/q/40080/121
Apr
16
comment Randomly selecting and reinserting a subset of elements in a list
My place2 seems to produce the same distribution over a series of 100,000 runs but I don't have proof. I look forward to your conclusions as your thinking smokes seem quite effective. :-)
Apr
16
comment Shift text upwards in graphics so characters with descenders clear horizontal lines
+1, but where is the code to generate this graphic? Is it from the documentation?
Apr
16
revised Randomly selecting and reinserting a subset of elements in a list
add optimized method
Apr
16
comment Randomly selecting and reinserting a subset of elements in a list
I'm afraid that your mother algorithm doesn't yield the same probability as the incremental insertion. Test it yourself. I hope you are able to fix that as I'll learn something.
Apr
16
comment Randomly selecting and reinserting a subset of elements in a list
@S22 Actually rasher's second method does not appear to have equivalent probability to this algorithm.
Apr
16
comment Randomly selecting and reinserting a subset of elements in a list
@S22 Yes, and yes. If your "deck" is not long this code is probably all you need. If you are dealing with very long lists (hundreds of thousands of elements) it will become slow because every Insert takes time proportional to the length of the list into which it is inserting. (See this related Q&A). rasher seems to have a way around this but I haven't examined it yet.
Apr
16
comment Randomly selecting and reinserting a subset of elements in a list
I accept that some of the things I do will make people laugh at me. :^) However I certainly do not stress performance above all else, and instead I am known for terse style (as you know). Nevertheless I do try to write fast code when it is not overly involved. Objectively I think computational complexity is is quite important as code should scale well. I am well aware that the repeated Insert in my code is a bottleneck with very long lists; it seems you found a way around that. :-)
Apr
15
comment Randomly selecting and reinserting a subset of elements in a list
Note: consider using DeleteCases[list, Alternatives @@ picked] -- your code as written with _?(MemberQ[picked, #] &) is very slow. e.g. pluck[Range@50000, 3000] // place takes 0.09 seconds here, while pluckReinsert[Range@50000, 3000] takes 7.1 seconds. This change brings it down to 1.7 seconds, and it's probably faster in later versions.
Apr
15
comment Randomly selecting and reinserting a subset of elements in a list
LOL --------------
Apr
15
comment Randomly selecting and reinserting a subset of elements in a list
This is essentially what I did, except that mine allows for duplicates to exist in the deck at the beginning, whereas DeleteCases will fail there.
Apr
15
revised Initialize table in a Module but Break if criteria not met
edited tags
Apr
15
comment Initialize table in a Module but Break if criteria not met
@brama Glad I could help. Thanks for the Accept.
Apr
15
revised Randomly selecting and reinserting a subset of elements in a list
deleted 1 characters in body
Apr
15
answered Randomly selecting and reinserting a subset of elements in a list
Apr
15
comment How do I randomly select 'k' positions in a list and shuffle their respective elements without effecting the other elements?
Funny, I've always written this operation listA[[set]] = RandomSample @ listA[[set]] -- it never occurred to me to shuffle the indices though the effect is equivalent.
Apr
15
revised Initialize table in a Module but Break if criteria not met
added 759 characters in body
Apr
15
comment Initialize table in a Module but Break if criteria not met
+1 for answering the question as written, but I'm guessing that brama cannot test only the end-points of the Table iterator.
Apr
15
revised Initialize table in a Module but Break if criteria not met
added 759 characters in body
Apr
15
answered Initialize table in a Module but Break if criteria not met