Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Integer solutions for a_1*x_1+a_2*x_2+a_3*x_3+ ...+a_4*x_n = k
Date: Tue, 18 Nov 2008 15:34:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <gfun9a$41t$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1227022442 4157 172.30.248.35 (18 Nov 2008 15:34:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 18 Nov 2008 15:34:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1582760
Xref: news.mathworks.com comp.soft-sys.matlab:501453


Hello, 

I am wondering how to write a function for solving

a_1*x_1+a_2*x_2+a_3*x_3+ ...+a_4*x_n = k

where
Inputs: 
n, k, and vector of non-negaive integer coefficients a=[a_1, a_2, ...a_n].     
k is some small positive integer, for example, k= 3, or k= 6, n is rather large positve integer, for example,, n = 20, or n= 60 or in some rare cases even n=100.

Output:
The unknowns x_1, x_2, ...x_n are non-negative integers.

I have asked a simplier version of this problem here, where a=[1, 1, ...1], and got lots of help from Walter, Bruno, Roger, John (thank you). 

But this problem... seems really difficult,  is it even possible to solve it in Matlab? Any ideas?

Thank you for your help!
Oriole






Thank you!!