Quadratic function - real roots via the quadratic formula

Input data

A

B

C

Output data

X1

X2

Description

Computes the real roots of the quadratic equation ax2+bx+c=0ax^2 + bx + c = 0 using the quadratic formula.

The formula is:

Δ=b24ac,x=b±Δ2a\Delta = b^2 - 4ac,\qquad x=\frac{-b\pm\sqrt{\Delta}}{2a}

Conditions and cases:

  • Requires a0a \ne 0.
  • If Δ>0\Delta>0: two real roots x1x_1 and x2x_2.
  • If Δ=0\Delta=0: a single real root (returned in x1; x2 left blank).
  • If Δ<0\Delta < 0: no real roots (both outputs empty and a warning is emitted).

Inputs

ParameterDefault unitsDescription
aQuadratic coefficient in ax2+bx+c=0ax^2+bx+c=0
bLinear coefficient
cConstant term

Outputs

ParameterDefault unitsDescription
x1First real root (or the single root when Δ=0\Delta=0)
x2Second real root (blank when Δ0\Delta\le 0)