axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Summing over a list


From: Alasdair McAndrew
Subject: [Axiom-developer] Summing over a list
Date: Wed, 23 May 2007 23:39:42 +1000

Given two lists,for example:

z:=[1,2,3,4,5,6]
w:=[1,0,0,1,1,1]

it seems that the sum of the pairwise product is obtained by

reduce(+,[z.i*w.i for i in 1..6])

which is all very well.  But why doesn't

sum(z.i*w.i,i=1..6)

work?  I mean, sum(i^2,i=1..6) is fine.

Thanks,
Alasdair

reply via email to

[Prev in Thread] Current Thread [Next in Thread]