I have a function of three discrete variables $f=f(n,m,p)$. It is known that the sum of $f$ over all three variables
$$F=F(N)=\sum_{n,m,p = 1}^N f(n,m,p)$$
can be expressed in terms of a sum $Q$ over a (known) function of only one variable
$$Q(N) = \sum_{n=1}^N q(n).$$
The functional $F=F[Q]$ is to be found in closed form, which is known to be possible for the function at hand.
Can this be done in Mathematica? I tried using the Collect[expr, x] function, but I don't think that will be able to do the job.
EDIT - To make the question more clear: I have a sum over multiple variables where it is possible to completely 'disentangle' the sum and write it in terms of simpler sums (over one variable). I want to find the original sum in terms of these simpler sums. E.g. when I have a sum F=Sum[q(n)*q(m)*q(p),{n, 1, N}, {m, 1, N}, {p, 1, N}]
I want to tell Mathematica: "Look, F can be written in terms of Q=Sum[q(n),{n,1,N}]
" and I want Mathematica to give me Out: Q^3
. This is a simple algebraic manipulation of resubstituting a sum into an expression. Can Mathematica do that?
Simple example:
$f(n,m,p) = \sin(n)\sin(m)\sin(p)$
(or anything else that factorizes into terms containing only one variable for that matter). Then we can write
$$F(N)=Q(N)^3 = \left(\sum_{n=1}^N \sin(n) \right)^3$$
and therefore the expression required is $F[Q]=Q^3$.
EDIT in response to a comment: An example where $F \neq Q^3$ is
$$f(n,m,p) = npq + np$$
with $Q(n)=n$. The answer here is $$F[Q] = Q^3 + Q^2.$$ However this comment made me realise that all the examples here will be super simple and have polynomial answers. That doesn't really matter however, the exercise is still to get Mathematica to find given sums over one variable in expressions with sums over multiple variables. A more complicated example that is not quite of the form I gave above could be something like
$$F=\left( \frac{\sum_n^N n}{1+\sin(\sum_m^N m)} \right)^{\sum_q^N q}$$
where the answer given that $Q=\sum_n^N n$ would be $F=\left( \frac{Q}{1+\sin(Q)} \right)^{Q}$. However since this is clearly not of the form $F=F(N)=\sum_{n,m,p = 1}^N f(n,m,p)$ and I also realise that this question is way to long for this simple problem already (my bad, sorry) let's forget about that.
Mathematica example from above:
q = Sin[l]
f = (q /. l -> n)*(q /. l -> m)*(q /. l -> p)
F = Sum[f, {n, 1, N}, {m, 1, N}, {p, 1, N}]
(*F[Q]=?*)
Also an example where the function F can't actually be evaluated explicitly for arbitrary $N$, but the functional F[Q] could still be found:
q = (Sqrt[l]*Sin[l])/(x - (l - 1)^2);
f = (q /. l -> n)*(q /. l -> m)*(q /. l -> p)
F = Sum[f, {n, 1, N}, {m, 1, N}, {p, 1, N}]
(*F[Q]=?*)
N
have a value (by the way, you should avoid usingN
as a variable since it already has a meaning in Mathematica)? $\endgroup$