6

seq = Table[Sum[(1 + Cos[k Pi/n])^n, {k, 1, n - 1}], {n, 10}] // FullSimplify; sum1 = FindSequenceFunction[seq, n] // FullSimplify (* 2^(-1 + n) (-1 + (2 Gamma[1/2 + n])/(Sqrt[π] Gamma[n])) *) To convert the ratio of Gamma functions to a Binomial function repl = Gamma[a_]/Gamma[b_] :> Gamma[1 + a - b] Binomial[a - 1, b - 1]; sum2 = sum1 /. ...


5

Clear[f] Use Piecewise f[s_] := Sum[ Piecewise[{{MoebiusMu[n]/n Log[Zeta[n s] (n s - 1)], n != 1/s}}], {n, 1, 10}]; f[1] (* -(1/2) Log[π^2/6] + 1/6 Log[π^6/189] + 1/10 Log[π^10/10395] - 1/3 Log[2 Zeta[3]] - 1/5 Log[4 Zeta[5]] - 1/7 Log[6 Zeta[7]] *) % // N (* -0.591981 *) f'[1] % // N (* -0.850562 *) Plot[{f'[s], f[s]}, {s, 0, 10}, ...


4

You can use ReplaceAll: sum = Sum[Subscript[b, k] x^k, {k, 0, Infinity}]; x sum /. a_. Sum[s_, r__] :> Sum[a s, r] TeXForm @ % $\sum _{k=0}^{\infty } b_k x^{k+1}$


3

First, I explored the meaning of the error message: NSum[f[n], {n, 1, 100}] NSum::nsnum: Summand (or its derivative) [Piecewise] <<1>> is not numerical at point n = 16. The error message suggests evaluating f and its derivative at 16: f[16] f'[16] (* 0.0454989 -0.0802852 + 0.0523825 Derivative[1][Re][16] *) Aha! The derivative of f has a ...


2

I tried: decompose[p1_, p2_] := Module[{x1 = p1, x2 = p2}, If[x1 <= x2, count = 0; Do[count++; Print[k1, x2 - x1 + 2 k2, k1], {k1, 0, x1}, {k2, 0, x1 - k1}]; Print["Total of ", count], Print["Wrong values for the p1 and the p2"]]]; decompose[2, 2]; The output is: 000 020 040 101 121 202 Total of 6 The do loop function ...


1

Define a function that can only be called with a numerical argument $i$: f[i_?NumericQ] := NIntegrate[i + x, {x, 1, 7}] Numerical sum without possibility of analytic attempts at integration: NSum[f[i], {i, 1, 7}] (* 336. *)


1

You can use DistanceMatrix and use Total with the upper part of the matrix: rowtotaldistances = Total[UpperTriangularize[DistanceMatrix[#],1],{2}]& m = Partition[Range[0,10],2]; TeXForm @ MatrixForm @ m $\left( \begin{array}{cc} 0 & 1 \\ 2 & 3 \\ 4 & 5 \\ 6 & 7 \\ 8 & 9 \\ \end{array} \right)$ TeXForm @ MatrixForm[...


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