# Question:Why the output of an expression using indexed name reversing coefficient and indeterminant?

## Question:Why the output of an expression using indexed name reversing coefficient and indeterminant?

Maple 2019

I have encountered a peculiar behavior in Maple 2019 worksheets. I have attached a worksheet which illustrates a reversal of the coefficient and the blade in the following types of expression.  My Maple installation is set in options to use maple input and output (1D notation).  I am using build ID 1399874.

The procedure I was testing used the add function to expand a multivector over basis blades and coefficients represented by indexed names; for example
add(a[indx[]]*e[indx[]], indx = indxes); where indxes:={[1],[2],[3],[1,2],[1,3],[1,4],[2,3],[2,4]};

The expected result
a[1]*e[1]+a[2]*e[2]+a[3]*e[3]+a[4]*e[1, 2]+a[5]*e[1, 3]+a[6]*e[1, 4]+a[7]*e[2, 3]+a[8]*e[2, 4] in 1D notation but instead I got

e[1]*xx[1]+e[2]*xx[2]+e[3]*xx[3]+e[1, 2]*xx[4]+e[1, 3]*xx[5]+e[1, 4]*xx[6]+ e[2, 3]*xx[7]+e[2, 4]*xx[8]

(Note and the different coefficient names illustrates the exchange is caused by sorting.)

Initially, I assumed that this resulted from the add command, but after I directly entered an indexed expression into the worksheet and obtained a similar result I realized it must be occurring during the output.  Apparently, before the expression is written, it is first sorted. I know this because, if the coefficient is named a,b,c,d ( less than e), the expression is not exchanged. In addition, if I convert the expression to 2D output, the expression is written in the normal order specified in the add command.

I also confirmed this behavior in Maple 2018.2 as well.  Hopefully, the example worksheet attached will illustrate this behavior.  Am I correct in assuming that when the code I am using in the worksheet with is incorporated into a module in an mpl file and loaded, this will not be an issue.

exchangeproblem.mw

﻿