Comment on Soup of Theseus

<- View Parent
TranquilTurbulence@lemmy.zip ⁨1⁩ ⁨day⁩ ago

I thought of making a vector with a length of about 1.671398e+25, but then I remembered what one time when when I tried to make a linear model with hundreds of dimensions. So yeah… We have gigabytes of RAM, and it’s still not enough. Not really a problem, as long as you don’t try to do anything completely ridiculous.

Instead, I just made a variable that simply contains the number of soup molecules and another one for the number of water molecules. Far simpler that way.

Here’s where the magic happens:

# Number of soup molecules drawn
soup_molecules_replaced <- rbinom(1, replacement_count, prob_soup)

The rbinom function is used to generate random numbers from a binomial distribution. It’s a discrete probability distribution that models the number of successes, i.e. scooping out a soup molecule. Rest of the codes is just basic infrastructure like variables, loops, etc.

BTW the variable names look ugly, because I couldn’t be bothered to tidy everything up. I really prefer camelCase, whereas Mistral seems to prefer underscores. That’s what you get for vibing.

Side note: If you do this kind of stuff for private purposes, you have to rely on your own hardware. If you plan to publish your discoveries, universities and publicly funded supercomputers might be an option. If there exists a Journal Of Recreational Mathematics And Useless Simulations (JORMAUS), I could totally publish this stuff and maybe even run my code on a supercomputer.

source
Sort:hotnewtop