On 3/9/2013 10:47 PM, Paul J. Ste. Marie wrote:
> ratsubst is definitely an improvement over subst's behavior!
>
> It still doesn't gather the terms, though. I wind up with
>
> (%o118) cx = -(b2m1*y2-b2m1*y1-2*b*x2-2*b*x1)/(4*b)
Ah, but ratsubst'ing the term in, calling ratsimp, and then subst'ing it
back out does do the trick:
distrib(
subst(x1+x2,sumx,
subst(y2-y1,delta_y,
ratsimp(
ratsubst(sumx,x1+x2,
ratsubst(delta_y,y2-y1,sol_1)
)
)
)
)
);
gives a nice tidy
cx = (x2+x1)/2-(b^2-1)*(y2-y1)/(4*b)