# [Maxima] Factor part of an expression

Rupert Swarbrick rswarbrick at gmail.com
Thu Aug 26 10:42:27 CDT 2010

```"Daniel M. Israel" <dmi1 at lanl.gov> writes:
> 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.)

As well as the other replies, there's also a slight overkill approach
that might work and is definitely simple to do:

(%i4) a + b*x + c*x;
(%o4)                            c x + b x + a
(%i5) rat (%, x);
(%o5)/R/                         (c + b) x + a

The resulting expression is stored in CRE form, which you might not
want, but you can convert back to a normal expression without breaking
the factorisation:

(%i6) ratdisrep (%);
(%o6)                            (c + b) x + a
(%i7)

Obviously, this won't work if b,c aren't free of x.

Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20100826/77bab4df/attachment.pgp>
```