MjM0Y2ViOTdhNjRhNjUyZjhjYWRkODQ4NTk1ZTFjMWJiYWIwNmUzMzc4Y2ZkMzM4OGZmYWZhNTk2YzY2NTM1MA.msfhceo9.eyJ1cmwiOiIvcGwvY291cnNlX2luc3RhbmNlLzIvaW5zdGFuY2VfcXVlc3Rpb24vMTkyLyIsImF1dGhuX3VzZXJfaWQiOiIxIn0
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.18. Element pl-matrix-component-input: Input of matrices in grid format

Suppose ${\bf x}$ is the following array:

  • Matlab/Octave
  • Mathematica
  • NumPy
  • R
  • SymPy
1
x = [1 2 3 4];
1
x = {{1, 2, 3, 4}};
1
2
3
import numpy as np

x = np.array([[1, 2, 3, 4]])
1
x = matrix(c(1, 2, 3, 4), nrow = 1, ncol = 4, byrow = TRUE)
1
2
3
from sympy import *

x = Matrix([[1, 2, 3, 4]])
1.

Enter the components of ${\bf x}$. The attribute allow-partial-credit="true" is used, so each correct entry receives a partial score. By default, when allow-partial-credit="true", the attribute allow-feedback is also set to true, and hence the submission panel indicates which entries are incorrect.


Suppose ${\bf A}$ is the following array:

  • Matlab/Octave
  • Mathematica
  • NumPy
  • R
  • SymPy
1
A = [0.54 0.10; 0.85 0.02];
1
A = {{0.54, 0.10}, {0.85, 0.02}};
1
2
3
import numpy as np

A = np.array([[0.54, 0.10], [0.85, 0.02]])
1
A = matrix(c(0.54, 0.10, 0.85, 0.02), nrow = 2, ncol = 2, byrow = TRUE)
1
2
3
from sympy import *

A = Matrix([[0.54, 0.10], [0.85, 0.02]])
2.

Enter the components of ${\bf A}$. To get the answer correct, all entries need to be correct.

3.

Enter the components of ${\bf A}$. Here we use allow-partial-credit="true" and allow-feedback="false". Hence, each correct entry receives a partial score, but the submission panel does not indicate which entries are incorrect.

4.

This is a very long vector, it should be able to scroll. Enter the vector whose values are increasing integers in the range $1$ to $20$ (inclusive).

5.

Enter the vector $${\bf y} = \begin{bmatrix} \frac{1}{2} & \frac{1}{4} & \frac{1}{8} & \frac{1}{16} \end{bmatrix}$$ With the attribute allow-fractions="true" (which is true by default), entries can be submitted as the quotient of two decimal numbers.

6.

Enter the identity matrix. With the attribute allow-blank="true" (which is false by default), entries can be left blank to represent a zero, so you may leave the elements with a zero blank.

Additional attempts available with new variants

Correct answer

Collection 4

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

Question C4.18

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/matrixComponentInput
Title:
Element pl-matrix-component-input: Input of matrices in grid format

Variant

Started at:
2026-08-04 16:37:54 (CDT)
Duration:
0s
Show/Hide answer
{
  "out1": {
    "_type": "ndarray",
    "_dtype": "float64",
    "_value": [
      [
        0.54,
        0.1
      ],
      [
        0.85,
        0.02
      ]
    ]
  },
  "out2": {
    "_type": "ndarray",
    "_dtype": "float64",
    "_value": [
      [
        0.54,
        0.1
      ],
      [
        0.85,
        0.02
      ]
    ]
  },
  "out3": {
    "_type": "ndarray",
    "_dtype": "int64",
    "_value": [
      [
        1,
        2,
        3,
        4
      ]
    ]
  },
  "out4": {
    "_type": "ndarray",
    "_dtype": "int64",
    "_value": [
      [
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10,
        11,
        12,
        13,
        14,
        15,
        16,
        17,
        18,
        19,
        20
      ]
    ]
  },
  "out5": {
    "_type": "ndarray",
    "_dtype": "float64",
    "_value": [
      [
        0.5,
        0.25,
        0.125,
        0.0625
      ]
    ]
  },
  "out6": {
    "_type": "ndarray",
    "_dtype": "int64",
    "_value": [
      [
        1,
        0,
        0
      ],
      [
        0,
        1,
        0
      ],
      [
        0,
        0,
        1
      ]
    ]
  }
}

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.