MathGroup Archive 1994

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: alternating sums

  • Subject: [mg315] Re: [mg307] alternating sums
  • From: Dana_Scott at POP.CS.CMU.EDU
  • Date: Mon, 12 Dec 94 08:38:51 EST

How about this definition for computing the alternating
sum of a sequence?

AS[s_] := Plus@@(s[[2 Range[(Length[s] + 1)/2]-1]]) -
          Plus@@(s[[2 Range[Length[s]/2]]])

Of course the dot product with plusses and minusses is 
quite easy as well.

AS2[s_] := s.Table[(-1)^i, {i,0,Length[s]-1}]

  • Prev by Date: Plot curiousities ...
  • Next by Date: Re: Plot curiousities ...
  • Previous by thread: RE: alternating sums
  • Next by thread: Re: alternating sums