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 $ ax^2 + bx + c = 0 $ using the quadratic formula.

The formula is: $$ \Delta = b^2 - 4ac,\qquad x=\frac{-b\pm\sqrt{\Delta}}{2a} $$

Conditions and cases:

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

Inputs

Parameter
Default units
Description
a
Quadratic coefficient in $ax^2+bx+c=0$
b
Linear coefficient
c
Constant term

Outputs

Parameter
Default units
Description
x1
First real root (or the single root when $\Delta=0$)
x2
Second real root (blank when $\Delta\le 0$)