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.56 & 0.43 & -0.71\\ -0.69 & -0.72 & 0.10\\ -0.46 & 0.55 & 0.70\\\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.41 & 0.97 & 0.32\\\end{bmatrix}$

${\bf c} = \begin{bmatrix} 0.4143\\ 0.9748\\ 0.3211\\\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.557 & 0.430 & -0.711\\ -0.688 & -0.718 & 0.105\\ -0.465 & 0.547 & 0.696\\\end{bmatrix}^T \begin{bmatrix} x \\ y \\ z \end{bmatrix} \begin{bmatrix} 0.4143\\ 0.9748\\ 0.3211\\\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 23:38:22 (CDT)
Duration:
0s
Show/Hide answer
{}
History
dec frac
rad deg