3
$\begingroup$

Why am I seeing two different results below?

Solve[2 t^2 - 4.6 t + 1.2 - (1 - 4 t) (0.3 t - 1) == 3.2 t^2]
{{t -> -4.0082*10^16}, {t -> 0.247191}}
Solve[FullSimplify[2 t^2 - 4.6 t + 1.2 - (1 - 4 t) (0.3 t - 1)] == 3.2 t^2]
{t -> 0.247191}}
$\endgroup$
5
$\begingroup$

Up to machine precision, the "wrong" solution is indeed correct:

a = 2 t^2 - 4.6 t + 1.2 - (1 - 4 t) (0.3 t - 1) /. 
   t -> -4.008203668359741`*^16;
b = 3.2 t^2 /. t -> -4.008203668359741`*^16;
a == b
(a - b)/a < $MachineEpsilon

True

True

Taking the differences of both sides of the equation also shows us, why this happens:

2 t^2 - 4.6 t + 1.2 - (1 - 4 t) (0.3 t - 1) - 3.2 t^2 // Expand 

2.2 - 8.9 t - 2.22045*10^-16 t^2

So, this is really on the edge between quadratic and linear equations.

This tells us that we have to be cautious when solving in machine precision. Often, applying Rationalize to the equations before solving does also help.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.