#define a suitable set of indexes. indxes:={,,,[1,2],[1,3],[1,4],[2,3],[2,4]}; indxes := {, , , [1, 2], [1, 3], [1, 4], [2, 3], [2, 4]} #Output multivectors when the coefficient xx exceeds e lexicographically. add(x[indx[]]*e[indx[]], indx = indxes); e*x+e*x+e*x+e[1, 2]*x[1, 2]+e[1, 3]*x[1, 3]+e[1, 4]*x[1, 4]+e[2, 3]*x[2, 3]+e[2, 4]*x[2, 4] #Notice that the coefficient and the blade have exchanged positions. add(xx[i-1]*e[indxes[i][]], i=1..nops(indxes)) e*xx+e*xx+e*xx+e[1, 2]*xx+e[1, 3]*xx+e[1, 4]*xx+e[2, 3]*xx+e[2, 4]*xx add(xx[i]*e[indxes[i][]], i=1..nops(indxes)) a*e+a*e+a*e+a*e[1, 2]+a*e[1, 3]+a*e[1, 4]+a*e[2, 3]+a*e[2, 4] #change xx to a, which is lexicographically less than e to get output in standard order. add(a[indx[]]*e[indx[]], indx = indxes); a*e+a*e+a*e+a[1, 2]*e[1, 2]+a[1, 3]*e[1, 3]+a[1, 4]*e[1, 4]+a[2, 3]*e[2, 3]+a[2, 4]*e[2, 4] add(a[i-1]*e[indxes[i][]], i=1..nops(indxes)) a*e+a*e+a*e+a*e[1, 2]+a*e[1, 3]+a*e[1, 4]+a*e[2, 3]+a*e[2, 4] add(a[i]*e[indxes[i][]], i=1..nops(indxes)) a*e+a*e+a*e+a*e[1, 2]+a*e[1, 3]+a*e[1, 4]+a*e[2, 3]+a*e[2, 4] #Try using subs to exchange the names of the coefficient and blade. Reverts to exchanged order. subs(a=xx,add(a[i]*e[indxes[i][]], i=1..nops(indxes))); e*xx+e*xx+e*xx+e[1, 2]*xx+e[1, 3]*xx+e[1, 4]*xx+e[2, 3]*xx+e[2, 4]*xx #Try creating an mv typographically without using add. x*e + x*e + x*e[1,2,3]; e*x+e*x+e[1, 2, 3]*x #The mv still exchanges coefficients. This is new behavior and I can't figure out why. Even if I open a new #worksheet, do a restart, and enter the arbitrary mv into the worksheet, the indexed expression is still sorted #in lexicographic order.