This section is a work in progress please excuse the sparse documentation. If you'd like to use this question type and don't find the sufficient information on this page please email us.
This section will cover how to use the HTML & JavaScript (JS) question type to create matrix questions. Because of this, the HTML & JS question type is also sometime called matrix editor. This type of question is incredibly powerful but very particular on how responses will be received (ie additional line of code needed for answers to be in fraction instead of decimal format). You know you're in the matrix editor if you see body, explanation, prompt, AND code tabs/boxes, as shown below.
The matrix editor is intended to be used there the answer has multiple free response cells that all pertain to the same question, as in a matrix response. Below are examples of how this question type could be used:
Matrix Questions
Tabular Input
Creating Matrix Question Types
Matrix objects in JavaScript are supported through the usage of MathJs, a mathematical library for JavaScript. Specifically this page covers the usage and support of matrix objects. https://mathjs.org/docs/datatypes/matrices.html
Here is a matrix editor reference sheet: MatrixReferenceSheet.pdf
Below is an example of a matrix question.
Example Code
Compute the product $AB$ of the matrices $$A = @matA, B = @matB$$
By the row-column definition of the product of matrices $$\eqalign{AB = &@matA @matB \cr &@ans1}$$
function js_answer() { /* global matrix matA u={} */ /* global matrix matB u={} */ /* global matrix ans1 u={} */ matA = math.matrix([[-3, -1, -5], [-4, -5, 0], [-2, -4, 5]]); matB = math.matrix([[4, 4, 0], [-5, 5, 0], [2, 5, -3]]); ans1 = math.multiply(matA, matB); }