# Generating continuous products or sum

This is kind of a continuation of this question.

I want to automate these 2 steps on Mathematica once I give an integer $N$.

• generate a list of variables $\{a_i\}_{i=1}^{i=N}$
• then for some function like $f(x) = e^{x}$ or $f(x) = \sin^2(x)$ compute an expression like $\prod\limits_{i \neq j} f(a_i - a_j)$ or $\sum\limits_{i < j} f(a_i - a_j)$ or $\prod\limits_ {i,j} f(a_i - a_j)$

( - and then hopefully integrate such expressions over all $a_i$...)

I am having to type these expressions by hand for every $N$ and that is very hard once $N$ gets large (one would typically have $\binom{N}{2}$ terms to type by hand!) I would like to know how this can be automated - since I would typically need to to use large $N$.

(...also, help with that previous question would be great!)

Implementing for example $\prod_{j>i}^Nf(a_i-a_j)$:
nup = 4;

where nup is $N$.
• ...or With[{nup = 6}, Times @@ f /@ Subtract @@@ Subsets[Array[a, nup], {2}]] – J. M.'s discontentment Oct 16 '12 at 18:51