-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug when a matrix Math Object is reused as an answer #1002
Comments
Unfortunately, I don't think that this can be fixed without a rather hefty re-implementation of the way that MathObject matrix array answer rules work. When the matrix answer array rule is called it sets several hash key values on the original object. Most notable for this particular issue is the key |
I have also noticed this issue with MultiAnswer, and the fix I use is to create a copy of the MathObject before assigning it to the answer rule. Would it be possible for PGML and parserMultiAnswer to detect if a MathObject has been used in another answer rule, and then create a copy of it to use/assign to the answer rule in this case? |
I don't think that is possible. I don't think that an object can clone itself at that point, and it wouldn't be able to update other references to itself. |
What about a warning that only professors can se then, so at least problem authors know that there might be a problem? Maybe something along the lines of "The MathObject in the Nth answer rule is being used in another answer rule. This can cause unexpected results. You should copy the MathObject, and assign the copy to the new answer rule." |
PGML could use Before I spend time looking into solutions, however, can someone tell me the use case for asking for the same matrix twice? I'm at a loss as to why someone would do that. I know this has come up before, and I can't find the previous discussion. Sorry! |
PS, one should be able to do DOCUMENT();
loadMacros(qw(PGstandard.pl PGML.pl));
Context("Matrix");
$A = Matrix([-1,0],[0,-1]);
BEGIN_PGML
[`[$A]={}`][_]*{$A}{5}
[`[$A]={}`][_]*{$A->copy}{5}
END_PGML
ENDDOCUMENT(); in this case, so I'm not sure how high a priority solving this is. |
@dpvc I ran across this in the case of a DE course, where I have a heavily scaffold problem, first students need to find the eigenvalues and eigenvectors (a 2x1 matrix) of a matrix. Then they need to use those in a formula to find fundamental solutions, (which I've setup in some multiAnswer setup), in such a way they have to enter in the same eigenvector twice. The So I do agree that there is probably very limited use cases for this, but if for some reason an author does use the same MathObject matrix in two different answer boxes, the confusion about why things don't work and that a copy of the MathObject would fix the problem isn't clear. Hence my suggestion of at least a warning to point authors in the right direction to making it work. |
I had a three-part question where the pedagogical point was for students to see that all three answers were the same. All in the context of R^2, it was like: a. What is the standard matrix for rotation about the origin by 180 degrees? b. What is the standard matrix for negation of vectors? c. What is the standard matrix for reflecting vectors over the x-axis and then reflecting over the y-axis? All three answers are I suppose if the answer in question had a complicated custom answer checker, it would be a little more valuable to directly reuse it rather than store redundant copies. |
I am interested in the idea of automating the |
Thanks for the use cases @Alex-Jordan and @somiaj. Those make sense. I will look into some possible approaches to working around this. I'd like to make a solution that is not PGML dependent, but certainly using |
Here is an issue, similar to issues I've seen in the past in that to demonstrate this, a Math Object gets reused as an answer.
In 2.18 and also develop, consider:
Both answer fields want the negative of the identity matrix entered. If you enter [[1,0],[0,1]] in the first answer (which is incorrect) and [[-1,0],[0,-1]] in the second answer (which is correct), as far as scoring goes, the right thing happens.
But the "answer preview" and "entered" fields in the results table (2.18) or answer info popover (develop) show that you entered [[1,0],[0,-1]] for that first answer, which is not what you typed into either answer array.
I am unsure if the issue can be demonstrated with a more minimal example.
The text was updated successfully, but these errors were encountered: