You are viewing this question as it will appear in the manual grading interface. Return to the normal view when you are done.

Element pl-matrix-latex: Display of 2D numpy arrays in latex format

The element pl-matrix-latex can be used to display 2D numpy arrays and scalars.

Display a 2D array of floats with 2 significant figures, by setting presentation-type="sigfig" and digits="2"

${\bf A} = \begin{bmatrix} -0.62 & -0.24 & -0.75\\ -0.23 & -0.85 & 0.47\\ -0.75 & 0.46 & 0.47\\\end{bmatrix}$

Display a 1D array a = np.array(3). To use this element, we first need to wrap the 1D array as a 2D array. For example, we use b = a.reshape((1, M)) to display as a row-vector or c = a.reshape((M, 1)) to display as a column vector:

${\bf b} = \begin{bmatrix} 0.32 & 0.96 & 0.25\\\end{bmatrix}$

${\bf c} = \begin{bmatrix} 0.3247\\ 0.9592\\ 0.2510\\\end{bmatrix}$

To display b we use digits="2" presentation-type="f" and to display c we use digits="4".

We can write systems of linear equations ${\bf A}^T{\bf x} = {\bf c}$ as such:

$$ \begin{bmatrix} -0.618 & -0.244 & -0.747\\ -0.230 & -0.853 & 0.469\\ -0.752 & 0.461 & 0.471\\\end{bmatrix}^T \begin{bmatrix} x \\ y \\ z \end{bmatrix} \begin{bmatrix} 0.3247\\ 0.9592\\ 0.2510\\\end{bmatrix}$$

When the element pl-matrix-latex is used to display a scalar, it results in printing the scalar as a string, without any brackets around it.

$x = 2.1$

Correct answer

Student view placeholder

In student views this area is used for assessment and score info.
Tools

Staff information

Question

Title:
Element pl-matrix-latex: Display of 2D numpy arrays in latex format

Variant

Started at:
2026-08-04 22:49:08 (CDT)
Duration:
0s
Show/Hide answer
{}
History
dec frac
rad deg