Making matrix solver/ solver for X

Gregory Ewing greg.ewing at
Sat Apr 14 20:49:33 EDT 2018

steffie.booij at wrote:
> Q = np.array(['Q1', 'Q2', 'Q3', 'Q4'])
> P = (X*Q)-X

I'm assuming that 'Q1', etc. are placeholders for numbers here?
Otherwise, you're doing arithmetic with strings, which doesn't
make sense.

> So solve condition:
> P[0]+P[1] ,P[0]+P[2] ,P[0]+P[3] ,P[1]+P[2] ,P[1]+P[3] ,P[2]+P[3] >= np.sum(X)

This looks like a linear programming problem:

except that there's no objective function (something to be
maximised or minimised) so there won't be a unique solution.

If you can frame it as a linear programming problem,
you could use this:

If there are no other constraints that the solution needs to
satisfy, then you could just make up an objective function,
e.g. tell it to minimise sum(X).

Also, if you can tell us more about the original problem you're
trying to solve, we may be able to help more.


More information about the Python-list mailing list