PPolySim OS

Comparative Advantage

Even if one country is worse at making everything, trade still makes both better off. Ricardo's counterintuitive result, made visible.

Comparative AdvantageLive

Controls

Presets

David Ricardo's great insight: even if one country is worse at making everything, both still gain from trade. Each should specialize in the good it gives up the least to produce — its comparative advantage — measured by the slope of its production-possibility frontier. Trade then lets both consume beyond their own frontiers.

▶ Run in Python

Data Inspector

A opp. cost (wine)0.50 cloth
B opp. cost (wine)2.00 cloth
A should makewine
B should makecloth

Governing equation

Reading this result: Country A gives up 0.50 cloth per wine versus B at 2.00, so A specializes in wine and B in cloth — trade then lets both consume beyond their own frontiers.

Runs locally in your browser — free forever. Scale to the cloud when reality gets heavy.

or unlock everything with Pro →
★ Sign in to save this setup
Save your tuned setup, or drop this simulation into your own site, docs, or course page.

How it works

Comparative advantage compares opportunity costs, not raw productivity. Each country should specialize in the good it sacrifices the least to produce — the flatter or steeper slope of its production-possibility frontier. Trading at a price between the two opportunity costs lets both countries consume beyond their own frontiers. It is the foundation of international trade theory.

Ask the AI about this model

The math, the assumptions, real-world uses, or a code translation — explained for this exact simulation.

More Economics simulations

Frequently asked questions

Is this comparative advantage gains from trade tool really free?
Yes. Comparative Advantage runs entirely in your browser using your device's own compute, so local use is free forever. You only pay Compute Tokens if you scale a job to the cloud.
Do I need to install anything?
No. Everything runs client-side in a modern browser — no downloads, no license, no account required to start.
Can I save or share my simulation?
Create a free account to save projects, and use a shareable embed or minted DOI to publish a live, interactive version anywhere.
How accurate are the results?
The solver uses established numerical methods, but results are for research and educational purposes and should be validated against experiment or professional review before you rely on them.