Notebooks, Scripts, and Parameters

Reproducible organization of simulations, parameters, results, and convergence.

Conceptual context

A physical simulation is not defined by code alone. Its result also depends on parameters, units, numerical method, environment version, initial conditions, and execution procedure. A notebook can combine explanation, data, plots, and results, while a script supports automation and repeated runs. Reproducibility means that another person can reconstruct the computational experiment and obtain a compatible yaproxy_aprox. Refining hh adds a crucial test: if ϵa\epsilon_{a} decreases regularly, the solution shows convergence rather than merely looking precise.

🟢 Essential level

A reproducible notebook or script acts as a digital laboratory record. It must state what was calculated, which parameters were used, which code version produced the result, and how outputs were generated. Inputs, procedure, and outputs should remain separate so execution order cannot silently alter the experiment.

yaproxy_aprox is not enough by itself: it must be compared with yrefy_ref and accompanied by ϵa\epsilon_{a}. To study convergence, the simulation is repeated with several hh values while every other setting remains fixed. In the method's useful regime, discrepancy decreases under refinement, and pp summarizes the rate of that decrease.

Every run should preserve parameters, units, versions, seeds, and output files. Another person can then reconstruct the calculation and distinguish genuine improvement from a hidden configuration change. A failed result also provides evidence when linked to its setup. Reproducibility does not prove that a model is physically correct, but it makes the model testable, comparable, and traceable.

🔵 Formal level

Basic formulas

The basic comparison between a computed result and a reference is:

Absolute error

εa=∣ya−yr∣\varepsilon_a=|y_a-y_r|

This defines ϵa\epsilon_{a} as the distance between yaproxy_aprox and yrefy_ref. Both values must represent the same quantity, use identical units, and correspond to the same physical state.

Within the asymptotic regime of a convergent method, error reduction is modeled by:

Convergence law

ε=Chp\varepsilon=C h^p

Here CC gathers problem- and method-dependent factors, hh measures resolution, and pp controls the slope on a log-log graph. Estimating the order uses ϵ1\epsilon_{1}, ϵ2\epsilon_{2}, h1h_1, and h2h_2, although a third resolution gives a stronger diagnosis.

Real student questions

Is a neat notebook automatically reproducible? No. It must run from a clean state with recorded dependencies.

Is a script better than a notebook? They serve different purposes. The notebook explains and explores; the script automates and reduces hidden state.

Why are several resolutions needed? One result does not reveal an error trend.

Can error increase when the step decreases? Yes, because of instability, roundoff, tolerances, or a poor reference.

Does convergence mean physical truth? No. It means stability with respect to discretization inside a model.

What should be saved? Code, parameters, units, versions, seeds, inputs, and outputs.

Final synthesis

A reproducible simulation is a complete computational experiment, not a final image. Refining hh, measuring ϵa\epsilon_{a}, and recording parameters distinguish accuracy, convergence, and physical validity. Notebooks, scripts, and configuration files turn temporary results into verifiable knowledge.

Formal development

This section is part of the complete theory. See the subscription options to access it.

🔴 Structural level

This section is part of the complete theory. See the subscription options to access it.

Deep physical interpretation

This section is part of the complete theory. See the subscription options to access it.

Order of magnitude

This section is part of the complete theory. See the subscription options to access it.

Personalized resolution method

This section is part of the complete theory. See the subscription options to access it.

Special cases and extended example

This section is part of the complete theory. See the subscription options to access it.

Cross-cutting connections and study paths

This section is part of the complete theory. See the subscription options to access it.