Maxima's unacceptable error



Maxima has several different ways to solve equations.  If you want an exact
solution (when there is one), try solve:

  eq: (x-4)^2*(x-2)^3*(x-1)*(x+3)$
  solve(eq,x) => [x=2,x=4,x=-3,x=1]

If you want to find real roots numerically, use realroots, which in this
case produces exact results:

   realroots(eq,x) => [x=2,x=4,x=-3,x=1]

If you want to find complex roots numerically, use allroots:

    [x = 1.0,x = 4.273455E-5*%i+1.99996,x = 1.99996-4.273455E-5*%i,
     x = 2.00008,x = 3.99995,x = -3.0,x = 4.00005]

These roots differ from the exact roots by

    [7.77E-16, 6.02E-5, 6.02E-5, 8.49E-5,
     5.05E-5, 5.84E-11, 5.05E-5]

which is not bad for a numerical approximation in the complex plane. If you
follow the suggestion in the documentation for allroots and try
allroots(%i*eq), you get even closer, with the differences being:

   [4.0E-15, 3.46E-7, 1.74E-7, 1.73E-7,
    1.31E-9, 4.81E-15, 1.31E-9]

           -s


On Jan 2, 2008 10:44 PM, Jaime Robledo <robledo.jaime at gmail.com> wrote:

> In Maxima, the polynomial (x-4)^2*(x-2)^3*(x-1)*(x+3) has two complex
> roots
> and only one integer root. Try it yourself:
>
> %i1 (x-4)^2*(x-2)^3*(x-1)*(x+3);
> %i2 allroots(%);
>