Search code examples
maximawxmaxima

(wx)Maxima: literal order of polynomials


The documentation for powerdisp indicates that the options are either to display as a truncated power series, or from the greatest power to the least; is there any way to have it display the literal order provided (when unambiguous)?

e.g. if the input is 3*x*x^3 + 2*x^5*x^(-3) - 2*x*x^2, the output would be 3*x^4 + 2*x^2 - 2*x^3.

I understand that there would be ambiguity in the case where two of the terms had the same power, but I was curious to know if there was any way to achieve this, at least for unambiguous cases? Personally, I would be happy to simply have all terms display in the same order, even if they have the same power (i.e. no simplification via +).

Alternatively, is there any way to have Maxima treat x^0 as a polynomial term when ordering, vs. pushing the constant to the start / end of the expression?


Solution

  • This is a little too big for a comment so I'll post it as an answer.

    As I was saying, one can gain greater control over simplification via user-defined rules. The goal would be to reimplement the built-in, conventional identities, e.g. 1 + 1 simplifies to 2, x + x to 2*x, x*x to x^2, etc., and then selectively apply the rules to an expression.

    Documentation about the rule system is a little obtuse. Looking at the Maxima documentation page [0], probably the most readable introduction is [1]. See also [2] for additional information and historical notes. You can also look at the reference manual descriptions of matchdeclare and tellsimpafter (currently [3] and [4]). In particular see the worked example for anticommutative multiplication at the end of tellsimpafter.

    Probably the place to start for an implementation is to sketch out a list of rules which one wants to implement and how one plans to employ them.

    This whole process isn't simple, but there is some logic to it, and I am guessing it is actually of general interest, since similar features have been requested from time to time.

    [0] https://maxima.sourceforge.io/documentation.html

    [1] https://maxima.sourceforge.io/docs/tutorial/en/talon-pattern.pdf

    [2] https://maxima.sourceforge.io/misc/Fateman-Salz_Simplifier_Paper.pdf

    [3] https://maxima.sourceforge.io/docs/manual/maxima_155.html#index-matchdeclare

    [4] https://maxima.sourceforge.io/docs/manual/maxima_155.html#index-tellsimpafter