Skip to end of metadata
Go to start of metadata

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. Using may be useful when creating such questions.

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.

For a quick matrix editor reference, see Matrix Editor Reference Sheet.

Below is an example of a matrix question. Please note you do need to push the 'generate parameters button before the publish button will show.

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
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);



  • No labels