On 8/25/2010 1:58 PM, Daniel M. Israel wrote:
> Is there a simple way to get maxima to simplify
>
> a+b*x+c*x
>
> to
>
> a+(b+c)*x
>
> (In real life, a,b,c, and x may all be more complex expressions.)
>
ratsubst(Q,b+c,%);
It is harder if you want Maxima to figure out that this particular
command with b+c was a good idea.
If you have an algorithm for this, effective for very complex
expressions, then that would
be a good contribution to improving Maxima.
So far as I know, you need a (potentially quite expensive) search to try
to find the shortest
expression, and you might also need multivariate factoring, if indeed
you want the shortest expression.
Or maybe you have some other criterion in mind, such as numerical
stability when evaluated.
RJF