solve x



> ok, it works

> but it seems a bit weird:
> (%i2) to_poly_solve([-sqrt(x^2+3*x)+sqrt(2*x+2)=0] , [x]);
> (%o2) %union([x = - 2], [x = 1])

> (%i3) subst(-2, x, sqrt(2*x+2)-sqrt(x^2+3*x)=0);
> (%o3) 0 = 0

Exactly what seems weird? If it's the %union object, consider:

  (%i6) sol : to_poly_solve(x^2 + a*x+1,x);
  (%o6) %union([x=(sqrt(a^2-4)-a)/2],[x=-(sqrt(a^2-4)+a)/2])

The %union object automatically simplifies to a singleton set when a --> 2

  (%i7) subst(a=2,sol);
  (%o7) %union([x=-1])

A %union object sorts its arguments and deletes redundant members:

  (%i13) %union(a,a,b);
  (%o13) %union(a,b)

And  a %union object  "flattens" itself:

  (%i14) %union(a,%union(c,d));
  (%o14) %union(a,c,d)

--Barton (author of to_poly_solve)