Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error Handling

I am very new to Sage, so apologies if the answer to this question is obvious.

I have a program, and at the final calculation, for T and E matrices calculated earlier, it needs to either calculate a matrix A such that T=AE, or, if this returns an error message, calculate a matrix A such that p*T=AE, where p is also calculated earlier.

In mock code, what I mean is:

Calculate E.solve_left(T)
If that returns an error:
      A=E.solve_left(p*T)
else:
      A=E.solve_left(T)
return A

But I don't know how to do that in real code.