eq:2*x^3-x^2*y+y^3-1=0; p:[2,-3];
eq1:''rhs(first(solve(diff(eq,x),diff(y,x))));
df(x,y):=''eq1;
pointslope(p,m):=y-p[2]=m*(x-p[1]);
eq2:pointslope(p,df(p[1],p[2]));
soln:rhs(first(solve(eq2,y)));
eq3:last(factor(solve(eq,y))); /* choose the real solution */
plot2d([rhs(eq3),soln],[x,-4,4],[y,-10,10]);
Here is my problem.
eq3:factor(solve(eq,y));
eq has three solutions for y. How do I choose the right one? I used
the if statement for simpler results. But, I cannot reduce this to
equality.
I have been searching for a way to tell if any parts of eq3 are real.
float(subst([x=p[1],y=p[2]],eq3[1]));
float(subst([x=p[1],y=p[2]],eq3[2]));
float(subst([x=p[1],y=p[2]],eq3[3]));
if subst([x=p[1],y=p[2]],eq3[1]) then eq4:eq3[1]
elseif subst([x=p[1],y=p[2]],eq3[2]) then eq4:eq3[2]
elseif subst([x=p[1],y=p[2]],eq3[3]) then eq4:eq3[3];
Is there a reasonable way to do this?
Tom Dean