Wolfram Alpha:
Search by keyword:
Astronomy
Chemistry
Classical Physics
Climate Change
Cosmology
Finance and Accounting
General Relativity
Lagrangian and Hamiltonian Mechanics
Macroeconomics
Mathematics
Microeconomics
Particle Physics
Probability and Statistics
Programming and Computer Science
Quantum Field Theory
Quantum Mechanics
Semiconductor Reliability
Solid State Electronics
Special Relativity
Statistical Mechanics
String Theory
Superconductivity
Supersymmetry (SUSY) and Grand Unified Theory (GUT)
test
The Standard Model
Topology
Units, Constants and Useful Formulas
MonteCarlo Methods

The Monte Carlo method is just one of many methods for analyzing
uncertainty propagation, where the goal is to determine how random
variation, lack of knowledge, or error affects the sensitivity,
performance, or reliability of the system that is being modeled.
Monte Carlo simulation is categorized as a sampling method because
the inputs are randomly generated from probability distributions to
simulate the process of sampling from an actual population. So, we try
to choose a distribution for the inputs that most closely matches data
we already have, or best represents our current state of knowledge.
The data generated from the simulation can be represented as probability
distributions (or histograms) or converted to error bars, reliability
predictions, tolerance zones, and confidence intervals.
_{ } 
_{ }  
x_{1} y_{1}
x_{2} f(x) 
x_{3} y_{2}
_{ }  
_{ } 
1. Create a parametric model y = f(x_{1},x_{2},...x_{n})
2. Generate a random set of inputs x_{1},x_{1},...x_{n}
3. Evaluate the model and store the results as y_{n}
4. Repeat steps 2 and 3 for i = 1 to n
5. Analyze the results using histograms, summary statistics,
confidence intervals, etc.
Example: Compute the value of π
Inscribe circle inside square with sides x = 1, y = 1. Consider
upper right quadrant:
y

.
 .
1  .
 .
 .
 x
1
Area of quadrant = π/4
Area of square = 4
Generate random combination of x and y between 0 and 1. From
Pythagoras:
if √(x^{2} + y^{2}) <= 1 then count as a 'hit'. if √(x^{2} + y^{2}) > 1 then
count as a 'miss'.
4 * hits
π = 
(hits + misses)
It is simple to write a simple javascript program to do this:
var hits = 0;
var i = 0;
var pi = 0;
var x = 0;
var y = 0;
var hyp = 0;
for(i=0; i<=1000000; i++)
{
x = Math.random();
y = Math.random();
hyp = Math.sqrt((x*x)+(y*y));
if(hyp <= 1)
{
hits++;
}
}
pi = (4*hits)/i;
compute π