Solving linear set of equations
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a linear set of equations Ax=b, where A is not square (more variables than equations), A and b members is of integer type, and the vector x members needs to be integer>=0. which function from the MATLAB C++ math library can I use to solve this equation? (inv() works on square, non-singular matrixes) I would also like MATLAB to warn me if there is no solution..
0 个评论
采纳的回答
Walter Roberson
2011-8-8
What you describe would essentially be a set of simultaneous knapsack problems; such problems are not solvable by linear equation methods. See http://en.wikipedia.org/wiki/Knapsack_problem
2 个评论
Walter Roberson
2011-8-8
I did not say the problem was not solvable: I said it is not solvable using linear equation methods. The "\" operator cannot solve these kinds of equations over integers.
Consider that if you were to allow your x to be negative as well, what you would be describing would be a set of simultaneous linear Diophontine equations, http://en.wikipedia.org/wiki/Diophantine_equation . These are not solved using linear algebra.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!