Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

$$\sum_{k=1}^na_k=a_1+...+a_n$$ $$\prod_{k=1}^na_k=a_1\cdot...\cdot a_n$$ $$\large{?}\small{_{k=1}^na_k=a_1~\&\&...\&\& ~a_n}$$ What in mathematica would allow me to index logical statements in an operation like AND or OR? I'm trying to solve a system of n vector equations, so I can't afford to type them all in manually into the argument of Solve[].

Someone suggested that I take the product of the equations, i.e. if $a_i=(x_i=y_i)$, then $$a_1~\&\&...\&\& ~a_n\leftrightarrow \prod_{k=1}^n(x_i-y_i)$$ However, $x_i,y_i$ are vectors, and even their lengths vary, depending on $i$. Does anyone know how to solve this issue?

share|improve this question
5  
If you apply And: And @@ {a1, a2, a3} you'll get a1 && a2 && a3. (a1 && a2 && a3)[[2]] yields a2. –  Artes Jan 19 at 22:57

2 Answers 2

up vote 4 down vote accepted

Artes solution is probably the easiest

And @@ Array[b, 10]

but if you like the syntax of Sum, you can use it and then transform Plus into And

Sum[b[i], {i, 1, 10}] /. Plus -> And

Both of these give the logical And of the entries in the array b:

b[1] && b[2] && b[3] && b[4] && b[5] && b[6] && b[7] && b[8] && b[9] && b[10]
share|improve this answer

And @@ Outer[f, Range[10]] gets the job done.

share|improve this answer
    
I feel it would be "easier" to write And @@ (f /@ Range[10]) here. Outer with 2 arguments is Map. Or even And @@ f /@ Range[10] if you are feeling right associative :P. –  Jacob Akkerboom Jan 20 at 9:14
    
@JacobAkkerboom: You are tempting me to post the TuringMachine implementation... –  rasher Jan 20 at 9:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.