> ## Documentation Index
> Fetch the complete documentation index at: https://docs.raydium.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Algorithms

> Mathematical deep-dive chapter: the invariants, pricing formulas, and edge cases behind every Raydium product.

## Who this chapter is for

Protocol researchers, auditors, and advanced integrators who want to understand the *why* behind the math rather than just call the instructions. Product pages give a summary and defer here for derivations.

## Chapter contents

<CardGroup cols={2}>
  <Card title="Constant product (xy=k)" icon="function" href="/algorithms/constant-product">
    Invariant, marginal price, swap input/output formulas, slippage as a function of trade size.
  </Card>

  <Card title="CLMM math" icon="chart-line" href="/algorithms/clmm-math">
    Sqrt-price representation, liquidity ↔ amount conversion, single-tick swap step, fee-growth accumulator, multi-tick swap iteration.
  </Card>

  <Card title="Bonding curves" icon="arrow-trend-up" href="/algorithms/bonding-curves">
    LaunchLab's curve formula(s), graduation threshold derivation, continuous vs. discrete pricing.
  </Card>

  <Card title="Slippage and price impact" icon="percent" href="/algorithms/slippage-and-price-impact">
    Definitions, how SDK computes `minAmountOut`, what "price impact" means across AMM types, MEV considerations.
  </Card>

  <Card title="Token-2022 transfer fees" icon="coins" href="/algorithms/token-2022-transfer-fees">
    How a transfer-fee-bearing token changes the effective swap input and output amounts, and how the CPMM/CLMM programs handle it.
  </Card>

  <Card title="Impermanent loss" icon="scale-unbalanced" href="/algorithms/impermanent-loss">
    IL formulas for CPMM and CLMM, worked examples, and the break-even fee APR thresholds every LP should know.
  </Card>

  <Card title="Estimating CLMM APR" icon="chart-mixed" href="/algorithms/clmm-apr">
    How Raydium computes the APR shown on CLMM pools and how to project APR for a prospective range before opening it.
  </Card>
</CardGroup>

## Writing brief

* Use LaTeX-style math sparingly; show formulas as code blocks with inline prose.
* Every formula is followed by a worked numeric example.
* Every page has a "Where this is implemented" section that points to the relevant line range in the on-chain program source, for auditors.
* Do not re-derive the same formulas on product pages — link here.
