Sympy - Display Full Equation in Dense Matrix Form

Viewed 2407

I am attempting to use Sympy to decompose estimation procedures within the IPython Notebook. It would be very useful to be able to accompany data manipulations with the full linear equation display at each step. To take a simple regression example, I have the following setup:

from sympy import *
from sympy.abc import epsilon

y=MatrixSymbol('y',5,1)
x=MatrixSymbol('x',5,2)
b=MatrixSymbol('b',2,1)
e=MatrixSymbol('epsilon',5,1)

I can print each of the components...

y.as_explicit()

enter image description here

(b*x).as_explicit()

enter image description here

e.as_explicit()

enter image description here

...but I have not been able to find, however, a method in Sympy that allows for the full equation to be displayed (the following was rendered with an online latex editor):

enter image description here

Basically any time I use an equals operator it is reasonably taken as assignment, and addition operators convert the MatrixSymbol into a MatAdd object, which does not support the as_explict() method. Any thoughts on this issue would be appreciated.

1 Answers
Related