Numpy inverts a non-invertible matrix

I friend and I executed this line of code in Python 2 and Python 3: import numpy as np mat = np.array([[1,0,0],[-1,3,3],[1,2,2]]) np.linalg.inv(mat) Which returns: array([[ 1.00000000e+00, 0.00000000e+00, 0.00000000e+00], [ 1.5011998...
more »

2017-01-25 01:01 (2) Answers

Error with NumPy transpose

I'm trying to figure out what is going on here, but I'm a little bit baffled. I am getting unexpected results working with a transposed NumPy identity matrix (which should have no effect). For example: import numpy as np N = 1000 # case 1: A = np....
more »

2017-01-17 13:01 (0) Answers

associativity of matrix multiplication in numpy

I am playing with a simple numpy example and having hard time to understand why associative property of matrix multiplication ABC = (AB)C = A(BC) does not exactly hold. I assume the problem is with numeric stability. But how to address it? What i...
more »

2016-12-08 19:12 (0) Answers

Ax=b with b dependent on x

I understand how to solve Ax=b, but what if b is dependent on x? See in the pictures E3 = function(E4). I guess this is done iteratively.. what is such a problem called? what methods do I use to solve it? I am trying to solve the following system: ...
more »

2016-10-01 11:10 (2) Answers