# Question:How to preserve the order when extracting the coefficients?

## Question:How to preserve the order when extracting the coefficients?

Maple 2017

Hello (again)

I thought I won't need help with that type of question but I came across an example that says otherwise.  Here it is

```vars:=[x,y,z];

model7 := [x*(-RootOf(64*_Z^3+80*_Z^2+1104*_Z+561)-5/4)+y*alpha[1, 2]-33/(32*RootOf(64*_Z^3+80*_Z^2+1104*_Z+561)), x*z*alpha[2, 6]+y*RootOf(64*_Z^3+80*_Z^2+1104*_Z+561), x^2*(17*RootOf(64*_Z^3+80*_Z^2+1104*_Z+561)+17)/(alpha[1, 2]*alpha[2, 6])-17*x*y/alpha[2, 6]+2*z*x-z-(163/32+RootOf(64*_Z^3+80*_Z^2+1104*_Z+561)^2+5*RootOf(64*_Z^3+80*_Z^2+1104*_Z+561)*(1/4))/(alpha[1, 2]*alpha[2, 6])]
```

then I issued the command

```map(w->coeffs(w,vars),model7);
```

to get

`[-33/(32*RootOf(64*_Z^3+80*_Z^2+1104*_Z+561)), -RootOf(64*_Z^3+80*_Z^2+1104*_Z+561)-5/4, alpha[1, 2], RootOf(64*_Z^3+80*_Z^2+1104*_Z+561), alpha[2, 6], -(163/32+RootOf(64*_Z^3+80*_Z^2+1104*_Z+561)^2+5*RootOf(64*_Z^3+80*_Z^2+1104*_Z+561)*(1/4))/(alpha[1, 2]*alpha[2, 6]), -1, (17*RootOf(64*_Z^3+80*_Z^2+1104*_Z+561)+17)/(alpha[1, 2]*alpha[2, 6]), -17/alpha[2, 6], 2]`

clearly the order does not follow model7's.

I have also tried

`[seq(coeffs(expand(model7[i]), indets(model7[i], suffixed({vars[]}))),i=1..nops(model7))];`

Is there a solution to it?

Many thanks (again)

Ed

﻿