Fwd: Simple simplification question



maxima-bounces at math.utexas.edu wrote on 08/28/2007 11:47:48 AM:

> I am just a newbie to Maxima.  I have tried to simplify the 
> following expression from ex:d*b*e/(2*a*c)+e/2 to e/2(1+d*b/a*c). 
> Basically, I'd like to pull a common factor e/2 out and make the 
> term inside stay the form of (1 + num/denum). 

(%i1) ex : d*b*e/(2*a*c)+e/2$

Either

  (%i2) facout(e,ex);
  (%o2) ((b*d)/(2*a*c)+1/2)*e

or

  (%i3) facout(e/2,ex);
  (%o3) (((b*d)/(a*c)+1)*e)/2

> I have searched the mailing list a little bit, but have not found 
> solution yet.  Furthre more, if I can apply the same rule to a more 
> complicated form, such that the similar expression appear in both 
> the realpart and imagpart or even in a matrix, it would be great. 

Generally, you'll need to map a function onto the matrix elements
to do things like this; an example:

(%i4) matrix([d*b*e/(2*a*c)+e/2,a*e + b*e])$

(%i5) matrixmap(lambda([s], facout(e,s)),%);
(%o5) matrix([((b*d)/(2*a*c)+1/2)*e,(b+a)*e])

 Barton