ToolNestr

Natural Selection Simulator

Model how natural selection against a recessive phenotype shifts allele frequency generation by generation, using q(t+1) = q(1−sq)/(1−sq²), where s is the selection coefficient against the recessive homozygote. Two 3D diagrams compare a slowly-declining allele under weak selection to a rapidly-declining one under strong selection, and charts trace allele frequency across many generations.

Reviewed by the ToolNestr Editorial Team — July 2026

Disclaimer: This tool is provided for educational purposes to support learning in biology. It is not a substitute for professional laboratory, clinical, or diagnostic use.
Biology
Recessive allele frequency after N generations

Weak vs. strong selection

1. Weak selection

The recessive allele (amber) remains fairly common even after many generations.

2. Strong selection

The recessive allele becomes rare much faster under strong selection pressure.

Allele frequency over time

q over generations (your parameters)
Effect of selection coefficient (q0=0.5)

How it works

The core idea in one line: selection can only act on individuals it can actually see — and a recessive allele hiding inside heterozygous carriers is invisible to selection, which is exactly why a rare harmful recessive trait can survive selection pressure for far longer than intuition suggests.

q(t+1) = q(1−sq) / (1−sq²)

recessive allele frequency next generation, under selection against the recessive (qq) genotype

s = 0: no selection; s = 1: fully lethal/non-reproductive recessive genotype

selection coefficient range

When selection acts against a recessive phenotype, only homozygous recessive individuals (qq) are actually disadvantaged — heterozygous carriers (Aa) show the normal dominant phenotype and reproduce completely normally despite carrying the recessive allele. The recursive formula q(t+1) = q(1−sq)/(1−sq²) captures this generation by generation: it removes recessive alleles from the qq individuals each generation but leaves every copy hiding in Aa carriers completely untouched. As q shrinks, an ever-larger share of the remaining recessive alleles sit protected inside those carriers, which is exactly why the rate of decline slows dramatically once the allele becomes rare — no matter how strong the selection coefficient against the visible homozygotes actually is.

Worked example 1 — moderate selection against a recessive trait

Given: Starting recessive allele frequency q0 = 0.5, with a selection coefficient s = 0.5 against the recessive genotype.

Generation 1: q1 = 0.5(1−0.25)/(1−0.125) = 0.375/0.875 ≈ 0.429
Generation 2: q2 ≈ 0.371
Trend: the recessive allele frequency steadily declines, but more slowly each generation

Even with substantial selection pressure (s=0.5), the allele frequency drops noticeably slower each generation as it becomes rarer — selection against homozygotes gets weaker in effect as fewer of them exist to select against.

Worked example 2 — a fully lethal recessive allele (s=1)

Given: Starting recessive allele frequency q0 = 0.5, with complete selection (s=1) against the recessive genotype — every aa individual fails to reproduce.

Simplified formula: q(t+1) = q / (1+q), so 1/q(t+1) = 1/q(t) + 1
After 10 generations: q₁₀ = 1/(1/0.5 + 10) = 1/12 ≈ 0.083
Interpretation: even a fully lethal recessive allele still persists at over 8% frequency after 10 generations

This counterintuitively slow decline is a well-known result in population genetics — it explains why even severe recessive genetic diseases rarely disappear quickly from a population through selection alone.

Selection coefficient vs. speed of allele frequency decline

Starting from q0=0.5 in all cases, showing frequency after 20 generations.

Selection coefficient (s)q after 20 generations
0.1 (weak selection)≈0.31
0.5 (moderate selection) ★≈0.093
1.0 (complete/lethal selection)≈0.045

★ Reference row (worked example 1). Stronger selection accelerates the decline, but the rate of decline always slows down as the allele becomes rarer, regardless of how strong s is.

Where natural selection modeling actually matters

🦟 Pesticide and antibiotic resistance evolution

The same selection-coefficient math describes how quickly a resistance allele spreads (positive selection) or a susceptibility allele declines when pesticide or antibiotic pressure is applied to a population.

🧬 Genetic disease population modeling

Population geneticists use this model to predict how quickly (or how slowly) a harmful recessive allele's frequency might change under different selection pressures, informing genetic counseling and public health projections.

🐛 Industrial melanism (peppered moths)

The classic case of dark-colored peppered moths increasing in frequency during industrial pollution (better camouflage against soot-darkened trees) is a textbook real-world example of selection changing allele frequency over generations.

🌾 Agricultural pest and weed management

Farmers and agronomists model how quickly a herbicide- or pesticide-resistance allele might decline once a chemical is no longer used, informing crop rotation and resistance management strategies.

Common misconceptions

"Natural selection can always eliminate a harmful recessive allele quickly."

Selection against a recessive allele slows dramatically as the allele becomes rare, since most remaining copies hide inside unaffected heterozygous carriers — even strong, sustained selection can take many, many generations to substantially reduce a rare recessive allele's frequency.

"A selection coefficient of 1 means the allele disappears in one generation."

Even complete selection against the homozygous recessive genotype (s=1) only removes the qq individuals each generation — the allele itself persists in heterozygous carriers and declines gradually rather than vanishing immediately.

"Natural selection only acts on rare, harmful alleles."

Selection can act on alleles at any frequency and can favor as well as disfavor a trait — this model specifically describes selection against a recessive phenotype, but analogous models exist for selection favoring a dominant allele, heterozygote advantage, and other selection patterns.

"This model perfectly predicts real allele frequency trajectories."

This is a simplified, idealized model — it doesn't account for genetic drift, migration, mutation, changing environments, or interactions between multiple genes, all of which influence real allele frequency trajectories.

