Skip to content

Pedagogy: add distribution parameter sliders to 20_probability notebooks #385

@kwlee2025cpp

Description

@kwlee2025cpp

The 20_probability/ module currently has no interactive widgets. Distribution-parameter sliders are a natural fit — they're one of the textbook examples of "vary a parameter, see the shape change" that ipywidgets is designed for.

Scope

Targets: 20_probability/10_probability.ipynb, 20_probability/15_generating_random_numbers.ipynb, 20_probability/20_statistics.ipynb. Pick a subset for a first PR.

Per notebook: pick the central distribution covered and add sliders for its shape parameters, re-rendering the PDF (and CDF) as the user moves the sliders.

  • Normal: μ, σ → bell curve; show how σ stretches and μ shifts.
  • Binomial: n, p → discrete bars approaching normal as n grows (CLT preview).
  • Poisson: λ → discrete bars; show approach to normal for large λ.
  • Exponential: λ → memoryless decay.

Optional: empirical histogram from numpy.random overlaid on the analytic PDF, with a sample-size slider showing the histogram converging.

Why

Distribution shape vs parameter is the foundational intuition of probability. Sliders carry it directly; tables don't. The empirical-overlay variant also previews the law of large numbers without naming it.

Validated slider pattern (#353/#354). The module has no widgets today, so this is a whole-module uplift rather than a notebook-by-notebook fix — one PR can probably cover all three target notebooks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions