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

Compare with Current View Page History

« Previous Version 3 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 question type to create matrix questions.



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