Declarations



from http://www.math.utexas.edu/pipermail/maxima/2012/027525.html
*Gerd Kortemeyer:
*

Hi,

We have been using MAXIMA successfully inside of LON-CAPA for homework
problems for several years now - it's a great tool, thanks
everybody!!!

While authoring a new kind of homework, I am struggling with "declare"
- why does the following (sample) code not give the expected results?

(%i4) declare(x,real);
(%o4)                                done
(%i5) solve(x^3=125,x);
                  5 sqrt(3) %i - 5        5 sqrt(3) %i + 5
(%o5)        [x = ----------------, x = - ----------------, x = 5]
                         2                       2
(%i6) facts();
(%o6)                           [kind(x, real)]

Is there another way to tell "solve" to stay in the real realm?

Thanks!

- Gerd.
***********************************************************************************

 How to get only real solutions of polynomial equation?
I know these methods:
 a)
(%i1) sol:solve(x^3=125,x);
(%o1) [x=(5*sqrt(3)*%i-5)/2,x=-(5*sqrt(3)*%i+5)/2,x=5]
(%i2) sublist(sol,lambda([e],freeof(%i,e)));
(%o2) [x=5]

 b)
(%i3) realonly:true$
realroots(x^3=125);
(%o4) [x=5]

 c)
(%i5) realonly:true$
algsys([x^3=125],[x]);
(%o6) [[x=5]]

 d)
(%i7) realonly:true$
to_poly_solve([x^3=125], [x]);
Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $
(%o8) %union([x=5])
(%i9) first(%);
(%o9) [x=5]

Aleksas D