Home > Python > Application in Statistical Mechanics

Ch. 21.2 Generate Different Variate from Uniform Variate

Chapters Index
Program 1

Generate Different Variate from Uniform Variate

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

The Central Limit Theorem (CLT)

The Central Limit Theorem (CLT) is a fundamental theorem in statistics that describes the behavior of the mean of a large number of independent, identically distributed (i.i.d.) random variables. In essence, the CLT states that the distribution of the sample mean approaches a normal distribution as the sample size increases, regardless of the original distribution of the data.

For a uniformly distributed variable \( U(a, b) \), the expected mean value \( \mu \) for a sample size \( n \) is calculated as:

\( \mu = \frac{a + b}{2} \)

Here, \( a = 0 \) and \( b = 10 \), so the expected mean is 5. The mean for each sample will approximate 5 as \( n \) increases.

Program 2

Generate Different Variate from Uniform Variate

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

Box-Muller transform from uniform to normal random series

Program 3

Generate Different Variate from Uniform Variate

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

Exponential variate from uniform variate

Program 4

Generate Different Variate from Uniform Variate

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

Exponential variate from uniform variate

Program 5

Generate Different Variate from Uniform Variate

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

uniform to normal distribution using central limit theorem

Theoretical Principles & Computational Physics Guide

Generate Different Variate from Uniform Variate: Statistical Physics & Stochastic Modeling

Dr. Alorika Chatterjee & Dr. Anirban Shaw Science & Physics Learners Python 3 / NumPy / SciPy

1. Core Principles & Theoretical Framework

Stochastic Processes: Simulates random physical phenomena including Brownian diffusion, radioactive decay, and thermal fluctuations.
Ensemble Averages: Computes macroscopic thermodynamic observables as statistical ensemble averages over microscopic configurations.
Monte Carlo Convergence: Statistical error scales inversely with the square root of trial count: $\sigma \propto 1/\sqrt{N}$.

2. Mathematical Formulation & Algorithmic Pipeline

Random walk diffusive spreading and Monte Carlo error scaling:

$$ \langle x(t) \rangle = 0, \quad \langle x^2(t) \rangle = 2 D t, \quad \text{Statistical Uncertainty: } \sigma_N = \frac{\sigma}{\sqrt{N}} $$

3. Numerical Mechanics & Implementation Logic

  • Random Number Seeding: Initialize pseudo-random generators with fixed seeds to ensure reproducible simulation results.
  • Ensemble Sampling: Execute $M$ independent trials of $N$ steps each to build accurate probability distributions.
  • Histogramming: Bin particle final positions to verify convergence toward Gaussian/Poisson distributions.

4. Relevant Computational Practice Exercises

Exercise 1
Simulate $M = 1000$ independent random walk trajectories and confirm that root-mean-square displacement scales as $\sqrt{t}$.
Exercise 2
Apply Monte Carlo integration to estimate $\pi$ using hit-or-miss circle sampling and plot error vs trial count $N$.
Exercise 3
Model radioactive nuclear decay for $N_0 = 10^4$ nuclei and compare against the continuous decay law $N(t) = N_0 e^{-\lambda t}$.
Standard Literature & References:
  • F. Reif, "Fundamentals of Statistical and Thermal Physics", Waveland Press (2009).
  • Mark Newman, "Computational Physics", University of Michigan (2013).