I was showing the kids an infinite series with a "three phase" summand, i.e. a trinomial with different parts switched on or off depending on n mod 3. In[61]:= FindSequenceFunction[{0, 0, 1, 0, 0, 1, 0, 0, 1}, n] Out[61]= Mod[1 + 2 n^2, 3] That's pretty clever, but it befuddles Sum when it appears in multiple phases. "Luckily", Sum isn't much good with DirichletCharacter either, so I didn't have to figure out how to explain that to them. I expected In[65]:= FullSimplify[Sum[(-1)^(2*k*n/3), {n, 3}]/3, k \[Element] Integers] Out[65]= 1/3 (1 + (-1)^(2 k/3) + (-1)^(4 k/3)) In[67]:= Table[Simplify[%%], {k, 9}] Out[67]= {0, 0, 1, 0, 0, 1, 0, 0, 1} to work, but no. Not even In[69]:= FullSimplify[Re[%65], k \[Element] Integers] Out[69]= 1/3 (1 + Cos[(2 k \[Pi])/3] + Cos[(4 k \[Pi])/3]) I wound up having to trisect series into a nine term summand. Interestingly, FindSequenceFunction of every sixth term produces a trig expression equivalent to %69 if n -> 2n. But FullSimplify can't reduce it to %69. Trying to write the "general decimator" function exposed a serious issue with Sum: For a period of d-1 zeroes then 1, In[20]:= Assuming[d \[Element] Integers && k \[Element] Integers && d > 0, Sum[(-1)^(2*k*n/d), {n, d}]/d] Out[20]= ((-1)^((2 k)/d) (-1 + (-1)^(2 k)))/((-1 + (-1)^((2 k)/d)) d) This is either 0, or 0/0 ! Throwing in a Simplify In[21]:= Assuming[d \[Element] Integers && k \[Element] Integers && d > 0, Simplify[Sum[(-1)^(2*k*n/d), {n, d}]/d]] Out[21]= 0 ! Yet specializing d to 4, In[22]:= Sum[(-1)^(2*k*n/4), {n, 4}]/4 Out[22]= 1/4 ((-1)^k + (-1)^(2 k) + I^k + I^(3 k)) In[23]:= Table[%, {k, 9}] Out[23]= {0, 0, 0, 1, 0, 0, 0, 1, 0} I'm not even sure how to complain about this. What should Sum do? On top of all this, either my laptop is flaking, or there's a nonreproducible horror someplace: When I copied and pasted the section appearing as In|Out[61] above, $Line was actually 57. But what got pasted instead was some previous clipboard junk. When I went back to refetch In|Out[57], they had vanished! --rwg
Maple very occasionally suffers from a similar glitch. Hard to imagine how such bugs could ever be fixed --- even if there weren't a denumerable infinity of others waiting in the queue ahead! WFL On 11/11/14, Bill Gosper <billgosper@gmail.com> wrote:
... On top of all this, either my laptop is flaking, or there's a nonreproducible horror someplace: When I copied and pasted the section appearing as In|Out[61] above, $Line was actually 57. But what got pasted instead was some previous clipboard junk. When I went back to refetch In|Out[57], they had vanished! --rwg _______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
participants (2)
-
Bill Gosper -
Fred Lunnon