(Followup on a puzzle to my usual suspects that I hope amuses other funsters) On Sat, Feb 8, 2014 at 5:30 PM, Bill Gosper <billgosper@gmail.com> wrote:
FullSimplify[ Sum[x^(4*n - 3)/(4*n - 3) + x^(4*n - 1)/(4*n - 1) - x^(2*n)/(2*n), {n,∞}] /. x -> 1
Out[448]= Log[2]
Sum[x^(4*n - 3)/(4*n - 3) + x^(4*n - 1)/(4*n - 1) - x^(2*n)/(2*n) /. x -> 1, {n,∞}]
Out[445]= Log[8]/2 --Bill
I assume nobody answered because it was embarrassingly obvious. This is a rearrangement of the series ln(1+x) = x - x^2/2 + x^3/3 - ... which becomes illegal when the series becomes conditionally convergent at x = 1, ln 2 = 1 -1/2 + 1/3 - ... . Why isn't this a counterexample to http://en.wikipedia.org/wiki/Abel%27s_theorem ? In any case, the infinite permutation 1, 3, 2, 5, 7, 4, 9, 11, 6, 13, 15, 8, 17, 19, 10, ... where we take two odds for every even, is a fun instrument for torturing Mathematica. First, let's make some terms to torture FindSequenceFunction. Starting with the evenly odd and oddly odd ones: In[23]:= Transpose[Partition[Range[1, 19, 2], 2]] Out[23]= {{1, 5, 9, 13, 17}, {3, 7, 11, 15, 19}} Tack on the even ones and riffle: In[25]:= Flatten[Transpose[Append[%23, 2*Range[5]]]] Out[25]= {1, 3, 2, 5, 7, 4, 9, 11, 6, 13, 15, 8, 17, 19, 10} Too bad Riffle fails here: In[63]:= Riffle[%[[1]], %[[2]], 2*Range[5]] During evaluation of In[63]:= Riffle::rspec: The third argument {2,4,6,8,10} should be a positive integer or a list with three integers. Out[63]= Riffle[{1, 5, 9, 13, 17}, {3, 7, 11, 15, 19}, {2, 4, 6, 8, 10}] Pressing on, In[26]:= FindSequenceFunction[%25, n] Out[26]= DifferenceRoot[ Function[{\[FormalY], \[FormalN]}, {-30 - 20 \[FormalN] + (-3 - 2 \[FormalN]) \[FormalY][\[FormalN]] + 6 \[FormalY][1 + \[FormalN]] + 6 \[FormalY][2 + \[FormalN]] + (3 + 2 \[FormalN]) \[FormalY][ 3 + \[FormalN]] == 0, \[FormalY][1] == 1, \[FormalY][2] == 3, \[FormalY][3] == 2}]][n] constructs for itself a recurrence it can't solve. Is it even an an answer? In[27]:= Table[%, {n, 14, 22}] Out[27]= {19, 10, 21, 23, 12, 25, 27, 14, 29} Sure enough, at least Mathematica understands it. Let's find a nicer formula by trisecting the sequence using In[28]:= FindSequenceFunction[{0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, n] Out[28]= Mod[1 + 2 n^2, 3] Actually, I expected In[39]:= Assuming[n \[Element] Integers, FullSimplify[Sum[E^(2*I*\[Pi]*k*n/3), {k, 3}]/3]] Out[39]= 1/3 (1 + 2 (-1)^n Cos[n π/3]) In[40]:= Table[%, {n, 8}] Out[40]= {0, 0, 1, 0, 0, 1, 0, 0} Mathematica seems completely unable to show the equivalence In[42]:= Assuming[n \[Element] Integers, FullSimplify[%39-%28]] Out[42]= 1/3 (1 + 2 (-1)^n Cos[(n \[Pi])/3] - 3 Mod[1 + 2 n^2, 3]) OK, so find me one counterexample: In[44]:= FindInstance[ 1 + 2 (-1)^n Cos[(n \[Pi])/3] != 3 Mod[1 + 2 n^2, 3], n, Integers, 1] Out[44]= {} Of course, it can't. But doesn't {}, without the usual disclaimer about how there might be examples beyond the ken of FindInstance, indicate conviction that there are none? Now let's make our sequence function using my triggy trisector because it will probably simplify more. We could introduce six(!) arbitrary functions by trisecting, e.g., {foo[1], bar[2], 2, foo[4], bar[5], 4,...} etc, but it's unlikely we could later choose those functions with greater simplification than plain old linear interpolation: In[64]:= InterpolatingPolynomial[{{3, 2}, {6, 4}}, n] // Expand Out[64]= (2 n)/3 In[65]:= Table[%, {n, 6}] Out[65]= {2/3, 4/3, 2, 8/3, 10/3, 4} In[66]:= InterpolatingPolynomial[{{1, 1}, {4, 5}}, n] // Expand Out[66]= -(1/3) + (4 n)/3 In[67]:= Table[%, {n, 6}] Out[67]= {1, 7/3, 11/3, 5, 19/3, 23/3} Combining (rather manually) all three: In[49]:= FullSimplify[%64*%39 + ((n + 1)/3*4 - 1)*(%39 /. n -> n + 1) + ((n + 2)/3*4 - 3)*(%39 /. n -> n + 2), n \[Element] Integers] gives our sequence function Out[49]= 2/9 (5 n - 2 (-1)^n n Cos[(n \[Pi])/3] + (-1)^n Sqrt[3] Sin[(n \[Pi])/3]) In[50]:= Table[%, {n, 15}] Out[50]= {1, 3, 2, 5, 7, 4, 9, 11, 6, 13, 15, 8, 17, 19, 10} Let's turn this into an actual function In[51]:= Function @@ {%49 /. n -> #} Out[51]= 2/ 9 ((-1)^#1 Sqrt[3] Sin[(\[Pi] #1)/3] + 5 #1 - 2 (-1)^#1 Cos[(\[Pi] #1)/3] #1) & and see if it satisfies that strange-looking recurrence from FindSequenceFunction: In[52]:= %26[[0, 1]][%, n] Out[52]= {-30 - 20 n + 2/9 (-3 - 2 n) (5 n - 2 (-1)^n n Cos[(n \[Pi])/3] + (-1)^n Sqrt[3] Sin[(n \[Pi])/3]) + 4/3 (5 (1 + n) - 2 (-1)^(1 + n) (1 + n) Cos[1/3 (1 + n) \[Pi]] + (-1)^(1 + n) Sqrt[3] Sin[1/3 (1 + n) \[Pi]]) + 4/3 (5 (2 + n) - 2 (-1)^(2 + n) (2 + n) Cos[1/3 (2 + n) \[Pi]] + (-1)^(2 + n) Sqrt[3] Sin[1/3 (2 + n) \[Pi]]) + 2/9 (3 + 2 n) (5 (3 + n) - 2 (-1)^(3 + n) (3 + n) Cos[1/3 (3 + n) \[Pi]] + (-1)^(3 + n) Sqrt[3] Sin[1/3 (3 + n) \[Pi]]) == 0, True, True, True} In[53]:= FullSimplify[%] Out[53]= {True, True, True, True} We didn't even need n \[Element] Integers. Now we can use the sequence function %49 to (illegally) rearrange ln 2 = 1 -1/2 + 1/3 - ... In[55]:= -(-1)^k/k /. k -> %49; In[56]:= Sum[%, {n,∞}] Out[56]=Sum[-((9*(-1)^((2/9)*(5*n - 2*(-1)^n*n*Cos[(n*Pi)/3] + (-1)^n*Sqrt[3]*Sin[(n*Pi)/3])))/ (2*(5*n - 2*(-1)^n*n*Cos[(n*Pi)/3] + (-1)^n*Sqrt[3]*Sin[(n*Pi)/3]))), {n, Infinity}] Unsurprisingly, Sum boggles. We can suppress all the period 3 trickiness by grouping terms three at a time. Because Sum uses inconsistent limit semantics, we need start at n=0 vs n=1: In[59]:= shift[%56, 1] Out[59]=Sum[(9*(-1)^((1/9)*(1 + 10*n + 4*(-1)^n*(1 + n)* Cos[(1/3)*(1 + n)*Pi] - 2*(-1)^n*Sqrt[3]* Sin[(1/3)*(1 + n)*Pi])))/ (2*(5 + 5*n + 2*(-1)^n*(1 + n)*Cos[(1/3)*(1 + n)*Pi] - (-1)^n*Sqrt[3]*Sin[(1/3)*(1 + n)*Pi])), {n, 0, Infinity}] My functions shift and triple are at the bottom. In[60]:= triple[%] Out[60]= Sum[(9*(-1)^((1/9)*(1 + 30*n + 4*(-1)^(3*n)*(1 + 3*n)* Cos[(1/3)*(1 + 3*n)*Pi] - 2*(-1)^(3*n)*Sqrt[3]* Sin[(1/3)*(1 + 3*n)*Pi])))/ (2*(5 + 15*n + 2*(-1)^(3*n)*(1 + 3*n)* Cos[(1/3)*(1 + 3*n)*Pi] - (-1)^(3*n)*Sqrt[3]* Sin[(1/3)*(1 + 3*n)*Pi])) + (9*(-1)^((1/9)*(1 + 10*(1 + 3*n) + 4*(-1)^(1 + 3*n)* (2 + 3*n)*Cos[(1/3)*(2 + 3*n)*Pi] - 2*(-1)^(1 + 3*n)*Sqrt[3]*Sin[(1/3)*(2 + 3*n)*Pi])))/ (2*(5 + 5*(1 + 3*n) + 2*(-1)^(1 + 3*n)*(2 + 3*n)* Cos[(1/3)*(2 + 3*n)*Pi] - (-1)^(1 + 3*n)*Sqrt[3]* Sin[(1/3)*(2 + 3*n)*Pi])) + (9*(-1)^((1/9)*(1 + 10*(2 + 3*n) + 4*(-1)^(2 + 3*n)* (3 + 3*n)*Cos[(1/3)*(3 + 3*n)*Pi] - 2*(-1)^(2 + 3*n)*Sqrt[3]*Sin[(1/3)*(3 + 3*n)*Pi])))/ (2*(5 + 5*(2 + 3*n) + 2*(-1)^(2 + 3*n)*(3 + 3*n)* Cos[(1/3)*(3 + 3*n)*Pi] - (-1)^(2 + 3*n)*Sqrt[3]* Sin[(1/3)*(3 + 3*n)*Pi])), {n, 0, Infinity}] This took over an hour to give up trying to simplify, when all it needed was to simplify the summand first! In[61]:= MapAt[FullSimplify[#, n \[Element] Integers] &, %, 1] Out[61]= Log[8]/2 Remember that? --rwg shift[xp_, s_] := xp /. (cf : ContinuedFractionK | cfk | mprd | MProd | Product | Sum)[ ab__, {v_, L_: 1, h_}] :> cf @@ Append[Simplify[{ab} /. v -> v + s], {v, L - s, h - s}] pair[xp_] := xp /. (op : mprd | MProd | Product | Sum)[ab__, {v_, L_: 1, h_}] :> op[(op /. mprd | MProd -> Dot)[ab /. v -> 2*v + ¢, {¢, 0, 1}], {v, L/2, (h - 1)/2}] triple[xp_] := xp /. (op : mprd | MProd | Product | Sum)[ab__, {v_, L_: 1, h_}] :> op[(op /. mprd | MProd -> Dot)[ab /. v -> 3*v + ¢, {¢, 0, 2}], {v, L/3, (h - 2)/3}] I should have called them bisect and trisect.