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
Re[(1-I)I^k] (12chars) Originalnachricht Von: Bill Gosper Gesendet: Dienstag, 5. September 2017 19:40 An: math-fun@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 _______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
participants (2)
-
Bill Gosper -
Pacher Christoph