>kill(all);
>display2d:false;
>eq1:a*x+b*y+c=0; /* line */
>eq2:p^2=c^2/(a^2+b^2); /* distance */
>depends(y,x);
>eq3:diff(eq1,x);
>eq4:apply("+",solve(eq1,c)^2);
>eq5:apply("+",solve(eq2,c^2));
>eq6:expand(rhs(eq4)/b^2) = expand(rhs(eq5)/b^2);
>eq7:apply("+",solve(eq3,'diff(y,x)));
>load ("lrats");
>eq8:fullratsubst(rhs(eq7)=lhs(eq7),eq6);
>eq9:factor(eq8);
> It would be nicer if I could formulate it so eliminate(...) works.
Try (your answer is nicer)
(%i1) depends(y,x)$
(%i2) a*x + b*y+c=0$
(%i3) [%,diff(%,x), p^2=c^2/(a^2+b^2)]$
(%i4) eliminate(%,[a,b])$
(%i5) factor(%);
(%o5) [-c^2*x^2*(x^2*('diff(y,x,1))^2-p^2*('diff(y,x,1))^2-2*x*y*('diff(y,x,1))+y^2-p^2)]
>Also, I cannot seem to find an easier way than apply("+",...) to get from a list to an equation I can manipulate.
An alternative to apply("+,...) is xreduce("+", ...). But I'm not sure that xreduce is any better in this case.
--Barton