Venn Diagram Explorer
The learner types set expressions (or taps regions) to shade events on a 1-3 event Venn diagram with a value in every disjoint region, compares two expressions (De Morgan, containment), adds inclusion-exclusion terms one at a time while each region shows how often it is counted (with Bonferroni bounds), fills regions from known probabilities, conditions on an event, and runs the independence product check; inconsistent values show up as negative, hatched regions.
Used in: Introduction to Probability Theory
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | from the mode, e.g. "Events on a Venn diagram" | Title bar text. |
| events | number | string[] | object | ["A", "B"] | 1 to 3 events: a count (letters A, B, C), a list of names (a letter optionally followed by letters/digits, e.g. "E", "H1"), or an object mapping each name to its list of outcomes (outcome mode, with omega). |
| omega | (string | number)[] | union of the listed outcomes | Outcome mode: the sample space. Outcomes are written inside their regions and every event can be read as a set. |
| outcomeWeights | "uniform" | number[] | object | "uniform" | Outcome mode: weights per outcome (a list in omega order or an object keyed by outcome), normalised to total 1 in probability units; counts units count outcomes. |
| atoms | object | A 0.30, A∩B 0.15, B 0.25, outside 0.30 (2 events) | Value of each disjoint region. Keys: the letters of the events containing it ("A" = only A, "AB", "ABC"), or any expression of a single region ("A ∩ B^c"); "rest" = outside every event (default: whatever makes the total 1). |
| known | object | none | Known event values keyed by set expression, e.g. {"P(A)": 0.5, "P(B)": 0.4, "P(A ∩ B)": 0.2} or counts {"|A|": 50, "|Ω|": 100}. The region values are solved from them (free regions keep their defaults); a negative solution is flagged as an invalid assignment. |
| units | string | "probability" | "probability" (P(·), regions sum to 1) or "counts" (|·|, whole numbers). |
| layout | string | "overlap" | Two events only: "overlap", "disjoint" (A ∩ B is empty) or "subset" (the first event drawn inside the second). |
| layoutSwitch | boolean | false | Two events: let the learner switch the drawing between overlapping, disjoint and nested. |
| inputs | string | "events" with known, "none" in outcome mode or without values, else "atoms" | Sliders: "atoms" (one per region; the outside takes the remainder), "events" (P(A), P(B), P(A ∩ B), ...; regions recomputed and may go negative) or "none". |
| mode | string | "shade" | "shade": shade typed or tapped events; "inclusion-exclusion": add the terms of P(A ∪ B ∪ ...) one at a time with a per-region count. |
| modeSwitch | boolean | true | Show the Shade / Add terms switch in the title bar (2 or 3 events). |
| target | string | "A ∪ B" ("" with challenges) | Expression shaded first. Syntax: ∪ | or, ∩ & and, A^c A' not A, A ∖ B (or A - B), Ω, ∅, brackets; TeX (\cup, \cap, ^{c}) also works. |
| compare | string | none | Second expression, drawn on a second diagram; the verdict says equal, contained (with P(E) ≤ P(F)) or different, listing the regions that differ. |
| editable | boolean | true | Show the expression boxes and symbol buttons and let taps on regions edit the event. |
| given | string | none | Conditioning event (expression). Adds a 'Condition on ...' switch: outside fades, values inside are rescaled, and P(target | given) is shown next to P(target). |
| conditioned | boolean | false | Start with the condition switched on (needs given). |
| showProductCheck | boolean | false | Show P(A ∩ B) against P(A)P(B) for every pair (and the triple for 3 events) with an independent / pairwise / mutually independent verdict. |
| showBounds | boolean | false | Inclusion-exclusion mode: plot the Bonferroni partial sums (order 1 = union bound) against the union, alternating above and below. |
| fillSteps | boolean | false | Shade mode: hide the region values and let the learner fill them innermost first (Venn diagram method), each as a known value minus the regions already filled inside it. |
| step | number | 0 | Initial step: terms already added (inclusion-exclusion) or regions already filled (fillSteps). |
| challenges | {prompt, answer}[] | none | Exercises: the prompt (text with $...$ TeX) describes an event in words; the learner types or taps it and checks; the answer is any equivalent expression. |
| showValues | boolean | true | false hides every number (pure set algebra): no region values, sliders or probability readouts. |
| digits | number | 2 | Decimals for probabilities (0 to 4). |
| sliderStep | number | 0.01 (1 for counts) | Slider step. |
| controls | string[] | all controls shown | Ids of the hideable controls and text to show (see the controls registry: toggle.mode, readout.validity, readout.monotonicity). Core controls always show. Absent = everything. Fitted per page by tooling (component_scopes.py fit-nodes), not by hand. |
PreviousNext