From: Csaba Henk Date: 2005-04-11T17:04:36+09:00 Subject: Re: Translating A Pattern of Data Into Equation, and ultimately code On 2005-04-11, Edgardo Hames wrote: > On Apr 10, 2005 8:45 PM, Zach Dennis wrote: > For columns numbered with a power of two (1, 2, 4, 8, 16, ...) the deltas are > the power of two alternating its sign +/-. > It's rather difficult to explain, so please, take a look at the following table: > > Input 1 2 3 4 5 6 7 8 9 10 11 12 > ----------------------------------- > Col 1 -1 +1 -1 +1 -1 +1 -1 +1 -1 +1 -1 +1 > Col 2 +2 -2 -2 +2 +2 -2 -2 +2 -2 -2 +2 +2 > Col 4 +4 +4 +4 -4 -4 -4 -4 +4 +4 +4 +4 -4 > Col 8 +8 +8 +8 +8 +8 +8 +8 -8 -8 -8 -8 -8 That's sort of cool! Congrats! I don't think there would be a concise expression for this table. I mean, there is no two-variable polynomial which would describe this table. Proof: assume there is p(x,y) s.t. the i-th element of the j-th row can be obtained as p(i,j). Then fix j=1. Thus you get a polynomial q(x) as well. Take the delta of it: d(x) = q(x) - q(x-1). That's a polynomial again, and we know its values at positive integers: d(n) = 1 if n is even and d(n) = -1 if n is odd. As you'd write in ruby, d(n).abs <= 1. But that's a contradiction, as polynomials tend to either plus or minus infinity at infinity. So the best formalization is writing an algorithm which calculates table values based on the description Edgardo gave. Csaba