>>>>> "lo" == lo <james.smith1 at freenet.de> writes:
lo> hello Maxima users,
lo> a question from a newby:
lo> I define a function and take the derivative of it
lo> wrt some variables. The result is horribly long
lo> but it is the sum of many terms. If I examine those terms,
lo> for each, some factorization could be done, but are not.
lo> To simplify the problem, consider for instance:
lo> f: y1*exp(x1)+y1*cos(x1)+(x1-x2)^2;
lo> How come that Maxima do not put y1 as a common factor for exp(x1) and
lo> cos(x1) ?
Because sometimes that's not what you want. Maxima can't read your
mind. :-)
lo> How to tell Maxima to factorize as much as possible (assuming I do not
lo> know myself that
lo> y1 is a common factor for the first two terms) ?
collectterms(f, y1) will do what you want in this case.
lo> If I use radcan, I get the result I want, but (x1-x2)^2 gets expanded,
lo> something I would like to avoid.
Be careful with radcan. It can change expressions in unexpected ways
that you might not want. Use ratsimp instead.
Ray