Calculations with context
Monte Carlo uncertainty propagation
Propagate declared independent mass and temperature-change distributions through a batch-energy model in kJ with fixed cp; compare seeded simulation with analytic moments.
Monte Carlo · From declared inputs to heat uncertainty
Explore a bounded batch-heating model. Choose hypothetical input distributions, follow reproducible samples through Q = m cp ΔT, then compare the simulated output with exact analytic moments.
Model and method
Imagine a small, isolated freshwater batch used in a shipboard training demonstration. The mass and temperature rise are not given as exact values. Here you assign their distributions explicitly. The program does not infer them from vessel records, sensors, repeated observations or a manufacturer specification.
For constant specific heat and no phase change, the sensible energy change is Q = m cp ΔT. Mass m is in kg, cp in kJ/(kg·K), and ΔT = Tfinal − Tinitial in K, so Q is in kJ. Positive Q denotes energy gained; a negative temperature change gives negative Q. This is batch energy. The separate cooling calculator uses mass flow ṁ and returns a rate Q̇ in kW. Replacing kg with kg/s changes the quantity being calculated.
Equating sensible energy change to supplied heat also requires a suitable system boundary and negligible other energy terms. Heat loss, phase change, changing cp, reaction, mixing, shaft work and heat-transfer dynamics are not computed. Numerical input bounds do not establish physical feasibility or single-phase conditions.
kg × kJ/(kg·K) × K = kJ
| Symbol | Meaning | Unit |
|---|---|---|
| m | Batch mass | kg |
| cp | Assigned constant specific heat | kJ/(kg·K) |
| ΔT | Signed final minus initial temperature | K |
| Q | Signed sensible energy change | kJ |
| N | Number of simulated trials | count |
| μ, V | Distribution mean and variance | quantity, quantity² |
A reproducible propagation experiment
- Declare bounded distributions for m and ΔT, choose fixed cp, and explicitly accept independence for this educational scenario. Uniform U(a,b) assigns equal density across its support. Triangular Tri(a,c,b) assigns its peak at mode c. These are modeling choices, not probability estimates extracted from data.
- For each trial, generate one unit variate for mass and one for temperature, transform them by the chosen inverse cumulative distributions, and evaluate the same energy equation. Equal endpoints represent a point mass, not a continuous density. Triangular mode may coincide with either endpoint.
- Summarize all N outputs with a mean, sample variance, standard deviation, histogram and interpolated empirical quantiles. The sample variance uses N−1. Quantiles use h=(N−1)p with linear interpolation between adjacent sorted values. Histogram bins span the analytic support; only the final bin includes its upper endpoint.
- Compare the simulation mean and variance with the exact formulas below. A small mismatch is expected for a finite run. Repeat with another seed or larger N to explore numerical sampling variation; this does not improve the quality of an unjustified physical model or input distribution.
An analytic check independent of simulation
For independent m and ΔT and fixed cp, the product moments are exact. μm and μT are input means; Vm and VT are input variances. The Vm VT term is retained, so this is not merely a first-order linearized uncertainty approximation.
Worked maritime teaching example
Original, synthetic shipboard batch example. The numbers are authored for instruction; they are not measurements of a real ship or standard properties for seawater.
| Quantity | Distribution | Analytic |
|---|---|---|
| Mass | Uniform [8,12] kg | μm = 10 kg; Vm = 4/3 kg² |
| Temperature rise | Triangular [4,6,8] K | μT = 6 K; VT = 2/3 K² |
| Specific heat | Fixed 4.18 kJ/(kg·K) | An assumed freshwater teaching value |
| Analytic mean | 4.18 × 10 × 6 | 250.8 kJ |
| Analytic variance | 4.18² × (8/9 + 48 + 200/3) | 2019.032888888889 kJ² |
| Output support | 4.18 × [8×4, 12×8] | [133.76, 401.28] kJ |
The diagrams show distribution shape on each input’s own horizontal scale. Vertical height is normalized for readability and does not compare density magnitudes. Exact support and moments appear in the table.
The analytic standard deviation is about 44.93365 kJ. With N=20,000, the nominal Monte Carlo standard error of the estimated mean is about 0.31773 kJ. These are different quantities: the first describes spread under assigned input uncertainty, the second describes finite-simulation precision under independent ideal draws.
The 2.5th–97.5th percentile span summarizes the assigned output distribution through finite samples. It is not a confidence interval for an unknown population mean, a guarantee of 95% real-world coverage, a tolerance limit or a safety margin. Quantile numerical error is not estimated by this tool.
Run the experiment
Choose the relationship and confirm the educational assumptions, then run.
Inputs stay in this calculator. No upload, network request or browser storage is used. A local CSV is created only by your explicit Download click.
Interpretation and limits
- A distribution must be justified by the actual information and measurement process before a real uncertainty statement is made. A plausible-looking triangle is not a substitute for calibration, repeated observations, traceability or expert review. The uniform/triangular choices here are explicitly educational.
- Independence is a joint-distribution assumption, stronger than simply observing small correlation. Shared instruments, ambient conditions, timing or a common calculation can create dependence. This calculator refuses dependent or unknown relationships. It does not silently substitute zero covariance, independent inputs or a correlation coefficient.
- Input uncertainty, incomplete physical modeling, and finite Monte Carlo error are distinct. Increasing N addresses only the last. Fixed cp means its uncertainty is omitted. Negative heat is a sign convention, not a physical feasibility check. No assertion about equipment capacity or operating safety is supplied.
- The named non-cryptographic PRNG is deterministic: the same normalized inputs, seed and model version reproduce the sequence regardless of chunk scheduling. This implementation expands the uint32 seed using SplitMix64, then runs xoshiro128** 1.1. Each trial consumes two open-interval 32-bit unit variates, including for degenerate inputs. Finite random-number resolution and floating-point rounding remain.
- N is bounded at 100,000. Sampling, block sorting and merging yield between bounded chunks; Cancel or an input edit abandons the old run. A replacement run owns the output. This is a fixed-N demonstration, not the adaptive numerical-tolerance procedure described in JCGM 101.
Primary methodology sources
General methodology only; this original lesson is not a reproduction or official implementation of a JCGM publication. Links checked 9 October 2026. No endorsement, laboratory validation or marine approval is claimed.
The calculation interface could not load. The example and explanation below remain readable; reload the page to recalculate.
Related context
The method explanation and worked example are on this page. The articles below provide additional context.
All calculators