I would like to write a problem whose answer is A^(-1)B, but the variables are non-commutative, ie BA^(-1) is incorrect. Matrices don't allow negative exponents as far as i can tell, so i am wondering what the easiest way to do this would be.

*can*use negative powers for matrices, but that was added in a relatively recent version of pg, so you might need to update to get it. So you could do

```
Context("Matrix");
Context()->constants->add(
A => Matrix([[1,2],[3,4]]),
B => Matrix([[-1,e],[pi,sqrt(2)]]),
);
Context()->flags->set(
formatStudentAnswer=>'parsed'
);
$BAinv = Formula("B A^(-1)");
BEGIN_TEXT
\( B A^{-1} \) = \{$BAinv->ans_rule\}
END_TEXT
ANS($BAinv->cmp);
```

to check for B A^(-1) as opposed to A^(-1) B.
Hope that helps.

Davide

Good incentive for an update,

thanks Davide!

thanks Davide!