Path: news.mathworks.com!not-for-mail From: "Leon galushko" <leonid.galushko@rwth-aachen.de> Newsgroups: comp.soft-sys.matlab Subject: Re: linear equation with restrictions Date: Sat, 19 Jul 2008 21:14:02 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 30 Message-ID: <g5tleq$siu$1@fred.mathworks.com> References: <g5sgla$b7r$1@fred.mathworks.com> <g5sjfa$fbg$1@fred.mathworks.com> <g5td8a$s9q$1@fred.mathworks.com> <g5tep3$g7r$1@fred.mathworks.com> <g5thqi$h7d$1@fred.mathworks.com> <g5tj02$rj4$1@fred.mathworks.com> Reply-To: "Leon galushko" <leonid.galushko@rwth-aachen.de> NNTP-Posting-Host: webapp-02-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1216502042 29278 172.30.248.37 (19 Jul 2008 21:14:02 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sat, 19 Jul 2008 21:14:02 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1183838 Xref: news.mathworks.com comp.soft-sys.matlab:480482 "Bruno Luong" <b.luong@fogale.fr> wrote in message <g5tj02$rj4$1@fred.mathworks.com>... > "Leon galushko" <leonid.galushko@rwth-aachen.de> wrote in > message <g5thqi$h7d$1@fred.mathworks.com>... > > then should be equally given a message like > > you did in the code before: else > > > error('No (positive)integer solution exists') > > > > It's not that difficult, all we have to do is find a bracket > of an interval for 'k' so that both e1 and e2 are positives. > If the bracket contains at least one integer k, then there > is a solution (pick the k). > > In the above example the bracket interval is > [0.495614035087719 0.495652173913044], and of course no > integer k belongs to it. > > I let you figure out how to program this part in MATLAB. > > Bruno Well done! my really last question to: in case there are more variables than 2 in the equation (a1 * b2 + a2 * b2 + a3 * b3 = c) the solving with refering to GCD - Function of MATLAB falls down becaus gcd operates only with 2 elements? Thanks! Leon