>(%i31) esolve(eq, x) := block(numer:true, defrule(r1, %i, 0),
> expand(to_poly_solve(eq, x)), part(apply1(%%, r1),1))$
(a) There is no guarantee that the first solution returned by to_poly_solve is real.
(b) The function esolve globally sets numer to true; I would guess that you would like to change
the definition of esolve to something like block([numer : true], .....
(c) Every time esolve is executed, the rule r1 is re-created. Actually, instead of a rule, esolve could
simply substitute 0 for %i.
Keepin' it real isn't easy:
(%i3) esolve(x/sin(x)=0,x);
part: fell off the end.
(%i4) esolve(x^2+1,x);
(%o4) [x=0]
--Barton