# [Maxima] enforce real solutions

Raymond Toy toy.raymond at gmail.com
Fri Apr 27 10:51:53 CDT 2012

```On Fri, Apr 27, 2012 at 4:12 AM, andre maute <andre.maute at gmx.de> wrote:

> On 04/27/2012 01:08 PM, andre maute wrote:
>
>> On 04/27/2012 12:16 PM, Wilhelm Haager wrote:
>>
>>> Hi!
>>>
>>> Solving the equation
>>>
>>> solve(a*x**3+x*(1-x**2)=0,x);
>>>
>>> gives imaginary results:
>>>
>>> [x = -%i/sqrt(a-1),x = %i/sqrt(a-1),x = 0]
>>>
>>> I would like to have the results in the following form, i.e. real:
>>>
>>> [x = -1/sqrt(1-a),x = 1/sqrt(1-a),x = 0]
>>>
>>> assume(a<1) gives the desired result, but I require real solutions in
>>> automated calculations
>>> where I cannot make any assumptions in advance.
>>> Before the equation is solved, I cannot see what I have to assume.
>>>
>>> Is there a simple way (without subsequent maps and other tricky
>>> transformations) to enforce that?
>>> (algsys with realonly=true does not work in the desired way).
>>>
>> Doesn't the casus irreducibilis apply here?
>>
>> See http://en.wikipedia.org/wiki/**Casus_irreducibilis<http://en.wikipedia.org/wiki/Casus_irreducibilis>
>>
>
> Oh sorry, for the noise, x=0 is a solution.
>

I think this is still a valid point.  I assume Wilhelm is not just going to
solve that one equation.

Even in this example, I don't know how maxima can possibly tell what the
"right" expression would be.  The equation being solved reduces to
(a-1)*x^2+1 = 0.  The straightforward solution is x = sqrt(-1/(a-1)).  How
would maxima know that multiplying the equation by -1 and solving gives a