Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: making non integer values sum to n
Date: Fri, 21 Nov 2008 04:53:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 24
Message-ID: <gg5ere$gdr$1@fred.mathworks.com>
References: <17829314.1227222052740.JavaMail.jakarta@nitrogen.mathforum.org>
Reply-To: <HIDDEN>
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 1227243182 16827 172.30.248.37 (21 Nov 2008 04:53:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 21 Nov 2008 04:53:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:502242

Tim Smith <imaccormick@gmail.com> wrote in message <17829314.1227222052740.JavaMail.jakarta@nitrogen.mathforum.org>...
> Sorry for previous post it was slightly incorrect:
> Can anyone help me with this problem
> 
> where n is divisible by 4 and n,a,b are any real integers such that a+b<(n/2)
> 
> i need to create a statement such that:
> 
> integer((n-a-b)/4) + a + integer((n-a-b)/2) + b + integer((n-a-b)/2) = n
> 
> can anyone help?

  Your query is marred by a lack of clarity, Tim.  Besides the unclear phrase "create a statement" which John has pointed out, you don't make it clear what you mean by "integer" in "integer((n-a-b)/4)".  You also speak of "real integers".  What else can an integer be but real?

  Let's assume that by "integer(x)" you mean the "integer part of" as in Matlab's 'fix' function.  Substituting p for n-a-b in your equation gives the equivalent equation

 fix(p/4) + 2*fix(p/2) = p

  It is easy to show that there can be only seven possible integer solutions for p here: p = -7, -5, -2, 0, 2, 5, and 7.  However, for each of these there will be infinitely many possible combinations of n, a, and b that would satisfy all your conditions.  For example, n = 12 and any pair of integers, a and b whose sum is 5, of which there are infinitely many, would be solutions.

  In my mind this raises the question as to whether you have stated your problem correctly.

Roger Stafford