>>>>> "Paul" == Paul J Ste Marie <paul_j at ste-marie.org> writes:
Paul> 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)
Paul> Ah, but ratsubst'ing the term in, calling ratsimp, and then subst'ing
Paul> it back out does do the trick:
Paul> distrib(
Paul> subst(x1+x2,sumx,
Paul> subst(y2-y1,delta_y,
Paul> ratsimp(
Paul> ratsubst(sumx,x1+x2,
Paul> ratsubst(delta_y,y2-y1,sol_1)
Paul> )
Paul> )
Paul> )
Paul> )
Paul> );
Paul> gives a nice tidy
Paul> cx = (x2+x1)/2-(b^2-1)*(y2-y1)/(4*b)
This is nice and simple and lends it self to further manipulation.
I've had to do this before because numerical work brings up
considerations that don't occur with symbolic manipulations, like
accuracy and overflow/underflow. Sometimes it's better to do
(b-1)*(b+1) instead of (b^2-1) when b is very close to 1. Or maybe
you want to do ((y2-y1)/(4*b)) * (b^2-1) to prevent overflows if
(y2-y1)*(b^2-1) would overflow.
This is one reason why I don't spend to much time getting maxima to
produce exactly the expression I want.
Ray