zuletzt SPOILER WARNING
On 2017-09-05 15:08, Pacher Christoph wrote:
> Re[(1-I)I^k] (12chars)
>
>
> Originalnachricht
> Von: Bill Gosper
> Gesendet: Dienstag, 5. September 2017 19:40
> An: math-fun(a)mailman.xmission.com
> Antwort an: math-fun
> Betreff: [math-fun] ++--++--...
>
>
> For alternating sign, multiply by (-1)^k.
> In[524]:= "(-1)^k" //StringLength
> Out[524]= 6
>
> Mathematica won't go 5:
> Syntax::sntxb: Expression cannot begin with "(-)^k".
>
> What's your favorite recipe for ++--++--...?
>
> In[515]:= "(-1)^Floor[k/2]" // StringLength
> Out[515]= 15
>
> is a little clumsy. But Mathematica accepts Floor brackets:
>
> In[525]:= "(-1)^⎣k/2⎦" // StringLength
> Out[525]= 10
>
> and then underunderstands Floor:
> In[518]:= Assuming[k∈Integers, FullSimplify[DiscreteRatio[(-1)^Floor[k/2],
> k]]]
>
> Out[518]= (-1)^(Floor[k/2] + Floor[(1 + k)/2])
>
> I have ten characters where
>
> In[529]:= FullSimplify[DiscreteRatio[**********, k], k∈Integers]
> Out[529]= (-1)^k
>
> How about you? --rwg
In[529]:= FullSimplify[DiscreteRatio[I^(k (k - 1)), k], k∈Integers]
Out[529]= (-1)^k
In[541]:= Table[I^(k (k - 1)), {k, 0, 9}]
Out[541]= {1, 1, -1, -1, 1, 1, -1, -1, 1, 1}
--rwg