Changing the order of variables

### 10.1.26 Changing the order of variables

The reorder command rewrites an expression, based on the priority of variables.

- reorder takes two arguments:
  - expr, an expression.
  - vars, a vector of variable names.
- reorder(expr,vars) expands expr according to the order of variables given in vars.

#### Example

reorder(x^2+2*x*a+a^2+z^2-x*z,[a,x,z])

a2+2 a x+x2−x z+z2 |  |  |  |  |  |  |  |  |  |

##### Remark.

The variables must be symbolic before calling reorder. If they are not, purge them (see Section 3.3.8).