Simulates filling a cylindrical can
with a liquid, to find the height, h, of the liquid level,
and thus the free margin, x = H − h,
with H the can height. The can diameter, D,
its height, H, the mass of liquid, M,
and its density, ρ, are random variables,
each with a given distribution: (i) Gaussian, possibly truncated,
with μ, σ, and the truncation points,
xa and xb;
or (ii) (symmetrical) triangular, with μ, and semi-width a
given as σ (the remaining two values given but ignored).
For the Gaussian, truncation is ignored if
xa ≥ xb (such as both 0).
(See 'simulate several variables').
For the base data, the sought fraction is 33.1 %.
For the Monte Carlo simulation (at least 1000 trials),
a random number generator (RNG) seed of 0 (only) makes the
simulation irrepeatable. If 'classes' is 0, Sturges' rule is applied
(⌈log2 N + 1⌉).
Plots the histogram of the simulated x (f),
and its accumulated curve (F). |