Tag Info

New answers tagged

3

In the question, there is no summation over $\nu$, as there is in other answers. In case $\nu$ is not specified, as the OP explicitly states, and meant to be an index, here is a way to calculate the desired tensor without using Table and Sum. SymbolicTensors`ArrayContract[ TensorContract[ a \[TensorProduct] b \[TensorProduct] c \[TensorProduct] ...


5

Assuming $\mu$ and $\nu$ also run from 1 to 4 (which they have to, otherwise your expression doesn't make sense), you can simply take a cue from this Q&A and write TensorContract[ TensorProduct[LeviCivitaTensor[4], a, b, c], {{2, 5}, {3, 6}, {4, 7}} ] // Normal { -a4 b3 c2 + a3 b4 c2 + a4 b2 c3 - a2 b4 c3 - a3 b2 c4 + a2 b3 c4, a4 b3 c1 - a3 ...


2

You need to construct a "table" that acts like a vector a = {a1, a2, a3, a4}; b = {b1, b2, b3, b4}; c = {c1, c2, c3, c4}; Table[ Sum[LeviCivitaTensor[4][[mu, nu, alpha, beta]] a[[nu]] b[[alpha]] c[[beta]], {alpha, 1, 4}, {beta, 1, 4}, {nu, 1, 4}], {mu, 1, 4}]


0

Plus is protected. but you can use unprotect. Unprotect[Plus]; F_[1, j___] + F_[2, j___] + F_[3, j___] := Defer@Sum[F[i, j], {i, 1, 3}] Protect[Plus];


3

If you don't want to change the system options just to make Sum auto-compile, then you could instead replace Sum by Total: Clear[vec, time]; vec = Table[i, {i, 100}, {j, 100}, {k, 300}]; time = Timing[ Table[Total[vec[[i, j, 1 ;; 250]]], {i, 1}, {j, 1}]][[1]]; time The resulting timing doesn't show any significant difference between 249 and 250, and is ...


0

While this has been answered many times, let me answer it once more: varnum = 10; vars = Symbol["a" <> ToString[#]] & /@ Range[varnum]; of = Total[-vars^2 + vars^4]; Minimize[of, vars]


8

The default SumCompileLength is 250. You can increase this number for example to 500 using: SetSystemOptions["CompileOptions" -> {"SumCompileLength" -> 500}]


3

You should have read Simon Woods's answer more carefully. The difference between this question and the previous one is just you don't need to sum over $j$ and $k$ now, with almost same analysis, you can figure out that data2 is equal to $$ 2 {\left((d.d^T)^2\right)}_{ij}(1 - f_{ij})/4$$ So here is the code: a = AbsoluteTiming; data0 = Table[Exp[-((i + j ...


2

Like Ajasja said in a comment, Compile is your best friend here (short of completely rewriting S1 and S2 like in your other question). Simply compiling everything together: With[{d = data}, S2 = Compile[ {{i, _Integer}, {j, _Integer}, {t, _Real}}, 1/4*Sum[ (d[[i, k]] d[[j, m]])^2 + (d[[j, k]] d[[i, m]])^2 - 2 d[[i, k]] d[[j, ...


0

a bit of a cheat maybe: Z[n_] := Product[1/(1 - t^i), {i, 1, n}] P1[list_] := (Z[1]^2) P2[list_] := Z[2] Sum[P1[{i, j}]*t^(-i - j), {i, 0, j - 1}, {j, 0, Infinity}] + Sum[P2[{j, j}]*t^(-2 j), {j, 0, Infinity}] + Sum[P1[{i, j}]*t^(-i - j), {i, j + 1, Infinity}, {j, 0, Infinity}] // Simplify (t (-(-1 + t) t^-j + (t^2 (3 + t))/(1 + t)^2))/(-1 + t)^4 ...



Top 50 recent answers are included