# [Maxima] difficulty with solve

Richard Fateman fateman at cs.berkeley.edu
Tue May 12 08:33:28 CDT 2009

```Raymond Toy wrote:
>>>>>> "Paul" == Paul Bowyer <pbowyer at olynet.com> writes:
>>>>>>
>
>     Paul> Hi David:
>     Paul> I understand the complexity, but I do actually need the symbolic
>     Paul> solutions, if there are any.
Of course there are:  there are 3 roots to a cubic polynomial. Can you
explain what you plan on doing with an expression
that takes 10 pages to print?  Putting it into a paper or inserting it
into a C program is a bad idea. Plotting it?
>  So, I'm looking for a response from someone
>     Paul> who is a Maxima expert that can tell me if there is a problem in solve,
>     Paul> especially when it just goes off and never returns, or returns with an
>     Paul> error message.
Possibly it runs out of memory on your computer, or you run out of
patience.  Or possibly you have encountered a bug (which is not
so terribly likely in this case)
>  For other expressions I've tried solve returns an empty
>     Paul> solution rather than an error message and does not seem to compute forever.
>
Solve should return an empty expression if there are no solutions.

> It's unfortunate that solve is so slow in this case.  But David
> Chappaz has given the necessary hints, I think, to get what you want.
>
> roots:solve(a*y^3+b*y^2+c*y+d,y);
>
> will give you the 3 roots you want in terms of a, b, c, and d.
>
> All you need to do is get a, b, c, and d from your original problem.
> You can do
>
> a : coeff(expand(det1),y,3);
> b : coeff(expand(det1),y,2);
> c : coeff(expand(det1),y,1);
> d : coeff(expand(det1),y,0);
>
> And then substitute these values into the messy result obtained from
> solve.
>

You might do better if you divide through by a, after convincing
yourself that it is not zero.
then you have y^3+B*y^2+C*Y+D,  only 3 parameters.

> But maybe just leaving the roots in terms of a, b, c, d is best.  You
> can easily substitute the desired coefficients in later.
>
>

You might also wish to vastly simplify the expression by linearizing it
with respect to some parameters.
RJF
```