Closed ChristopherChudzicki closed 6 years ago
Note that det
is also dependent on the dimensionality.
I too am quite fond of IdentityMultiple
, but I think you're right that Idea B is probably the better way to go. Being explicit about what something is will ultimately lead to less confusion than having a clever but ill-defined construct.
I propose that in addition to exposing a helper function Identity(n)
, we have an additional key like identity_dim
(default None
) that will populate I
with the identity of the appropriate dimension. This reduces the author load just that little bit.
Resolved by #105.
The Issue
In
MatrixGrader
problems, ifIdentityMultiple
instances are passed to functions, students currently receive unhelpful generic error messages:This is bad.
(The actual cause of this error is an
isinf
check in calc.py'seval_function
parse action. However: I suggest that this issue should be for discussing the intended behavior, not the source of the bug.)Original motivation of IdentityMultiple
My thinking with IdentityMultiple originally was:
user_constant
with identity of relevant size. (Either overriding 'I', or declaring 'I_2', 'I_3', etc.)Resolutions
Shape is a bit more important for the identity matrix than I originally realized. In particular, I see no way to handle
trace
andnorm
for generic-dimensional identity operators.I'm not sure what the best approach to resolve this is. Two ideas:
Idea A: Implement functions like
det
,trans
, etc, and provide special error messages fortrace
andnorm
.I
of generic dimension that works in almost all situations.Idea B: Abandon IdentityMultiple all together. Provide a helper function
Identity(n)
for authors to declare identity matrix of specific size throughuser_constants
.numpy
matrix function.I am personally rather fond of
IdentityMultiple
, but I am actually leaning toward Idea B.