I have a very simple function, as shown below
def new_price(A, B, x):
return np.linalg.inv(A @ B) @ x
These are the inputs I give it
A = np.array([
[2, 0, 1, 0],
[1, 1, 1, 1],
[0, 0, 0, 10]
])
B = np.array([
[3, 3, 3],
[2, 0, 8],
[0, 5, 3],
[0, 0, 10]
])
x = np.array([ 84, 149, 500])
This returns the array [ 1. 3. 5.]
. But, when I make the following equality check, it returns False
v1 = new_price(A, B, x)
v2 = np.array([1.0, 3.0, 5.0])
np.array_equal(new_price(A, B, [ 84, 149, 500]), np.array([1.0, 3.0, 5.0]))
I checked and the shapes and the types of both the arrays are same. What am I missing here?