-
Notifications
You must be signed in to change notification settings - Fork 11
Introducing flag to suppress matrix error messages #158
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
Conversation
b4cffd9 to
04bbba5
Compare
|
Do you think |
|
That sounds reasonable, and more intuitive, given that it's only suppressing matrix-related messages. I'll go and make the change. |
|
Updated the flag name. |
|
Note that right now from mitxgraders import *
grader = MatrixGrader(
variables=['A'],
sample_from={
'A': RealMatrices()
},
max_array_dim=0,
suppress_messages=True,
)
# below raises MathArrayError "Cannot raise a matrix to non-integer powers."
result = grader('A', 'A^1.3')
# below raises a DomainError
# (DomainError is not an instance of MathArrayError, but this is matrix-related)
result = grader('A', 'sin(A)')@jolyon Maybe you should catch (Note: the idea in #183 works for customizing DomainError messages, too.) |
|
Hmm. I can definitely catch |
e017f47 to
cf50b73
Compare
cf50b73 to
ac362c3
Compare
|
Ok, I've had a go at fixing things. Let me know what you think. I'm not terribly happy with the outcome, as it's somewhat kludgy, but it's a quick and dirty way to get noncommuting "scalars". I updated the documentation with a warning that taking functions of these "scalars" will be problematic. I'll go and comment on #183 now. |
This PR introduces a flag to
MatrixGraderthat completely suppresses all matrix error messages. This is useful when variables are secretly being used as matrices due to their noncommutativity, but matrix error messages would be confusing to students. Includes code, tests, documentation and course example.