Enhancements
Matrices and Square Brackets

Mobius Logo

Students using the Equation Editor will enter matrices or vectors using square brackets. [1,2|3,4] matrix with square brackets The Mobius default when showing the correct response is to return round brackets!(1,2|3,4) matrix with round brackets

To fix this you need to modify the answer returned by Mobius. The secret lies in how MathML represents a matrix. A matrix is just a table within brackets. The code looks like this:

<mfenced>

... table code ...

</mfenced>

The default bracket type is round. To fix this we need to replace that code with 

<mfenced open="[" close="]">

... table code ...

</mfenced>

 

In Maple Calls

A typical maple call for a matrix/vector in the algorithm section would be:

$A=maple("printf(MathML[ExportPresentation](Matrix([[1, 2], [3, 4]])))");

(The "printf" is needed to prevent the output being shown in "quotes".)

 

To fix this, first define the MathML object in Maple, then substitute in that object:

$A=maple("A:=MathML[ExportPresentation](Matrix([[1, 2], [3, 4]]));printf(StringTools[Substitute](A, `<mfenced>`, `<mfenced open=[ close=]>`))");

In Maple Grading

We often use the ANSWER field in Maple grading to show a properly formatted answer:

printf(MathML[ExportPresentation]($A))

which results in a matrix with round brackets. To fix, just use a technique similar to that for the algorithmic section:

A:=MathML[ExportPresentation]($A);printf(StringTools[Substitute](A, "<mfenced>", "<mfenced open=[ close=]>"));

You can use double quotes here instead of the back-quotes used in the maple call earlier.

 

Note: If you have more than one instance of round brackets in an object you can use SubstituteAll to replace all instances.


Enhancements Index

Main Index

Last updated: 2021/07/16 SS/DAG