Is there a way to do that? For example from this equation:
To this matrix form:
We especially would like to get thos matrices circled-red.
This is the code I have at the moment:
from sympy import *
x, y = symbols('x y')
expr = 0.5 * (x**2) + 3*x + 4*y
print(latex(expr))
I welcome suggestion other than Simpy.
At the end of the day I'd like to use it with CVXOPT or Scipy.
I don't understand the code but I think the matrix can be derived, just as a straight forward rewritten, no calculations. $$(x,y)(\begin{array}{cc} c_{xx}& c_{xy}\\0& c_{yy}\end{array})(\begin{array}{c} x\\y\end{array})+(c_x, c_y)(\begin{array}{c} x\\y\end{array})$$ where $C_{xx} $ is the coefficient of $x^2$, $C_{xy}$ is the coefficient of $xy$, and so on.