필터 지우기
필터 지우기

Solving linear set of equations

조회 수: 2 (최근 30일)
Meytal
Meytal 2011년 8월 8일
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..

채택된 답변

Walter Roberson
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
Meytal
Meytal 2011년 8월 8일
The linear set of equations I'm talking about is supposed to be solvoable, because there are other constraints that I didn't mention.
an example for what I want to do:
the set of equations:
7 = 7a+15b
28 = 6b+7c
64 = 4c+3d
when I use '\', it will give me an answer: [0;0.4667;3.6;16.533]
but I need it with integers. for example, the answer [1;0;4;16] would be the answer I'm looking for.
is there any way to look for unsigned int vectors that will solve the equations?
Walter Roberson
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개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by