RE: alternating sums
- To: mathgroup <mathgroup at christensen.Cybernetics.NET>
- Subject: [mg313] RE: [mg307] alternating sums
- From: "Thomson, Peter" <PeterT at agric.usyd.edu.au>
- Date: Mon, 12 Dec 94 15:41:00 PST
Re: [mg307] alternating sums
Jack Golberg writes:
> Here's an elementary question that has me partially stumped. I often
> have occasion to convert mylist = {a1,a2,a3,...} into an alternating sum,
> a1-a2+a3-a4+... . I find it aesthetically unsatisfactory to generate a
> list of alternating plus and minus ones, multiply mylist with the
> alternating list and then Apply Plus to the product. ...
Try
Sum[A[[2i-1]]-A[[2i]],{i,1,n}]
where A is the array list, and 2n is the number of terms in the sum.
Peter Thomson
Biometry Unit Tel: +61-2-351-2535
Department of Crop Sciences Fax: +61-2-351-4172
University of Sydney NSW 2006 e-mail: petert at agric.usyd.edu.au
Australia