Le mardi 13 novembre 2012 02:00:28 UTC+1, Cleuson Alves a écrit : > Hello, I need to solve an exercise follows, first calculate the inverse > matrix and then multiply the first matrix. > > I await help. > > Thank you. > > follows the code below incomplete. > > > > m = [[1,2,3],[4,5,6],[7,8,9]] > > x = [] > > for i in [0,1,2]: > > y = [] > > for linha in m: > > y.append(linha[i]) > > x.append(y) > > > > print x > > [[1, 4, 7], [2, 5, 8], [3, 6, 9]] > > > > def ProdMatrix(x,b): > > tamL = len(x) > > tamC = len(x[0]) > > c = nullMatrix(tamL,tamC) > > for i in range(tamL): > > for j in range(tamC): > > val = 0 > > for k in range(len(b)): > > val = val + x[i][l]*b[k][j] > > c[i][j] > > return c
------ Pedagogical hint: Before blindly calculating the inverse matrix, it may be a good idea to know if the inverse matrix exists. jmf -- http://mail.python.org/mailman/listinfo/python-list