Question: Why different polynomial display depending on what was called before?

This is a good example of how Maple result looks different depending on what calls to Maple were made before.

I can't upload worksheet so have to show code and screen shot. Compare the screen shot below. Maple 2025.2. Same exact input., In first example the polynomial terms display in different order compared to the second example, even though the same exact input is used.

Clearly the first example is because Maple remembered this polynomial in its remember table somewhere before due to earlier call, and did not want to make new copy since it is same polynomial?

But I do want to make new polynomial. The old copy/order this polynomial in Maple internal tables is getting in the way.

But do not know how to tell Maple to clear its cache so I get same display as in the second example. I know both answers is the same. But the issue is why it displays different.

How could I get same output from first example as in the second one? What do I need to clear? I tried forget(Student:-Precalculus:-CompleteSquare) but this had no effect. ALso tried forget(all); also forget(all,forgetpermanent = true,reinitialize=true); also forget(Student:-Precalculus:-CompleteSquare,subfunctions=true);

code

restart;

eq := x^2 + y^2 + z^2 - 2*x + 8*y - 6*z - 30 = 0:
eq:=Student:-Precalculus:-CompleteSquare(eq):
e1:=convert(indets(%,`^`),list):
e2:=zip((a,b)->a=b,e1,[X,Y,Z]):
e3:=sort(eval(eq,e2));
e4:=map(X->rhs(X)=lhs(X),e2);
eval(e3,e4);

restart;

e3 := X + Y + Z - 56 = 0;
e4 := [X = (x - 1)^2, Y = (y + 4)^2, Z = (z - 3)^2];
eval(e3,e4);

[moderator: duplicate of this earlier question]

Please Wait...