Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

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.



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

Below is an example of a matrix question.



Example Code

Body
Compute the product $AB$ of the matrices

$$A = @matA, B = @matB$$
Explanation
By the row-column definition of the product of matrices

$$\eqalign{AB = &@matA @matB \cr
&@ans1}$$
JavaScript
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);

}

Preview

  • No labels