L2 · PAI-150

Where variation comes from

Run a batch, read the output distribution, identify which process parameter drives the spread, and reduce it.

01
Challenge

Try this first — before any explanation.

Run a batch of 200 parts and read the histogram of measured bore diameter. Some land outside your spec band — scrap. Get scrap below 2% by changing the process, not the tolerance. Three sliders: tool_wear, coolant_temp_drift, fixture_clamp_repeatability. The defaults give a skewed, drifting ~9%-scrap distribution — that asymmetry is your clue.

The Bench

The twin's batch generator in numpy: tool wear adds a ramping right-drift, coolant adds a centered bias, fixture adds symmetric scatter. Move the sliders and re-run to drop scrap.

USL)))\nhi = float(np.mean(ctq > USL)); lo = float(np.mean(ctq < LSL))\nprint(f'xbar={xbar:.4f} drift={xbar-NOMINAL:+.4f} sigma={sd:.4f}')\nprint(f'scrap={scrap:.1%} (high tail {hi:.1%}, low tail {lo:.1%})')","label":"2 — Run a batch (EDIT the sliders)"},{"code":"def hist(values, lsl, usl, bins=24):\n lo_e, hi_e = min(values.min(), lsl), max(values.max(), usl)\n edges = np.linspace(lo_e, hi_e, bins+1)\n counts, _ = np.histogram(values, edges)\n mx = max(counts.max(), 1)\n out = []\n for i in range(bins):\n c = edges[i]\n mark = 'L' if c <= lsl < edges[i+1] else ('U' if c <= usl < edges[i+1] else ' ')\n bar = '#' * int(counts[i]/mx*40)\n out.append(f'{c:7.3f}{mark}|{bar}')\n return '\\n'.join(out)\nprint(hist(ctq, LSL, USL))","label":"3 — ASCII histogram"},{"code":"# graded seed: fixture_repeat dominates (symmetric-wide), not drift.\ngctq = sample_batch(200, seed=520, tool_wear=tool_wear,\n coolant_drift=coolant_drift, fixture_repeat=fixture_repeat)\ngscrap = float(np.mean((gctq < LSL) | (gctq > USL)))\ngxbar, gsd = gctq.mean(), gctq.std(ddof=1)\ncentered = abs(gxbar - NOMINAL) < 0.006\nproblems = []\nif gscrap >= 0.02 and not centered:\n problems.append(f'mean {gxbar:.3f} is off-center (drift) - reduce tool-wear/coolant to recenter; tolerance wont help.')\nif gscrap >= 0.02 and centered:\n problems.append(f'mean centered but sigma {gsd:.3f} too wide (scatter) - the fixture-repeatability slider is your lever.')\nif fixture_repeat >= 0.03 and gscrap >= 0.02:\n problems.append('on this seed the spread is symmetric-wide: lower fixture_repeat, not tool_wear.')\n\nif gscrap < 0.02:\n print(f'PASS - scrap {gscrap:.1%} < 2.0% on the graded seed by reducing the correct (fixture) driver. '\n 'You read the shape, attributed the spread, and reduced it.')\nelse:\n print(f'FAIL (scrap {gscrap:.1%}) - ' + (problems[0] if problems else 'identify the dominant driver and reduce mainly that one.'))","label":"4 — Autograder (seed M3L2-GATE=520)"}],"intro":"The twin's batch generator in numpy: tool wear adds a ramping right-drift, coolant adds a centered bias, fixture adds symmetric scatter. Move the sliders and re-run to drop scrap.","key":"manufacturing/where-variation-comes-from","kind":"python","title":"Where variation comes from"}">
PYTHON · NUMPY · IN-BROWSER

Where variation comes from

The twin's batch generator in numpy: tool wear adds a ramping right-drift, coolant adds a centered bias, fixture adds symmetric scatter. Move the sliders and re-run to drop scrap.

02
Model

The idea, built visually.

You set the bore to twelve, so why does one part read 12.013 and the next 12.027? Measure enough parts and the chaos has a shape: a process outputs a distribution, not a number. Two things make that shape. Random variation — vibration, material, sensor noise — scatters parts symmetrically; you can shrink it, never zero it. Systematic variation has a cause and a direction: a tool wears so every part comes out a little bigger, coolant heats so metal grows. This doesn't scatter — it drifts, and drift pushes your tail over the spec line.

The skill is reading the shape to find the cause: symmetric-but-too-wide is scatter (look at the fixture); a whole distribution shoved off-center is drift (look at wear or heat).

▣ Stage animation: Measured values rain into bins building a live histogram; it splits into a symmetric RANDOM jitter and a SYSTEMATIC arrow dragging the whole bell rightward past the warm USL line, then recenters as the tool_wear lever drops and scrap falls 9%→1%.

03
Guided practice

Build it up, step by step.

  1. Step A (worked): read one histogram — x̄ = 12.041 (drift, shifted right), σ = 0.011, scrap 8.5% all on the high side (asymmetric → drift, not scatter).
  2. Step B (fade): fill a diagnosis checklist from your own histogram (mean centered? spread symmetric or one-sided?) then move the chosen slider.
  3. Step C (independent): a fresh hidden seed where fixture_repeat is the culprit (wide symmetric spread) — a learner who just memorized 'lower tool wear' fails and must read the shape.
04
Feedback

How the Bench grades your run.

PASS WHEN Scrap < 2.0% on the graded seed, achieved by reducing the correct dominant driver (verified by variance decomposition), with no more than one non-dominant slider moved materially, and the shape→driver mapping named correctly.

  • Mean is 12.041, 0.041 mm high — that's drift (systematic), not scatter. Lowering tolerance won't help; reduce tool-wear/coolant to recenter.
  • Mean is centered but σ = 0.024 is too wide — random scatter, not drift. The fixture-repeatability slider is your lever; tool-wear won't narrow a symmetric spread.
  • You lowered tool-wear, but here the spread is symmetric and tool-wear is <10% of scrap. Read the shape: symmetric-wide ⇒ fixture.
  • You drove all three sources to zero — that hits the target but isn't a diagnosis (and is physically unattainable). Reduce mainly the single dominant driver.
05
Retrieve & space

Bring back what you've already mastered.

  • From 3.1: if the process drifts right, does widening the band or recentering preserve function at lower cost? → recenter.
  • From M2: which process parameter most directly accelerates tool wear? → high feed/speed and depth-of-cut.
  • From M1: a flexible undrafted clamping surface increases which kind of variation? → random scatter (clamp repeatability).
06
Mastery gate

What you must demonstrate to advance.

On a fresh seed with an undisclosed dominant driver, drive scrap below 2.0% by reducing the correct driver (verified by variance decomposition), change no more than one non-dominant slider materially, and name the shape→driver mapping. Unlocks 3.3.

07
Project

How this feeds your build.

Feeds M5 directly: the x̄ and σ read here are the inputs to Cpk = min(USL−x̄, x̄−LSL)/(3σ); M5 turns reading-and-reducing σ and centering x̄ into a yield number.