[newbie] removing complex solutions



Yes, assume(%beta>0).  For example:

(%i1) urb: x*ui/(x*(1-x)*%beta+1);
(%o1) ui*x/(%beta*(1-x)*x+1)
(%i2) deltaurb: ui*x-urb;
(%o2) ui*x-ui*x/(%beta*(1-x)*x+1)
(%i3) dd: diff(deltaurb,x);
(%o3)
-ui/(%beta*(1-x)*x+1)+ui*x*(%beta*(1-x)-%beta*x)/(%beta*(1-x)*x+1)^2+ui
(%i4) dds: solve(dd,x);
(%o4) [x =
(-sqrt(3)*%i/2-1/2)*(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3)

+(sqrt(3)*%i/2-1/2)*(%beta+9)/(9*%beta*(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3))+2/3,
       x =
(sqrt(3)*%i/2-1/2)*(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3)

+(-sqrt(3)*%i/2-1/2)*(%beta+9)/(9*%beta*(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3))+2/3,
       x =
(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3)+(%beta+9)

 /(9*%beta

*(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3))+2/3,
       x = 0]
(%i5) assume(%beta>0)$
(%i6) ddsr: map(rhs,dds);
(%o6)
[(-sqrt(3)*%i/2-1/2)*(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3)

 +(sqrt(3)*%i/2-1/2)*(%beta+9)/(9*%beta*(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3))+2/3,

(sqrt(3)*%i/2-1/2)*(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3)

 +(-sqrt(3)*%i/2-1/2)*(%beta+9)/(9*%beta*(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3))+2/3,

(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3)+(%beta+9)

 /(9*%beta*(sqrt(-(%beta^2+9*%beta+27)/%beta)/(3^(3/2)*%beta)-1/27)^(1/3))
                                                                     +2/3,0]
(%i7) imagpart(ddsr);  *** Yuck, a big mess ***
(%o7)
[(%beta+9)*(sin((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/(2*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6))

+sqrt(3)*cos((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)
                  /(2*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)))
        /(9*%beta)

 -(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*sin((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/2

 -sqrt(3)*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*cos((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/2,

(%beta+9)*(sin((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/(2*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6))

-sqrt(3)*cos((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)
                  /(2*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)))
        /(9*%beta)

 -(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*sin((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/2

 +sqrt(3)*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*cos((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/2,

(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*sin((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)

 -(%beta+9)*sin((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/(9*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*%beta),
       0]
(%i8) radcan(%); *** But they all simplify to 0 -- so all roots are real ***
(%o8) [0,0,0,0]
(%i9) realpart(ddsr);   *** Let's get the real part ***
(%o9)
[(%beta+9)*(sqrt(3)*sin((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/(2*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6))

-cos((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/(2*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)))
        /(9*%beta)

 +sqrt(3)*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*sin((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/2

 -(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*cos((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/2+2/3,

(%beta+9)*(-sqrt(3)*sin((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)
                 /(2*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6))

-cos((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/(2*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)))
        /(9*%beta)

 -sqrt(3)*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*sin((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/2

 -(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*cos((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/2+2/3,

(%beta+9)*cos((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)/(9*(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*%beta)

 +(1/(27*%beta)+1/(3*%beta^2)+1/%beta^3+1/729)^(1/6)*cos((%pi-atan(3^(3/2)*sqrt((%beta^2+9*%beta+27)/%beta)/%beta))/3)+2/3,0]
(%i10) radcan(%);   *** and simplify it ***
(%o10)
[((-sqrt(3)*%beta-3^(5/2))*sin((atan(3^(3/2)*sqrt(%beta^2+9*%beta+27)/%beta^(3/2))-%pi)/3)

+(-%beta-9)*cos((atan(3^(3/2)*sqrt(%beta^2+9*%beta+27)/%beta^(3/2))-%pi)/3)+2*sqrt(%beta)*sqrt(%beta+9))
         /(3*sqrt(%beta)*sqrt(%beta+9)),

 ((sqrt(3)*%beta+3^(5/2))*sin((atan(3^(3/2)*sqrt(%beta^2+9*%beta+27)/%beta^(3/2))-%pi)/3)

+(-%beta-9)*cos((atan(3^(3/2)*sqrt(%beta^2+9*%beta+27)/%beta^(3/2))-%pi)/3)+2*sqrt(%beta)*sqrt(%beta+9))
         /(3*sqrt(%beta)*sqrt(%beta+9)),

 ((2*%beta+18)*cos((atan(3^(3/2)*sqrt(%beta^2+9*%beta+27)/%beta^(3/2))-%pi)/3)+2*sqrt(%beta)*sqrt(%beta+9))/(3*sqrt(%beta)*sqrt(%beta+9)),
        0]


On Mon, Nov 29, 2010 at 10:46, Hugo Coolens <coolens at kahosl.be> wrote:

> Can I tell Maxima somewhere/somehow that %beta is real and positive and
> thus make my original question solvable by Maxima?
>
>
>
> On Mon, 29 Nov 2010, Barton Willis wrote:
>
>  Ignoring the x = 0 root, you are asking for the real roots of
>> (%beta*x^3-2*%beta*x^2+%beta*x-3*x+2) = 0.
>> When %beta = 1 there are three real roots; when %beta = -2, there is one
>> real root:
>>
>> (%i39) (%beta*x^3-2*%beta*x^2+%beta*x-3*x+2);
>> (%o39) %beta*x^3-2*%beta*x^2+%beta*x-3*x+2
>>
>> (%i40) subst(%beta=1,%);
>> (%o40) x^3-2*x^2-2*x+2
>>
>> (%i41) nroots(%,minf,inf);
>> (%o41) 3
>>
>> (%i44) subst(%beta = -2,%o39);
>> (%o44) -2*x^3+4*x^2-5*x+2
>>
>> (%i45) nroots(%,minf,inf);
>> (%o45) 1
>>
>> Maxima is unable to easily determine the number of real roots. Just
>> looking at solutions
>> for which freeof(%i, rectform(xxx)) is true isn't going to work. I think
>> you'll to give
>> axima plenty of help.
>>
>> --Barton
>>
>> -----maxima-bounces at math.utexas.edu wrote: -----
>>
>>
>>  I'm trying the following:
>>> urb(x):=x*ui/(x*(1-x)*%beta+1);
>>> deltaurb(x):=ui*x-urb(x);
>>> diff(deltaurb(x),x);
>>> solve(%,x);
>>>
>>> How can I make Maxima show only the "real" (not complex) solutions?
>>>
>>>
>>> hugo
>>>
>>>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>