[Numpy-discussion] Numpy inverse giving incorrect result
s.a.brown at ncl.ac.uk
Wed May 23 05:22:10 EDT 2012
I am running the following script as a basic input-output model but the
inverse function is bringing back an incorrect result (I have checked this
by inputting the data manually).I am very new to python but I assume the
error occurs in how the data is gathered from the csv but I don’t know how
to fix this. Any advice would be much appreciated.
from numpy import *
from numpy.linalg import *
from numpy import genfromtxt
conMatrix = genfromtxt("iopy.csv", delimiter=',')
print "Consumption Matrix (C)"
#print "Consumption Matrix (C)" #manually entered data
#conMatrix = numpy.matrix('0.4102 0.0301 0.0257; 0.0624 0.3783 0.1050;
0.1236 0.1588 0.1919')
identityMatrix = numpy.identity(3)
print "Identity Matrix (I)"
eyesee = numpy.subtract(identityMatrix, conMatrix)
inv = numpy.matrix(eyesee).I
d = numpy.matrix('39.24 60.02 130.65')
d.shape = (3,1)
View this message in context: http://old.nabble.com/Numpy-inverse-giving-incorrect-result-tp33894469p33894469.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
More information about the NumPy-Discussion