Reputation: 495
I would like to get at least one solution for one t for this:
row_sum(Y) = x.t + row_sum(B)
Y and B are matrix(n, m) and x a vector(n). I know B, I know row_sum(Y) but not x. I would like to get the Y and x for some t value. Y variate linearly with t but x is constant vector.
How I can get create an equation with the sum of row on Y and B to get at the same times x and Y?
Upvotes: 3
Views: 2793
Reputation:
To get the sum of each row in a matrix, multiply it by a column vector of all ones. In general, if Z is a matrix, then
Z * ones(Z.shape[1], 1)
returns such a sum.
Here is a complete example of such manipulations, using the notation of your example.
from sympy import *
t = symbols('t')
Y = Matrix([[1+4*t, 2-t], [3-5*t, 4+t]])
x = symarray('x', (2,))
B = Matrix([[5, 4], [3, 2]])
solve(Y*ones(2, 1) - x*t - B*ones(2, 1))
The output is [{x_0: -3*x_1 - 9, t: 2/(x_1 + 4)}]
. The answer is not unique since there are only 2 equations with three unknowns t, x_0, x_1.
Upvotes: 5