Re: Multiple sum with iterators that cannot equal

*To*: mathgroup at smc.vnet.net*Subject*: [mg19392] Re: [mg19365] Multiple sum with iterators that cannot equal*From*: "Andrzej Kozlowski" <andrzej at tuins.ac.jp>*Date*: Mon, 23 Aug 1999 13:57:09 -0400*Sender*: owner-wri-mathgroup at wolfram.com

One simple way is as follows. Define a function, say f, by f[i_, i_] := 0 f[i_, j_] := Subscript[w, i]*Subscript[w, j] /; i != j and evaluate Sum[f[i, j], {i, 1, n}, {j, 1, m}] This is of course a pretty general method which can be used to find sums over idices satisfying various conditions. -- Andrzej Kozlowski Toyama International University JAPAN http://sigma.tuins.ac.jp http://eri2.tuins.ac.jp ---------- >From: Eric Spahr <rspahr at worldnet.att.net> To: mathgroup at smc.vnet.net >To: mathgroup at smc.vnet.net >Subject: [mg19392] [mg19365] Multiple sum with iterators that cannot equal >Date: Sat, Aug 21, 1999, 4:09 AM > > Using multiple summmation signs with condition 'i "not > equal" j', evaluation stops immediately as 'i' starts as > 1 as does 'j'. My formula requires that the 'i's' and > 'j's' together: > > Sum[Sum[f,{j,1,n}],{i,1,n}] ignore cases where i = j. > > Or as copied from my notebook: > > \!\(\(\(\[Sum]\+\(i = 1\)\%n\[Sum]\+\(j = 1\)\%n\)\+\(i > != j\)\) \(w\_i\) > w\_j\) > > How do I solve this without some cumbersome loops. > > Many Thanks > > Eric Spahr > Cottage Technology rspahr at worldnet.att.net > >