Message from discussion
Division matrix
Received: by 10.68.202.68 with SMTP id kg4mr10196123pbc.3.1352883849597;
Wed, 14 Nov 2012 01:04:09 -0800 (PST)
Received: by 10.68.242.74 with SMTP id wo10mr6810144pbc.9.1352883849577; Wed,
14 Nov 2012 01:04:09 -0800 (PST)
Path: s9ni9761pbb.0!nntp.google.com!kt20no12972657pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: comp.lang.python
Date: Wed, 14 Nov 2012 01:04:09 -0800 (PST)
In-Reply-To: <98b451e1-5cd5-46e9-8be4-59dcc835700b@googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.79.187.100;
posting-account=ung4FAoAAAC46zhHJ0Nsnuox7M5gDvs_
NNTP-Posting-Host: 83.79.187.100
References: <98b451e1-5cd5-46e9-8be4-59dcc835700b@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8a13e8d2-1dec-441a-85fe-19ba7a61d1a0@googlegroups.com>
Subject: Re: Division matrix
From: wxjmfa...@gmail.com
Injection-Date: Wed, 14 Nov 2012 09:04:09 +0000
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Le mardi 13 novembre 2012 02:00:28 UTC+1, Cleuson Alves a =E9crit=A0:
> Hello, I need to solve an exercise follows, first calculate the inverse m=
atrix and then multiply the first matrix.
>=20
> I await help.
>=20
> Thank you.
>=20
> follows the code below incomplete.
>=20
>=20
>=20
> m =3D [[1,2,3],[4,5,6],[7,8,9]]
>=20
> x =3D []
>=20
> for i in [0,1,2]:
>=20
> y =3D []
>=20
> for linha in m:
>=20
> y.append(linha[i])
>=20
> x.append(y)
>=20
>=20
>=20
> print x
>=20
> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
>=20
>=20
>=20
> def ProdMatrix(x,b):
>=20
> tamL =3D len(x)
>=20
> tamC =3D len(x[0])
>=20
> c =3D nullMatrix(tamL,tamC)
>=20
> for i in range(tamL):
>=20
> for j in range(tamC):
>=20
> val =3D 0
>=20
> for k in range(len(b)):
>=20
> val =3D val + x[i][l]*b[k][j]
>=20
> c[i][j]
>=20
> return c
------
Pedagogical hint:
Before blindly calculating the inverse matrix, it may be
a good idea to know if the inverse matrix exists.
jmf