Skip to main content

Jupyter

A Jupyter notebook puts executable code, Markdown explanations, equations, and saved output in one .ipynb document. Use it to change a parameter in a worked example and keep the resulting calculation or plot beside your explanation. JupyterLab adds a file browser, terminals, editors, and multiple notebooks around that format.

Try a calculation from this site​

These are public Markdown notes with Python code, not downloadable notebooks. Copy an example into your own notebook and keep its assumptions alongside the cells.

What to exploreStarting exampleWhat to change and observe
How precision affects the amount of data neededSample size formulaRun either independent standard-library example: the original inputs give 97 observations for a mean or 385 for a proportion. Halve the margin of error and compare the required count; this is approximate interval planning, not a guarantee against sampling bias.
How averaging changes a distributionCentral limit theoremWith NumPy and Matplotlib available in the notebook’s Python environment, vary sample_size from 30 to 100 and compare the histograms of exponential sample means. Keep the random seed when comparing runs. The theorem concerns sample means, not a claim that the underlying observations become normal.

Before running either example, record and pin the Python and package versions outside the notebook. Both examples generate or specify their inputs in code; if you substitute a dataset, record its source and use portable relative paths rather than machine-specific absolute paths. For an R notebook, pin the R environment in the same way.

Run again from a clean start​

The kernel is the process that executes code and remembers variables. Cells can appear in one order on the page but have been run in another. Saved output alone therefore does not prove reproducibility.

After changing an example, restart the kernel and run all cells from top to bottom. This reveals missing imports or values left over from earlier executions. Keep the parameters and explanation needed to interpret the new result. Treat large generated output as a build artifact when it does not belong in Git.

Notebooks suit exploration and explanation. When other programs begin to depend on the code, move reusable logic into ordinary source modules with tests, rather than relying on notebook execution order.

Where to go next​

Try Jupyter provides free demonstrations without a local installation. Create two cells where the second uses a variable from the first, run them out of order, then restart and run all. JupyterLite examples execute in the browser, so their available packages and kernel environment differ from a local Python installation.

Explore connectionsOpen network