6

You can use Sum to iterate twice through the set of lattice points. lattice = Catenate@Table[{x, y}, {x, 0, 3}, {y, 0, 3}] (* {{0, 0}, {0, 1}, {0, 2}, {0, 3}, {1, 0}, {1, 1}, {1, 2}, {1, 3}, {2, 0}, {2, 1}, {2, 2}, {2, 3}, {3, 0}, {3, 1}, {3, 2}, {3, 3}} *) Sum[F[p1, p2], {p1, lattice}, {p2, lattice}]] (* F[{0, 0}, {0, 0}] + F[{0, 0}, {0, 1}] + F[{0, 0}...


3

Inactivate has attribute HoldFirst, that is why Inactivate[ft, Sum] by itself doesn't inactivate your sum. You have to first bypass this HoldFirst with Evaluate. ft = easyFourierTrigSeries[f, {x, -\[Pi], \[Pi]}, \[Infinity]] D[Inactivate[Evaluate[ft], Sum] // ReleaseHold, x] (* Inactive[Sum][-(( 4 (-1)^\[FormalK] Sin[\[FormalK] x])/\[FormalK]), {\[FormalK]...


3

sum1 = Total[F @@@ Tuples[Range[0, 3], {2, 2}]] sum1 // Short F[{0, 0}, {0, 0}] + F[{0, 0}, {0, 1}] + F[{0, 0}, {0, 2}] + << 250 >> + F[{3, 3}, {3, 1}] + F[{3, 3}, {3, 2}] + F[{3, 3}, {3, 3}] sum2 = Array[F[{#, #2}, {##3}] &, {4, 4, 4, 4}, 0, Plus]; sum2 == sum1 True


1

You can try permuting the variables and then sorting and taking the first element of the result. For instance: canon[expr_, vars_List] := First @ Sort @ ReplaceAll[ expr, Thread[vars -> Permutations @ vars] ] Then: c1 = canon[n1 + 2 n2, {n1, n2}] c2 = canon[2 n1 + n2, {n1, n2}] c1 === c2 2 n1 + n2 2 n1 + n2 True


1

Try with the following code: RowsSum[nmax_Integer?Positive, length_Integer?Positive, vector_List] := Module[ {matrix, matrixrows, s}, matrix = Table[i, {i, nmax}, {length}]; matrixrows[vector2_List, matrix_] := matrix[[vector]]; s = Flatten@Map[Total, List[matrixrows[vector, matrix]]]; Return[s]; ]; Test: RowsSum[12, 4, {1, 5, 9}] (*{15, 15, 15, 15}*) ...


Only top voted, non community-wiki answers of a minimum length are eligible