NzY2ZDdkNzJlODlhMDkzNTVlNWFjZmU2OGIwNjQyMzFkNmYyYTY3NDc2MDJmMjY1MDVlZGUwNDNhNWRlOTQwMQ.msfhd62q.eyJ1cmwiOiIvcGwvY291cnNlX2luc3RhbmNlLzIvaW5zdGFuY2VfcXVlc3Rpb24vMTkwLyIsImF1dGhuX3VzZXJfaWQiOiIxIn0
Skip to main content Accessibility guide
PrairieLearn Go home
  • XC 101, SectionA
  • Assessments
  • Gradebook
  • C4
Load from disk
  • Dev User student
    View type
    ✓ Staff view staff ✓ Student view student ✓ Student view without access restrictions student
    Effective user
    Customize…
    Course Requests Settings Log out

Regenerate assessment instance

Warning: Regenerating the assessment instance will select a new set of questions from this assessment. Any progress on the current assessment instance will be lost.

Are you sure you want to regenerate the assessment instance?

Course staff: Regenerate your assessment instance to pick up changes to the assessment or to get a fresh set of questions.

C4.35. 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$

Additional attempts available with new variants

Correct answer

Collection 4

Assessment overview
Total points: 0/360
Score:
0%

Question C4.35

Value: 2
All variants: Open (current)
Total points: — /10
Auto-graded question

This form is only for reporting errors in the question itself. Do not use this form if you just don't know how to answer the question.

Previous question Next question

 Personal Notes

No attached notes

Attached files will be saved here for your reference. These files act as personal notes and can be used for your own review purposes. They are not used for grading.

Max file size: 10 MB

Attached personal notes will be saved here for your reference. These notes can be used for your own review purposes. They are not used for grading.

Staff information

Student details

Dev User
dev@example.com

Question

QID:
element/matrixLatex
Title:
Element pl-matrix-latex: Display of 2D numpy arrays in latex format

Variant

Started at:
2026-08-04 16:37:27 (CDT)
Duration:
0s
Show/Hide answer
{}

Assessment instance

Assessment:
gallery/elements
Started at:
2026-08-04 16:37:17 (CDT)
Duration:
0s
View log
This box is not visible to students.