Question: How can one decide if a vector is a positive linear combination of a list of vectors in Maple?

My goal is to find a positive linear combination of a vector vec over a set of vectors M1,...,M6. In this case the Mi are the columns of the matrix M.

My reasoning is: solve the linear system M.x=vec, which gives me a parametrized solution, then check if there is at least one positive solution.

M:=Matrix([[3, 0, 2, 2, 1, 1], [-1, -1, 0, -1, 0, -1], [0, 3, 0, 1, 1, 2], [3, 0, 1, 2, 0, 1], [-1, -1, -1, -1, -1, -1]]);

vec:= Vector[column](5, [3, 1, 0, 0, -2]);

x:=LinearSolve(M,vec, free = s);

Vector[column](6, [-1+2*s[2]+s[5]+s[6], s[2], 3-s[5], -3*s[2]-s[5]-2*s[6], s[5], s[6]])


But when I use the LinearMultivariateSystem function I get an error

LinearMultivariateSystem({x[1]>=0, x[2]>=0, x[3]>=0, x[4]>=0, x[5]>=0, x[6]>=0},[s[1],s[2],s[3], s[4], s[5],s[6]]);
Error, (in Utilities:-SimpleAnd) invalid input: a string/name list is expected for sort method `lexorder`


Can anyone tell me what is wrong in the code?

If I manually type in the expressions, and use variables such as x,y,z... then I get the solution, but I want to put the function into a loop.

I am very open to suggestions on how to decide if a vector is a positive linear combination of other vectors.



Please Wait...