# How to sum like this

I want to sum as follows, where j is from 1 to n in each sum (if s is added to 2 when j is not added to n, then j does not need to be n):

$$Table[\sum_{s=k,j=1}^{n}(s+j),\lbrace{k,0,n\rbrace}]$$ We should get the following results (if n = 2):

{9,6,3}


I can achieve this goal like this, but is there any better way?

Table[(j = 0; Sum[(j = j + 1; (s + j)), {s, k, 2}]), {k, 0, 2}]


In fact, I have to use the sum symbol sum to do something similar to the following figure:

I deal with it like this, but I wonder if there is any other way:

boundaryD[kernelF_, x_, f_, n_: 1] :=

Module[{j},
Table[(j = 0;
Sum[(j = j + 1; (-1)^(j - 1)
D[D[kernelF, D[f[x], {x, s}]], {x, j - 1}]), {s, k, n}]), {k,
1, n}]]
boundaryD[F[x, y[x], y'[x], y''[x]], x, y, 2]

• I've read the opening sentence multiple times, it still makes zero sense.
– ciao
Feb 19, 2020 at 8:58
• I'm struggling to understand what you want to implement. Can you try to rephrase the rule you need to implement? It's clearly not the equation you show, as it wouldn't lead to the output you are looking for Feb 19, 2020 at 9:00
• @Fraccalo Thank you for your suggestion. I have revised the question statement. Feb 19, 2020 at 9:05
• Thanks! That's much clearer now :) Feb 19, 2020 at 9:09

ClearAll[tbl]
tbl[n_] := Array[(n + 1) (n + 2 - #) &, n + 1]

tbl[2]


{9, 6, 3}

tbl[5]


{36, 30, 24, 18, 12, 6}

Alternatively,

tbl2[n_] := Table[(n + 1) (n + 2 - i), {i, n + 1}]

• Thank you very much. In fact, I have to do this using the summation symbol sum, and I've changed the statement to explain why. Feb 19, 2020 at 23:09

An alternative way of getting the same output is this:

Range[(n + 1)^2, n + 1, -n - 1]


or equivalently:

Table[i, {i, (n + 1)^2, n + 1, -n - 1}]


not sure it's what you are looking for though!