# Stable Math

Stable Math is designed to allow for swaps between any assets that have the same price, or are "pegged" to the same asset. The most common examples are stablecoins that track US Dollars (DAI, USDT, USDC), and assets that track the price of Bitcoin (WBTC, renBTC, sBTC). Prices are determined by the pool balances, the

*amplification parameter*, and amounts of the tokens that are being swapped.Since the Stable Math equation is quite complex, determining the invariant,

$D$

, is typically done iteratively.$A\centerdot n^n \centerdot∑x_i+D=A \centerdot D \centerdot n^n+\cfrac{D^n+1}{n^n\centerdot\prod x_i}$

Where:

- $n$is the number of tokens
- $x_i$is balance of token
- $A$is the amplification parameter