-
MathType
-
Wiris Quizzes
-
Learning Lemur
-
CalcMe
-
MathPlayer
-
Store FAQ
-
VPAT for the electronic documentation
-
MathFlow
-
BF FAQ
Answering vectors
Reading time: 2minIt's essential to read this section if you wish to create questions involving vectors. The critical point is that vectors are passed to the grading function as matrices, so we need to de-index them inside the function body to do normal vector operations with them. This should all be clear with the following basic example.
What this all essentially means is that if we pass [...]
to a grading function, it will be taken as [ [...] ]
(a list with the original vector as its only element). As a result, we cannot do vector operations with it. For example, the vector
will be converted to
How do we access the original vector? It is the first (and only) element of a list, so as with any list, we may access the first element with the subindex "1", as so:
So if "v" was the original vector given by the student and passed to the grading function, to treat it as a vector, we simply need to write "v1" wherever we would like to use "v". Let's look at this with some examples.
Example 1
The matrix has rank 2, so there will be infinite solutions, meaning that we have to use a grading function if we want to allow any possible solution. The procedure itself is pretty simple, but observe that we used the subindex as described above:
The other case we need to cover is allowing students to answer with a row or column vectors (until now, we've only assumed row vectors). We'll illustrate what needs to be done with an example. Using the same question as before, let's say the student responds like so:
This is a column vector, and it is treated differently. All we need to do, though, is transpose it, and we are back to the previous case. We most likely want to allow both types of answers, so at the beginning of the original grading function, we might add the following:
We've added an if statement that simply detects if the input is a column vector (by seeing if the number of columns is 1) and transposes it in that case. If not, then nothing is done to "v". The result is that in all circumstances ", v" will be of the form [ [...] ], and after that, we can use subindices precisely as described previously.
Example 2
Imagine we want to ask the students the following question:
This example clearly needs a grading function since there are infinite correct answers.
The first answer is a point, but it is understood as a matrix as before. We need to specify the corresponding element is a point and check whether it belongs to the corresponding line or not. The first part of the grading function would be:
The second answer is a vector and is also understood as a matrix. Similarly, we have to access its first row with a grading function as the following: