Simplification or equality check



On 03/31/13 07:58, Stavros Macrakis wrote:
> Sorry, I meant radcan(imagpart(root))

imagpart(...) seems to re-order its arguments.

kill(all);
depends(y,x);
eq:2*x^3-x^2*y+y^3-1=0; p:[2,-3];
/* diff and extract solution from list */
eq1:rhs(first(solve(diff(eq,x),diff(y,x))));
define(df(y,x),eq1);
/* equation of line */
pointslope(p,m):=y-p[2]=m*(x-p[1]);
eq2:pointslope(p,df(p[1],p[2]));  /* equation with real coeff */

/* how do I pick a real solution? */
eq3:solve(eq,y);
eq4:subst([x=p[1],y=p[2]],eq3);

/* this says eq4[2] is real */
radcan(imagpart(eq4));
%[2];

/* this says eq4[3] is real */
float(eq4);
%[3];

I actually want  [3].

Tom Dean