## Archive of posts in May, 2023

### The distribution when indistinguishable balls are put into boxes

Suppose there are $n$ distinguishable boxes and $k$ indistinguishable balls. Now, we randomly put the balls into the boxes. For each of the boxes, what is the probability that it contains $m$ balls? This is a simple combanitorics problem that can be solved by the stars and bars method. It turns out that in the limit $n,k\to\infty$ with $k/n$ fixed, the distribution tends to be a geometric distribution.

- Categories: math
- Tags: probability, combinatorics, ruby

### Labeled

`break`

,`next`

, and`redo`

in RubyMany languages support breaking out of nested loops, such as Perl, Java, JavaScript, C#, etc. Languages that have

`goto`

can also do this easily. However, in most other languages, it is not easy to break out of nested loops. I want to introduce a way to do this in Ruby.- Categories: programming
- Tags: meta programming, ruby

### Free trade (single good case)

I set up a simple model to determine the production and consumption in free trade between nations.

- Categories: economics
- Tags: global economy, from zhihu

### A measure-theoretic formulation of statistical ensembles (part 2)

For sake of rigor and generalizability, I feel it necessary to try to have a mathematical formulation for statistical ensembles. I chose measure spaces as the underlying mathematical structure of thermal systems and tried to justify the method of statistical ensembles by deducing them from some axioms.

- Categories: physics
- Tags: mathematical physics, statistical mechanics, functional analysis, measure theory, probability, long paper