This is actually for my TI-83+ calculator, but the problem can go to most any language. First, assuming the general equation:
Ax^2+Bx+C=0
and given A, B, and C it is possible to solve for X using the quadratic equations:
(-B + sqrt(b^2-4AC))/(2A)
and
(-B - sqrt(b^2-4AC))/(2A)
to find two answers. However some times there is only one answer and sometimes imaginary numbers. (This isn't my problem however). What I need to accomplish is factoring the equation down not using the quadratic equation. For instance:
X^2 - 4X + 4 = 0
down to:
(X - 2) (X - 2)
which is also
(X - 2)^2
This method is sometimes called FOIL, how can you accomplish this through programming? Please help.