1
$\begingroup$

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: enter image description here enter image description here

enter image description here

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]
$\endgroup$
4
  • 5
    $\begingroup$ I've read the opening sentence multiple times, it still makes zero sense. $\endgroup$
    – ciao
    Feb 19, 2020 at 8:58
  • $\begingroup$ 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 $\endgroup$
    – Fraccalo
    Feb 19, 2020 at 9:00
  • 1
    $\begingroup$ @Fraccalo Thank you for your suggestion. I have revised the question statement. $\endgroup$ Feb 19, 2020 at 9:05
  • $\begingroup$ Thanks! That's much clearer now :) $\endgroup$
    – Fraccalo
    Feb 19, 2020 at 9:09

2 Answers 2

3
$\begingroup$
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}]
$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$ Feb 19, 2020 at 23:09
1
$\begingroup$

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!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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