with sympy
A = Matrix([[1,1],[2,2],[0,0]])
MatMul(A.T, A, evaluate=False)
I can output an equation like this
is there a way to output an equation containing an equal sign like this?
with sympy
A = Matrix([[1,1],[2,2],[0,0]])
MatMul(A.T, A, evaluate=False)
I can output an equation like this
is there a way to output an equation containing an equal sign like this?
The following should work. Eq is an Equality container that prints with an = separating the left and rhs.
>>> pprint(Eq(MatMul(A.T, A, evaluate=False), A.T*A))
You can also get the latex representation of the same by replacing pprint with latex.
For ipython users (and vscode with #%% separators) this will produce a nice graphical display.
The evaluate=False in the Eq prevents evaluation and reduction of the result to True or False..
display(Eq(MatMul(A.T, A, evaluate=False), A.T*A, evaluate=False))
Another useful variant is to display the variable name like so:
display(Eq(S('A'),A, evaluate=False))