[Maxima] Sort by Frequency
robert.dodier at gmail.com
Tue Dec 4 09:46:45 CST 2007
On 12/3/07, Stefan Joeres <not_me at gmx.de> wrote:
> Using trigreduce(y) leads to
> terms of cos(w1), cos(w2), cos(2*w1+w2) ... and so on.
> I'd like to sort these terms according to those cos() coefficients.
The sort function sorts all kinds of expressions.
sort ([cos(w1 + w2), cos(w2^2), cos(w1), cos(2*w1 + w2), cos(w2)]);
=> [cos(w1), cos(w2), cos(w2 + w1), cos(w2 + 2 w1), cos(w2^2)]
Maxima has its own idea about how to order non-atomic expressions.
If you don't like that order, you can tell sort to use a specific
says more about that.
More information about the Maxima