r/programminghelp • • Sep 09 '21

Python Solving for a 'self-referential' matrix equation in python

For lack of a better title.

I am looking to solve the equation:

V = A @ V @ A.T + Q

for a square matrix V, where A and Q are square matrices.

Any help appreciated.

3 Upvotes

4 comments sorted by

1

u/skellious Sep 10 '21

id 100% recommend looking into NumPy.

1

u/_Pragmatic_idealist Sep 10 '21

I am somewhat familiar with numpy, but browsing through the documentation, the most relevant function seems to be np.linalg.solve() - However, this function only solves equations on the form Ax=b where x and b are vectors.

It is technically possible to flatten V to a vector v, and then find a matrix A_bar and vector q, such that solving A_bar *v = q is equivalent to solving the more problematic 'matrix equation'. - However, it doesnt seem like a very elegant solution.

1

u/skellious Sep 10 '21

My point was more that numpy gives you the multidimensional arrays to better process this.

I'm afraid your maths knowledge probably vastly exceeds my own. I don't know how to write a solver for this.

Best of luck.