[Maxima] rearranging and collecting terms
reyssat
eric.reyssat at math.unicaen.fr
Fri Aug 7 07:34:00 CDT 2009
Mario Maio a écrit :
>
> Thank you so much Ted and Valery for the solutions found. Unfortunately
> they presuppose that I know in advance the exact form of the expressions
> resulting from the computation, which is not my case (sorry if I was not
> clear enough).
This might be the most difficult step : to precise clearly what you want
in general, not on a particular case.
In fact, factor((3*cos(d1)^3-3*cos(d2)^3)*x) doesn't lead to
trigonometric expansion, it only factors a polynomial in cos(d1) and
cos(d2).
In the expression 3*u^3-3^v^3, why do you want to factor out the
constant 3 and not the polynomial factor (u-v) ?
Which is simpler, 3*(u^3-v^3)*x or 3*(u-v)*(v^2+u*v+u^2)*x ? It depends
on your needs, the first is easier to read, the second more precise for
drawing or numerical evaluation for instance.
If you want to get the expression of minimal length, the problem is
certainly very expensive in general : how to guess that (x+2)*(x^2+x+1)
may also be written as (x+1)^3+1 without trying all expressions of
length and coefficients smaller than something ?
If you want to factor out only visible (i.e. readable) common
subexpressions, you'll simplify 3*(u-v)*u+3*(u-v)*v to 3*(u-v)*(u+v)
but also simplify (2+1)*(u^2-v^2) to 3*(u^2-v^2), although all four
polynomials are equal. Your answer is not canonical.
How do you want to simplify (1-x)+x*(1-x) ? expand or factor ? etc.
> The solution I look for should work for any kind of
> expression, trigonometric (cos 2x, cos^2, sin^4, tan^3, and so on) or not.
> Basically I need to pull out a number or variable factor
is (u-v) a variable factor, or do you accept only single symbols ?
> from an expression
> without incurring in trigonometric or other kind of expansion; a very simple
> operation to do by hand (in these cases), but difficult for Maxima, it seems
> (I'd like Maxima to do it in order to avoid manual steps that could lead to
> errors).
Depending on the amount of computation you need, you may want to make
Maxima compute and verify step by step, giving it some hints to display
results as you want in each case. For instance, if p:3*u^2-3*v^2; and
you guess 3 being a factor of p, then you may compute p1:3*expand(p/3);
and then radcan(p-p1); to verify your guess.
This may not help you answering your question, but I hope it helps
understanding why the question is non trivial, without confusing you too
much.
Eric Reyssat
More information about the Maxima
mailing list