The approximation. The usual A-level shortcut for a weak acid HA assumes that (i) the only source of H⁺ is the acid's own dissociation, so [H⁺] = [A⁻], and (ii) so little of the acid dissociates that its concentration is barely changed, so [HA] ≈ [HA]₀. Substituting both into Ka = [H⁺][A⁻]/[HA] gives Ka ≈ [H⁺]²/[HA]₀, so [H⁺] = √(Ka[HA]₀) and pH = ½(pKa − log[HA]₀).
The exact model. No such assumptions are made. A single charge-balance equation, [H⁺] − [OH⁻] − [HA]₀·Ka/(Ka+[H⁺]) = 0, is solved numerically for pH at every concentration shown. This uses the real mass balance [HA]+[A⁻] = [HA]₀ (so [HA] is allowed to drop below [HA]₀ as dissociation proceeds) and includes water's own autoionisation ([H⁺] − [OH⁻] rather than just [H⁺]), so it stays correct even when the acid is extremely weak or extremely dilute and water's own contribution to [H⁺] is no longer negligible.
Where the approximation breaks down. Two things push the two curves apart: a large Ka relative to [HA]₀ (so a large fraction of the acid actually dissociates, breaking [HA]≈[HA]₀), and very low [HA]₀ (so [H⁺] from the acid becomes comparable to the ~10⁻⁷ mol dm⁻³ that water itself supplies, breaking [H⁺]=[A⁻]). The traditional rule of thumb is that the approximation is reasonable once [HA]₀/Ka ≳ 400 (dissociation below about 5%) — the "% dissociated" and badge in the solution panel track this directly. Try dragging [HA]₀ down at a fixed pKa and watch the two curves diverge as this ratio falls, or push pKa low (a strong-ish weak acid) and watch the same divergence appear at higher concentrations.
Constants used (25 °C). Kw = 1.0×10⁻¹⁴. Preset Ka values: methanoic acid 1.78×10⁻⁴ (pKa 3.75), ethanoic acid 1.74×10⁻⁵ (pKa 4.76), benzoic acid 6.28×10⁻⁵ (pKa 4.20), HCN 6.2×10⁻¹⁰ (pKa 9.21), phenol 1.0×10⁻¹⁰ (pKa 10.0).
Simplifications. Activity coefficients are ignored (concentrations stand in for activities); temperature fixed at 25 °C; only monoprotic weak acids are modelled.