No Stupid Questions
No such thing. Ask away!
!nostupidquestions is a community dedicated to being helpful and answering each others' questions on various topics.
The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:
Rules (interactive)
Rule 1- All posts must be legitimate questions. All post titles must include a question.
All posts must be legitimate questions, and all post titles must include a question. Questions that are joke or trolling questions, memes, song lyrics as title, etc. are not allowed here. See Rule 6 for all exceptions.
Rule 2- Your question subject cannot be illegal or NSFW material.
Your question subject cannot be illegal or NSFW material. You will be warned first, banned second.
Rule 3- Do not seek mental, medical and professional help here.
Do not seek mental, medical and professional help here. Breaking this rule will not get you or your post removed, but it will put you at risk, and possibly in danger.
Rule 4- No self promotion or upvote-farming of any kind.
That's it.
Rule 5- No baiting or sealioning or promoting an agenda.
Questions which, instead of being of an innocuous nature, are specifically intended (based on reports and in the opinion of our crack moderation team) to bait users into ideological wars on charged political topics will be removed and the authors warned - or banned - depending on severity.
Rule 6- Regarding META posts and joke questions.
Provided it is about the community itself, you may post non-question posts using the [META] tag on your post title.
On fridays, you are allowed to post meme and troll questions, on the condition that it's in text format only, and conforms with our other rules. These posts MUST include the [NSQ Friday] tag in their title.
If you post a serious question on friday and are looking only for legitimate answers, then please include the [Serious] tag on your post. Irrelevant replies will then be removed by moderators.
Rule 7- You can't intentionally annoy, mock, or harass other members.
If you intentionally annoy, mock, harass, or discriminate against any individual member, you will be removed.
Likewise, if you are a member, sympathiser or a resemblant of a movement that is known to largely hate, mock, discriminate against, and/or want to take lives of a group of people, and you were provably vocal about your hate, then you will be banned on sight.
Rule 8- All comments should try to stay relevant to their parent content.
Rule 9- Reposts from other platforms are not allowed.
Let everyone have their own content.
Rule 10- Majority of bots aren't allowed to participate here. This includes using AI responses and summaries.
Credits
Our breathtaking icon was bestowed upon us by @Cevilia!
The greatest banner of all time: by @TheOneWithTheHair!
view the rest of the comments
Interesting. I don't know why I didn't think of just keeping a count of soup molecules. Must have been late!
Another interesting point, your simulation is subtly wrong in a different way from my calculation. When there is only one soup molecule left, there is a chance (however tiny) that
rbinom
will return 2 or more, taking out more soup molecules than there really are.If you run it enough times with a bowl of 3 molecules and a spoon of 2 molecules, I'm sure you'll hit -1 soup molecules some of the time.
For a simulation I think we can do better. There must be a random function that does it properly. The function we want is like pulling balls of 2 colors out of a sack without replacement. Pretty common combinatorics question, I would expect a random function to match.
You’re right. I just ran rbinom 1E7 times and found that the probability of over drawing soup molecules is a bit too high for my taste.
When there’s only 1 left, you usually end up drawing 0 or 1 molecule. However, in rare cases, it can be higher, such as 2, 3, 4… molecules.
About 92% was 0, and 7.7% was 1, but the others were not negligible! There’s about 0.3% probability of over drawing, which is way too high for a simulation as serious as this one. In this quick test, there were 20 incidents where rbinom wanted to pull out 4 soup molecules when only 1 was available. We can’t have that, now can we!
In python the closest I could find was (untested): sum(random.sample([1, 0], spoon_size, counts=[soup_count, water_count]))
But this would create an intermediate list of length spoon_size which is not a good idea.
/u/TranquilTurbulence@lemmy.zip fairly sure the distribution you should use is hypergeometric distribution, found via urn problem.
Hmmm.. The description certainly fits. Just by eye-balling the graphs, they look very different from what I got, but I guess that's just the expected result of running rbinom about a 6 million times. With a smaller simulation, it might not have been so apparent. Also, that's what you get for skipping the maths and vibing the code without thinking too much about the details. Well, at least i got this far with absolutely minimal effort. :D
It appears that I need to switch to a better distribution. Thanks for looking into this mystery!