Solve a quadratic equation and report its real or complex roots using the discriminant.
用判别式求解一元二次方程的两个根。
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Quadratic formula | x = (−b ± √(b² − 4ac)) ÷ 2a | Viète 1615 / Babylonian completing-the-square |
| Discriminant | Δ = b² − 4ac: >0 two real, =0 repeated, <0 complex conjugate | Standard discriminant definition |
| Vieta's formulas | x1 + x2 = −b/a, x1·x2 = c/a | Viète 1615 |
| Numerically stable form | For large b use q = −(b + sign(b)√Δ)/2, x1 = q/a, x2 = c/q to avoid cancellation | Numerical Recipes §16.2 |