New answers tagged

3

Your example can be achieved using Map with a level specification, Partition to generate the sub-matrices and Tr to calculate the traces. ClearAll[a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p] r = {{a, b, c, d}, {e, f, g, h}, {i, j, k, l}, {m, n, o, p}}; Map[Tr, Partition[r, {2, 2}], {2}] {{a + f, c + h}, {i + n, k + p}}


2

If we assume that the symbol x is reserved for the matrices you're planning to use, and the individual matrices are named x[i], then you can do this: xProduct[indices__] := Signature[{indices}] Dot @@ x /@ {indices} xPerm[a_List] := Total[xProduct @@@ Permutations[a]] xPerm[{3, 4, 5}] (* ==> x[3].x[4].x[5] - x[3].x[5].x[4] - x[4].x[3].x[5] + x[4]....


2

Making the assumption that b>=0,c>=0 (not both), then this reduces 0<=a<33 and c=33-b-a (which is >0 as a is strictly less than 33). So the sum is equivalent to: (p1+p2+p3)^33-p1^3 If you wished to code the sum you could: f[p1_, p2_, p3_] := Module[{ip = Catenate@(Permutations /@ PadRight[IntegerPartitions[33, 3]]), mn, ps}, mn = ...


8

Sum[Boole[a + b + c == 33 && ((a > 0 || a == 0) && (b + c) > 0)] 33!/(a! b! c!) p0^a p1^b p2^c,{a, 0, 33}, {b, 0, 33}, {c, 0, 33}] But why bother with that, when Probability[(a > 0 || a == 0) && (b + c) > 0, {a, b, c} \[Distributed] MultinomialDistribution[33, {p0, p1, p2}]] Suffices and is ...


1

Sum[1 + x^n + x^(n^2/2), {n, 0.5, 10.5}]


2

Three ways of computing t[l]: Using Sum: Sum[ f @@ Table[i[j], {j, l}], ##] & @@ Table[{i[j], n}, {j, l}] Generating all index lists: Total[f @@@ Tuples[Range[n], l]] Recursive: rec[depth_] := If[depth == 0, f @@ Table[i[j], {j, l}], Sum[rec[depth - 1], {i[depth], n} ] ]; rec[l]


8

Mathematica returns Sum[BesselJ[n, x]^2/(n - k), {n, -Infinity, Infinity}] unevaluated. However, BesselJ[n, x]^2 and BesselJ[-n, x]^2 are equal, so the Sum can be rewritten as Simplify[-BesselJ[0, x]^2/k + 2 k Sum[BesselJ[n, x]^2/(n^2 - k^2), {n, 1, Infinity}]] (* -π BesselJ[-k, x] BesselJ[k, x] Csc[k π] *) which is the desired result. Its plot, here ...


1

After one week of constant trial and error, I discovered that I only have to use the attribute HoldAllComplete instead of HoldAll: SetAttributes[mySum, HoldAllComplete]; mySum[arg_, {index_Symbol, limits___}] := Block[{index, evaluatedarg}, Print["debug msg 1"]; evaluatedarg = arg; With[{replaceevaluated = evaluatedarg}, mySum[replaceevaluated,...



Top 50 recent answers are included