Convolution explorer
The law of a sum Z = X + Y of independent random variables by flip and slide: the learner drags z, watches the flipped density (or pmf) of Y slide across that of X, sees the product whose area (or sum of bars) is f_Z(z), the integration limits S_X ∩ (z − S_Y) and their breakpoints, and the traced f_Z checked against the named closed form (Poisson, binomial, gamma, normal, chi-squared ...). Parameter sliders and an example menu show when a family is closed under sums.
Used in: Introduction to Probability Theory
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | "Convolution: the law of X + Y" | Title bar text. Without it, a page whose controls omit label.convolution gets "The law of X + Y". |
| controls | string[] | all controls shown | Registry ids of the hideable controls to show (see `controls` in this file): the word "convolution" in the default title, the Var(Z) = Var(X) + Var(Y) identity, the integration limits, the nonzero-terms sentence, the terms table and the swap switch. Core ones always show. Absent = everything. Fitted per page by component_scopes.py, not by hand. |
| fX | object | string | Uniform(0, 1) (two fair dice when discrete = true) | Law of X, as {family, params} or a string such as "Poisson(3)", "Exp(rate=2)", "Gamma(shape=2, rate=0.5)" (sampling-core parser; categorical laws via {family: "categorical", values, probs}). X and Y must both be discrete or both continuous. |
| fY | object | string | same family as fX | Law of Y (independent of X). If only one of fX / fY is given, both use it. |
| laws | [law, law] | (none) | Alias for [fX, fY]. |
| discrete | boolean | false | Only used when no laws are given: true starts from two fair dice, false from two Uniform(0, 1). |
| presets | (string | {label, fX, fY, z})[] | (none) | Example menu. Built-in ids: uniform+uniform, uniform+exponential, normal+normal, exponential+exponential, exponential+exponential(different rates), gamma+gamma, chi-squared+chi-squared, poisson+poisson, binomial+binomial, bernoulli+bernoulli (alias coins), dice, geometric+geometric. When fX/fY are also given they appear first as "This example"; otherwise the first preset is shown. |
| z | number | middle of zRange (the preset's z for a preset) | Initial z (snapped to a support point of Z for discrete laws). |
| zRange | [number, number] | sum of the plotting windows of X and Y | Range of the z slider; the shared x/z axis covers it and both laws. |
| result | object | string | (recognised automatically) | A claimed law of Z drawn over f_Z (dashed curve or hollow points) with a match / no-match check. Without it, closed forms are recognised for normal, Poisson, binomial/Bernoulli (same p), gamma/exponential/chi-squared (common rate), negative binomial/geometric (same p) and Cauchy pairs; other pairs get a note (e.g. rates differ, not gamma). |
| showResult | boolean | true | Show the named or claimed law of Z and its note. |
| showLimits | boolean | true | Continuous: mark the integration limits l(z), u(z) on the product and the breakpoints on f_Z, with the max/min formulas. Discrete: say which k give nonzero terms. |
| showTerms | boolean | true | Discrete: table of the terms p_X(k), p_Y(z − k) and their products, with the sum. |
| editable | boolean | true | Parameter sliders for X and Y (families normal, uniform, exponential, gamma, chi-squared, Poisson, binomial, Bernoulli, geometric, negative binomial, Laplace, logistic, discrete uniform, beta). |
| allowSwap | boolean | false | Show a switch that flips X instead of Y (commutativity: the same f_Z appears). |
| swapped | boolean | false | Start with the swap switch on (X flipped and slid across f_Y); needs allowSwap. |
| trace | boolean | true | Draw f_Z strongly only up to the current z (it is traced as z sweeps); false draws all of it. |
| caption | string | (none) | Short note under the component ($...$ TeX allowed). |
PreviousNext