NAME

quickMatrixEntry.pl - Add a button to MathObject Matrix array answers that allows pasting of matrix contents.

DESCRIPTION

A QuickMatrixEntry object lets you add a "Quick Entry" button to a MathObject Matrix array answer. When the button is clicked it opens a dialog in which you can edit the entries of the matrix in a text area. This allows pasting of large matrices from other sources.

A QuickMatrixEntry object is created in much the same way that a MathObject Matrix is created. Set the context to the Matrix context, and call the QuickMatrixEntry method with an array of arrays. For example,

Context('Matrix');

$matrix = QuickMatrixEntry([
    [ 1, 2, 3, 4, 5, 6, 7, 8 ],
    [ 8, 7, 6, 5, 4, 3, 2, 1 ],
    [ 1, 2, 3, 4, 5, 6, 7, 8 ],
    [ 8, 7, 6, 5, 4, 3, 2, 1 ],
    [ 1, 2, 3, 4, 5, 6, 7, 8 ]
]);

Then add the array of answer rules to the problem with

BEGIN_PGML
[_]*{$matrix}{4}
END_PGML

Other than the button that is added above the array of answers, the QuickMatrixEntry is just a MathObject Matrix, and everything that can be done with a MathObject Matrix can also be done with a QuickMatrixEntry. However, if not used via ans_array (the starred answer form in PGML) the button will not be added and the QuickMatrixEntry object will be nothing more than a MathObject Matrix. This generally should not be done.