NewVersion 1.3

Natural Selection & Hardy-Weinberg

Watch beetles evolve as birds eat the ones they can see, count alleles, test Hardy-Weinberg, and see drift, mutation and gene flow change the allele frequency generation by generation.

Dark and light beetles on soot-dark bark where birds eat the light ones, the dark beetles blending in and the light ones standing out, beside the genotype counts against Hardy–Weinberg expectations and the dark allele’s frequency rising over 17 generations.

About this simulation

What does it mean for a population to evolve? Students watch a population of beetles change as birds eat the ones they can see, survivors pass on their alleles and the allele frequency moves. They count alleles, use p² + 2pq + q² to find carriers from a phenotype, see Hardy-Weinberg hold when nothing acts and watch drift shake small populations to fixation or loss. A Sandbox Population View sets the population size, each genotype’s fitness, mutation, migration and inbreeding, with p charted beside the no-drift expectation. Drift Tracks runs many populations at once against drift’s theory, and a Hardy-Weinberg Check samples a population and tests the gap with χ², counting the false alarms. The Advanced track adds χ² tests, fitness and mean fitness, heterozygote advantage, the variance of drift, effective size, mutation-selection balance, inbreeding and Kimura’s fixation probability. A concept challenge and a prediction lab with fresh numbers on every run round it out.

What you'll learn

  • Describe evolution as a change in allele frequency, p = (2n_AA + n_Aa)/2N, counted two alleles per individual, so that individuals do not evolve but populations do.
  • Explain that selection moves p in a steady direction when heritable variation changes survival, and that a rare recessive allele hides in heterozygotes.
  • Use Hardy-Weinberg as the baseline: with nothing acting, p holds and genotypes are p² : 2pq : q², and a dominant allele does not spread by itself.
  • Explain that drift moves p at random, most in small populations, until an allele is fixed or lost, and that migrants pull a population toward their source.

What you can do

  • Guided walkthroughStep-by-step, in Intro and Advanced tracks.
  • SandboxEvery control of the model, to explore freely.
  • Virtual labA realistic experiment with measurement noise and data analysis.
  • Concept checksQuestions about ideas and vocabulary, with no calculating.
  • PredictionCommit to a prediction, then see the result.
  • Classroom demoProjector mode and recordable clips for slides.
  • Works offlineA single downloadable file, verified to run without a network.

Before you start

  • Genes, alleles, dominance and the basics of inheritance
  • Probability and proportions
  • For the Advanced track: expected counts, the χ² test and the idea of a variance

Run or download

Run it in your browser

Nothing to install and no account. Works on laptops, Chromebooks, tablets, and phones.

Launch Natural Selection & Hardy-Weinberg

Download for offline use

One HTML file (748 kB) that opens in any modern browser with no network: for rooms with unreliable Wi-Fi, or to keep a copy.

Download the file
File details and checksum
File
natural-selection-hardy-weinberg-v1.3.html
Version
1.3, released November 28, 2026
Build
8ef0cf2
Size
766,046 bytes
SHA-256
d3d5847c94a5e7d75b4a38c4ff244ebd9b75fb869bf3c838926c78ad9cd1d393
Offline
Checked to run with all network access blocked.

The model and its limits

What the model assumes

  • One gene with two alleles, discrete and non-overlapping generations, and random mating, with each genotype surviving with probability proportional to its fitness.
  • Mutation acts in the gametes, a random share of each generation are migrants from a source population, and inbreeding changes genotype shares but not p.
  • Without drift (an infinite population, the dashed curves) the same steps act on genotype shares with no random draws.
  • Random numbers come from seeded streams, so a run repeats exactly, with binomial draws exact up to 1,000 trials and a rounded normal above that.
  • The heterozygote-advantage fitnesses (0.88, 1 and 0.14) are illustrative values of the size used in teaching, and the beetles are fictional.

What it leaves out

  • Overlapping generations, age structure, two sexes and sex-linked genes are left out.
  • More than two alleles, more than one gene and linkage between genes are not modeled.
  • Fertility selection, sexual selection and frequency-dependent selection are excluded: here fitness is survival only, and fixed.
  • There is no space, since every beetle can mate with every other, and the environment never changes during a run.

Cite this simulation

APA 7

Meier, D. (2026). Natural Selection & Hardy-Weinberg (Version 1.3) [Computer simulation]. Glidepath Science. https://glidepathscience.org/simulations/natural-selection-hardy-weinberg/

MLA 9

Meier, David. Natural Selection & Hardy-Weinberg. Version 1.3, Glidepath Science, 2026, glidepathscience.org/simulations/natural-selection-hardy-weinberg/.

AIP

D. Meier, Natural Selection & Hardy-Weinberg, version 1.3 (Glidepath Science, 2026), https://glidepathscience.org/simulations/natural-selection-hardy-weinberg/.

BibTeX

@misc{meier2026naturalselectionhardyweinberg,
  author       = {Meier, David},
  title        = {{Natural Selection & Hardy-Weinberg}},
  year         = {2026},
  publisher    = {Glidepath Science},
  version      = {1.3},
  note         = {Interactive simulation, version 1.3},
  howpublished = {\url{https://glidepathscience.org/simulations/natural-selection-hardy-weinberg/}},
  url          = {https://glidepathscience.org/simulations/natural-selection-hardy-weinberg/}
}

Credits and license

Created by Dr. David Meier, Glidepath Science.

Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0). You may share and adapt it for noncommercial purposes, such as teaching, with credit and under the same license. Licensing and reuse

AI tools (Claude, from Anthropic, and ChatGPT, from OpenAI) were used in developing Glidepath Science and its simulations. Dr. David Meier reviewed, edited, and modified every release version.