This has to do with the fact that there are two implementations for Matrices in WeBWorK: the MathObject matrices that you get with
Context("Matrix")
and the traditional ones you get from the Perl Matrix package. The latter do now know about MathObjects, and since the basis_cmp()
macro uses the traditional matrices, the error you are getting is due to that incompatibility. That is one reason you can't pass a MathObject Matrix to basis_cmp()
directly.You are correct to use the
value()
method of the MathObject Matrix entries to get the perl reals rather than MathObjects. (Note that in your original, the Real()
around the element extraction was redundant, since the Matrix entries are already MathObject Reals).A number of the matrix macros need to be updated to work with MathObject Matrices (or the MathObject Matrices could be updated to include methods that correspond to those older macros).