Tag Info

0

Clean-up It's hard to read your code and it's hard to guess what you're asking for. We can make things a lot cleaner with a few tweaks. Firstly, you're defining $\delta$ by hand, when it's clearly just the KroneckerDelta. Next, in your definitions of t and x, Signature already handles whether the arguments are equal and/or ordered. So you can delete these. ...

3

Here's a way to make the syntax proposed in the commands work: Sum[f[{i1, i2, i3}], Evaluate[Sequence @@ Thread[{{i1, i2, i3}, 0, ∞}]]] Or using a predefined list l: l = {i1, i2, i3}; Sum[f[l], Evaluate[Sequence @@ Thread[{l, 0, ∞}]]] (* same output *)

1

One way: idx = {i1, i2, i3}; lower = {0, 1, 2}; upper = {2, 3, 4}; Sum[f[Sequence @@ idx], Evaluate[Sequence @@ Transpose[{idx, lower, upper}]]] (* f[0, 1, 2] + f[0, 1, 3] + f[0, 1, 4] + f[0, 2, 2] + f[0, 2, 3] + f[0, 2, 4] + f[0, 3, 2] + f[0, 3, 3] + f[0, 3, 4] + f[1, 1, 2] + f[1, 1, 3] + f[1, 1, 4] + f[1, 2, 2] + f[1, 2, 3] + f[1, 2, 4] + f[1, ...

5

You are admittedly probably better off using a package such as the one @qahtah mentioned in the comments or the package xAct, but just for fun, here is a way of defining a function EinsteinSum which does what you're looking for—unless I've misunderstood. If you have any questions about why this works the way it does, or if I've misunderstood what you're ...

0

Some things change to better. In 12.3 f[k_] = Sin[k]/k s[n_] := Sum[f[k]^n, {k, 0, \[Infinity]}] Table[{n, s[n]}, {n, 1, 7}] // Expand//FullSimplify {{1, (1 + \[Pi])/2}, {2, (1 + \[Pi])/2}, {3, 1/8 (4 + 3 \[Pi])}, {4, 1/6 (3 + 2 \[Pi])}, {5, 1/2 + (115 \[Pi])/384}, {6, 1/2 + (11 \[Pi])/40}, {7, 1/2 + (1/46080)\[Pi] (129423 + 4 (-7 + \[Pi]) \[Pi] (147 - ...

7

The sum is alternating, so you might need extra precision and NSumTerms: katsurda[x_] := NSum[(-x)^j/j! Zeta[j], {j, 2, Infinity}, WorkingPrecision -> 16, NSumTerms -> Max[15, 2 x]]; katsurdaApprox[x_] := x (Log[x] + 2 EulerGamma - 1) - Zeta[0]; plot1 = DiscretePlot[katsurda[x], {x, 0, 40, 2}]; plot2 = Plot[katsurdaApprox[x], {x, 0, 40}]; Show[...

3

The code for D[Sum[..],..] assumes no options to Sum, so Method -> "Procedural" is treated as an iterator. This is a bug. After assuming it's an iterator, the code fails internally because it's a bad iterator. This mysteriously leads to a derivative of {{0}}, which seems an unimportant bug. This last bug happens with D[Sum[(xx - x[j])^2, j], ...

3

Seems like the Sum option I was looking for is Method -> "Procedural": Sum[ -2 Exp[-(xx - Subscript[x, k])^2/(V + Subscript[Vx, k]^2)] Subscript[n, k] (xx - Subscript[x, k])/(V + Subscript[Vx, k]^2) , {k, nsp}, Method -> "Procedural"] // AbsoluteTiming

1

The expression is a ratio of two sums, and is very insensitive to $n$. Any $n\ge 10$ gives results equivalent to $n= \infty$. Therefore, redefine the expression for the limiting value of $n\rightarrow\infty$. The sum in the denominator is the Harmonic number of order $p$, or Zeta[p] when $n\rightarrow\infty$. The sum in the numerator is a linear combination ...

2

tl;dr I would consider this a bug, although not a surprising one. This is how one would normally write this sum in Mathematica: 1 + Sum[3, {i, n}, {j, i, n - 3}] To keep things simple, I will use the following simplified version: Sum[1, {i, n}, {j, i, n - 3}] (* 1/2 (-5 n + n^2) *) As you observe, the result is not correct for symbolic n. For an explicit ...

2

There is a subtle difference you need to account for with a Piecewise so that it doesn't incorporate the inner sum when your range(i,n-3+1) is empty: result[n_] := 1 + Sum[ Piecewise[{{Sum[i + j, {j, i, n - 3}], i < n - 3 + 1}}, 0] , {i, 1, n}] Mathematica can now generate a correct closed form for symbolic $n$ given by result[n]:  1+\left\{ \begin{...

4

Here is one way to force s to be non-negative by replacing s with Exp[logs]: solve[p_, n_, eps_] := (formula[s_] = 1/HarmonicNumber[n, p] Sum[(1 - 1/i^p)^s 1/i^p, {i, 1, n}]; invert[f_] := FindRoot[f[Exp[logs]] == eps, {logs, Log[2]}, AccuracyGoal -> 4, PrecisionGoal -> 4]; invert[formula]); logs /. solve[6, 1000, 10^-2] // Exp // Ceiling (* 39 *) ...

0

The Harmonic number $H_{n-1}$ can be expressed by the Digamma function $\psi(n)$ together with the Euler-Mascheroni constant $\gamma\approx 0.5772$. $\psi(n)=H_{n-1}-\gamma$ In MMA $\psi(n)$ and $\gamma$ are called by PolyGamma[n] and EulerGamma. Table[Limit[(PolyGamma[k] + EulerGamma)*k, k -> n], {n, 0, 4}] *( {-1, 0, 2, 9/2, 22/3} *) The limes is ...

Top 50 recent answers are included