# [Maxima] topoly vs. to_poly

Barton Willis willisb at unk.edu
Mon Sep 10 11:03:13 CDT 2007

```> (%i1) load(topoly)\$
> \\volker\\CVS\\maxima\\maxima\\share\\contrib\\topoly_solver.mac")\$
> (%i4) eq : sqrt(x-2) = x-14\$
> (%i5) to_poly_solve(eq,[x]);
> (%o5)                             [[x = 18]]
>
> But I didn't get the clou of to_poly and elim_allbut. In the above
> example, how can I use
> their information to judge whether 11 is a solution of eq or not?

The function to_poly_solve uses the inequalities in the second list
returned by to_poly to remove spurious solutions (at least that is
what is should happen!). Simple example:

The (real) solution set to sqrt(x) = -1 is empty:

(%i6) to_poly_solve(sqrt(x) = -1,x);
(%o6) []

The function to_poly gives

(%i7) to_poly(sqrt(x) = -1);
(%o7) [[%g2+1,x=%g2^2],[-%pi/2<carg(%g2),carg(%g2)<=%pi/2]]

Solving [%g2+1,x=%g2^2] gives the solution [%g2 = -1, x = 1]. But
when %g2 = -1, the constraints [-%pi/2<carg(%g2),carg(%g2)<=%pi/2]
aren't happy, so the solution set is empty.

correctly rejects all spurious solutions or (2) use to_poly and
elim_allbut and check each solution as you did. Maybe I answered

Fun example:

(%i11) eq : [max(x,y)-min(8*y,x-y) = 2, abs(x+y) = 9];
(%o11) [max(x,y)-min(8*y,x-y)=2,abs(y+x)=9]

(%i12) sol : to_poly_solve(eq,[x,y]);
(%o12) [[x=74/9,y=7/9],[x=7,y=2]]

(%i13) for si in sol do print(subst(si, eq));
[2=2,9=9]
[2=2,9=9]

BW
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070910/71f3d5b2/attachment-0001.htm
```