Can anyone help me in finding an inverse matrix on 2n x 2n matrix such that for i,j=1,2,...,n ,
-m_(ji) , for a_(ij) entry and i ≠ j ,
sum_(i ≠ k) m_(ik) + (y_i + p_i*t_i) , for a_(ii) entry and k=1,2,..,n ,
-p_i*t_i , for a_((n+i)i) entry , and
d_i , for a_((n+i)(n+i)) entry.
I tried for i=2, and 3, but when I tried i=4, my program wont end. Here is my program:
from sympy import * from numpy import matrix from numpy import linalg from sympy import Matrix Ab, Ac, Ad, Ba, Bc, Bd, Ca, Cb, Cd, Da, Db, Dc, Za, Zb, Zc, Zd, Xa, Xb, Xc, Xd, Ya, Yb, Yc, Yd = symbols('Ab, Ac, Ad, Ba, Bc, Bd, Ca, Cb, Cd, Da, Db, Dc, Za, Zb, Zc, Zd, Xa, Xb, Xc, Xd, Ya, Yb, Yc, Yd') V = Matrix([[Ab+Ab+Ad+Za, -Ba, -Ca, -Da, 0, 0, 0, 0], [-Ab, Ba+Bc+Bd+Zb, -Cb, -Db, 0, 0, 0, 0], [-Ac, -Bc, Ca+Cb+Cd+Zc, -Dc, 0, 0, 0, 0], [-Ad, -Bd, -Cd, Da+Db+Dc+Zd, 0, 0, 0, 0], [-Xa, 0, 0, 0, Ya, 0, 0, 0], [0, -Xb, 0, 0, 0, Yb, 0, 0], [0, 0, -Xc, 0, 0, 0, Yc, 0], [0, 0, 0, -Xd, 0, 0, 0, Yd]]) V_inverse = V.inv() print("V'=", V_inverse)
Here, I substitute m_(12) = Ab, m_(13) = Ac, m_(14) = Ad,
m_(21) = Ba, m_(23) = Bc, m_(24) = Bd,
m_(31) = Ca, m_(32) = Cb, m_(34) = Cd,
m_(41) = Da, m_(42) = Db, m_(43) = Dc,
y_1 = Ya, y_2 = Yb, y_3 = Yc, y_4 = Yd,
p_1t_1 = Xa, p_2t_2 = Xb, p_3t_3 = Xc, p_4t_4 = Xd.
Thank you.
https://stackoverflow.com/questions/67322498/python-inverse-matrix-of-an-2n-x-2n-matrix April 30, 2021 at 01:40AM
没有评论:
发表评论