Solving Quadratic Equations with Maple

First we use the well known solution formula of the equation [Maple Math]

> x1 := -p/2 + sqrt((p/2)^2 -q);

[Maple Math]

> x2 := -p/2 - sqrt((p/2)^2 -q);

[Maple Math]

Now we test it with numerical values:

> p:=1: q:=-6:

> x1;

[Maple Math]

> simplify(%);

[Maple Math]

> simplify(x2);

[Maple Math]

Next we use the formula with algebraic expressions:

> p := 5*a-1: q := 6*a^2-a-2:

> x1;

[Maple Math]

> simplify(%);

[Maple Math]

To further simplify this expression, we need additional information about a, e.g.

> assume(a>=3);

> simplify(x1);

[Maple Math]

> simplify(x2);

[Maple Math]

What happens in the other case?

> assume(a<3);

> simplify(x1);

[Maple Math]

> simplify(x2);

[Maple Math]

Of course Maple can solve quadratic equations itself:

> restart;

> QE := x^2+p*x+q:

> solve(QE, x);

[Maple Math]

> p :=1:q:=-6:

> solve(QE, x);

[Maple Math]

> p := 5*a-1: q := 6*a^2-a-2:

> solve(QE, x);

[Maple Math]