Question: Compact alternative

Hey!

The more "nodes, compartments, ..." I define the longer my formula (see below) gets. The formula posted below is written for a starting situation of 9 nodes (i,j,k,l,m,p,q,r,s). The problem that I have is that, besides running out of letters to chose from, the formula is getting to long and is not clear anymore (losing the overview). So I'm looking for a way to write it shorter, especially for the bold parts I assume there must be a better way.

B is a 9x9 matrix, n[0]:=1, N:=9

for i in n[0] do for j to N do for k to N do for l to N do for m to N do for o to N do for q to N do for r to N do for s to N do

if B(i, j) = 1 and B(j, k) = 1 and B(k, l) = 1 and B(l, m) = 1 and B(m, o) = 1 and B(o, q) = 1 and B(q, r) = 1 and B(r, s) = 1 and i <> j and i <> k and i <> l and i <> m and i <> o and i <> q and i <> r and i <> s and j <> k and j <> l and j <> m and j <> o and j <> q and j <> r and j <> s and k <> l and k <> m and k <> o and k <> q and k <> r and k <> s and l <> m and l <> o and l <> q and l <> r and l <> s and m <> o and m <> q and m <> r and m <> s and o <> q and o <> r and o <> s and q <> r and q <> s and r <> s

then P[loss, i, j, k, l, m, o, q, r, s] := P[loss, i, j, k, l, m, o, q, r]*P[fw, r, s]*P[suppr, i, j, k, l, m, o, q, r]*P[fo, s] else P[loss, i, j, k, l, m, o, q, r] := 0 end if; if P[loss, i, j, k, l, m, o, q, r] <> 0 then print(subs(I = i, J = j, K = k, L = l, M = m, O = o, Q = q, R = r, 'P[loss, I, J, K, L, M, O, Q, R]') = P[loss, i, j, k, l, m, o, q, r]) end if end do end do end do end do end do end do end do end do end do

 

I tried i<>j<>k<>l<>m<>o<>p<>q<>r<>s but that does't work

P.S.: Do you always have to specify something after ELSE using the IF loop? Actually I just don't want maple to do anything if the conditions are not met but since I then cannot print only the solutions I want (the ones for which the conditions are met) I always end up specifying something after else.

Thanks!!

Please Wait...