1

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?

Rax Adaam
  • 790
  • 3
  • 11
  • 1
    There really isn't any way to selectively apply built-in simplifications, such as enabling `"*"` simplifications and disabling `"+"`. You can of course entirely disable simplification via `simp: false` but that's a very blunt tool. With user-defined simplifications, there is greater flexibility to extend and retract, but built-in simplifications are hard-coded in Lisp, and not defined by the same mechanism as user-defined. There are, as you know, some flags to modify behavior, but overall it is hard to get exactly some specific behavior. This is unfortunately difficult to remedy. – Robert Dodier Jan 21 '21 at 07:01
  • @RobertDodier - yes, one solution I had explored was defining multiple variables, e.g. `x1`, `x2`, `x3` etc. then using `ordergreat` to fix their order. Then I used `texput` to have them all print the same symbol (i.e. `texput(xi, "x")` for i = 1,2,3). This worked for everything _except_ occurrences of `xi^0` -- hence my question. Where would you recommend I start for exploring user-defined simplification? I really have no idea how this would be done, but think I'm at the point that it would be worth looking into. – Rax Adaam Jan 21 '21 at 18:09

1 Answers1

2

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

Robert Dodier
  • 16,905
  • 2
  • 31
  • 48
  • Thank you very much Robert! This is going to take some time to digest, but it is very helpful to know where to get started! – Rax Adaam Jan 21 '21 at 20:32
  • 1
    It's not trivial, but it's also not enormous; it's a medium sized project, I guess I would say. Given that I think others would be interested, it's something I myself would like to work on. It's the kind of thing, I think, that could possibly end up in maxima/share or maxima-packages on Github. – Robert Dodier Jan 21 '21 at 21:20