That approach works in many cases, but not in others. Most importantly, it
fails when the solution is parameterized.
For example,
solve(x^2=a,x) => [x=-sqrt(a),x=sqrt(a)].
The imagpart of sqrt(a) is +/-sin(atan2(0,a)/2)*sqrt(abs(a)) (call that
XX). Though that is syntactically non-zero (is(XX=0) => false), it is
(semantically) non-zero iff a<0. But alas Maxima doesn't seem to know this:
is(equal(XX,0)) => unknown
asksign(XX) => asks about the whole expression.
-s
On Thu, Dec 13, 2012 at 5:38 AM, Enrique Perez-Terron <enrio at online.no>wrote:
> On Tue, 11 Dec 2012 19:14:38 +0100, Jaime Villate <villate at fe.up.pt>
> wrote:
>
> Is there a way to restrict solve or to_poly_solve to only real solutions?
>>
>
> realp(x) := if imagpart(x) = 0 then true else false$
> solution: solve(...)$
> sublist(solution, realp)
>
> Regards
> Enrique
>
> ______________________________**_________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>
>