M.F. Miller Supply Co.
Back to Open Works
libraryMIT LicensePublished

dispersion-math

Zero-dependency Swift and TypeScript bivariate Gaussian golf shot dispersion probability library with shared numerical parity test vectors.

Why Publish the Core Math Openly?

Statistical golf advice should never be a black box. dispersion-math publishes the foundational bivariate Gaussian probability functions used to reason about club dispersion, safe-zone landing probabilities, and sample dispersion statistics—with zero external dependencies and shared cross-language numerical test vectors.

Included Primitives

  • normalCdf(x) — Deterministic normal cumulative distribution function with <7.5×10−8< 7.5 \times 10^{-8} maximum error.
  • gaussianBand(mean, sd, lo, hi) — Probability mass over a bounded target corridor.
  • probabilityInZone(club, scenario, shortSideBias) — Bivariate target probability combining longitudinal carry spread, lateral spread, and asymmetric short-side decay.
  • rankClubs(clubs, scenario) — Deterministic club ordering by target zone probability.
  • dispersionFromShots(shots) — Sample mean bias and unbiased sample standard deviations from logged shots.

Usage Example (TypeScript)

import { probabilityInZone, rankClubs } from "./ts/src/index.mjs";

const sevenIron = {
    id: "7i",
    name: "7 Iron",
    carryYards: 162,
    carrySd: 8.5,
    lateralSd: 10.0,
};

const scenario = {
    distanceToTargetYards: 160,
    safeZoneWidthYards: 28,
    safeZoneDepthYards: 26,
};

const probability = probabilityInZone(sevenIron, scenario);

To explore correlated bivariate distributions, polygon hazards, and aim optimization interactively, open the Shot Dispersion Explorer in the Lab.