Formula sources & further reading

The formulas here are standard, traceable to:

  • OpenStax, Biology 2e — Chapter 20, "Evolution" (free, peer-reviewed). openstax.org
  • Hartl & Clark, Principles of Population Genetics — Selection theory chapter.
  • Futuyma & Kirkpatrick, Evolution — Natural selection and allele frequency change chapter.

q(t+1)=q(1−sq)/(1−sq²), iterated generation by generation. A discrete-generation, random-mating idealized model. Results are rounded for display.

How to use this calculator

1

Enter starting allele frequency

The recessive allele's frequency (q0) at the start of the simulation.

2

Enter the selection coefficient

How strongly selection acts against the recessive genotype, from 0 (none) to 1 (fully lethal).

3

Enter number of generations

The recessive allele frequency after that many generations solves instantly.

Related tools

Frequently asked questions

What is a selection coefficient?

The selection coefficient (s) measures how strongly selection acts against a genotype, ranging from 0 (no disadvantage) to 1 (fully lethal or non-reproductive) — a genotype with fitness (1−s) reproduces less successfully than genotypes with full fitness.

How does selection against a recessive homozygote change allele frequency each generation?

Using q(t+1) = q(1−sq) / (1−sq²), where q is the recessive allele frequency this generation and s is the selection coefficient against the recessive (qq) genotype.

Why does selection against a rare recessive allele act so slowly?

Once a recessive allele becomes rare, most copies of it are 'hidden' inside heterozygous carriers, who show the dominant phenotype and aren't affected by selection at all — this is exactly why eliminating a rare deleterious recessive allele from a population takes a very long time.

What happens with complete selection against a lethal recessive (s=1)?

The math simplifies to q(t+1) = q/(1+q), producing a much slower decline than intuition might suggest — even a fully lethal recessive allele can persist in a population for many generations once it becomes rare, since it keeps hiding in heterozygous carriers.

Does natural selection ever completely eliminate an allele?

Selection against a recessive allele approaches zero asymptotically but technically never reaches exactly zero in this idealized model — in real populations, genetic drift, mutation, or a heterozygote advantage can also keep an allele present indefinitely at low frequency.

All tool categories

🧬 Biology (50 tools)
🔳 Punnett Square Calculator✖️ Dihybrid Cross Calculator⚖️ Hardy-Weinberg Allele Frequency Calculator🐄 Codominance Calculator🌸 Incomplete Dominance Calculator📊 Chi-Square Goodness of Fit Calculator (Genetics)🔗 Recombination Frequency Calculator🔬 Sex-Linked Trait Punnett Calculator📜 DNA to mRNA Transcription Tool🧩 mRNA to Protein Translation Tool📐 GC Content Calculator🌡️ DNA Melting Temperature (Tm) Calculator🔄 Reverse Complement Sequence Tool🧫 PCR Primer Annealing Temperature Calculator📦 Surface Area-to-Volume Ratio Calculator (Cell Size)📈 Exponential Population Growth Calculator🌱 Logistic Growth / Carrying Capacity Calculator🌍 Population Density Calculator🦋 Shannon Diversity Index Calculator🔑 Michaelis-Menten Enzyme Kinetics Calculator🔺 Trihybrid Cross Calculator🧮 Genotype Frequency Calculator🪢 DNA/RNA Base-Pairing Calculator📖 Codon Usage Calculator✂️ Restriction Enzyme Cut-Site Finder💧 DNA Concentration (A260) Calculator🔎 Microscope Magnification Calculator⏱️ Bacterial Growth Rate Calculator⏳ Generation (Doubling) Time Calculator🌊 Serial Dilution Calculator🥼 CFU per mL Calculator📉 Microbial Growth Curve Plotter⚡ Energy Pyramid / 10% Rule Calculator🏷️ Mark-Recapture Population Estimator🪵 Biomass Calculator💦 Osmosis/Tonicity Predictor🔁 Cell Doubling Time Calculator🌿 Speciation Rate Estimator📋 Hardy-Weinberg Equilibrium Checker🦎 Natural Selection Simulator🐺 Predator-Prey (Lotka-Volterra) Simulator⚗️ Protein Molecular Weight Calculator🧵 Amino Acid Sequence Analyzer🧴 pH-Enzyme Activity Simulator☀️ Photosynthesis Rate Calculator🫁 Cellular Respiration Equation Balancer🎲 Genetic Drift Simulator🔀 Mitosis Stage Identifier🌳 Pedigree Chart Analyzer🌲 Simple Phylogenetic Tree Builder
🌐 Networking & IP Tools (36 tools)
🧮 Everyday (26 tools)
💪 Health & Fitness (30 tools)
💰 Finance (34 tools)
🔢 Math (23 tools)
📄 PDF Tools (10 tools)
🎨 Creators (12 tools)
💻 Developers (24 tools)
⚡ Engineering & Science (24 tools)
⚛️ Physics (48 tools)
🧪 Chemistry (50 tools)
🏠 Construction & Home Improvement (105 tools)
👗 Clothing & Garment Tools (68 tools)
🍳 Cooking & Baking (9 tools)
🚗 Automotive (26 tools)
🖼️ Image Tools (13 tools)
🔐 Security & Hash (15 tools)
📝 Text Tools (15 tools)
🔍 SEO Tools (11 tools)
🔄 Converters (69 tools)
🕐 Time & Date (15 tools)
📊 Chart Generators (11 tools)
🕌 Islamic Tools (16 tools)