import numpy as np
gre = [float(a) for a in '11.7 2.7 75'.split()]
egg = [float(a) for a in '12.7 11.5 0.7'.split()]
sal = [float(a) for a in '1.4 90 0'.split()]
# Создаем матрицу
m = np.matrix([
gre, egg, sal
])
# Получаем обратную матрицу
m_inverse = np.linalg.inv(m)
# Перемножаем
need = np.array([100, 95, 150])
res = need.dot(m_inverse)
print(res)
import numpy as np
gre = [float(a) for a in '11.7 2.7 75'.split()]
egg = [float(a) for a in '12.7 11.5 0.7'.split()]
sal = [float(a) for a in '1.4 90 0'.split()]
# Создаем матрицу
m = np.matrix([
gre, egg, sal
])
# Получаем обратную матрицу
m_inverse = np.linalg.inv(m)
# Перемножаем
A = np.squeeze(np.asarray(m_inverse))
need = np.array([100, 50, 150])
res = np.multiply(A, need)
print(res)
[[-7.51942105e-02 4.02826128e+00 -1.54078308e+00]
[ 1.16968772e-03 -6.26618421e-02 1.69063440e+00]
[ 1.34502152e+00 -6.26152933e-01 1.79499323e-01]]