1
$\begingroup$

I'm using a function involving a sum where some indices are excluded:

f[s_] := Sum[
   MoebiusMu[n]/n Log[Zeta[n s] (n s - 1)], {n, 
    DeleteCases[Range[1, 10], 1/s]}];
f[1] // N
f'[1] // N

f[1] works properly, but f'[1] yields an error because the exclusion is not respected. If I print f'[s] or even f[s], I can see that the excluded index is not actually being excluded in the symbolic expression.

How can I make Mathematica respect the exclusion? I also tried

f[s_] := Sum[
   If[n == 1/s, 0, MoebiusMu[n]/n Log[Zeta[n s] (n s - 1)]], {n, 1, 
    10}];

But then printing f'[s] shows that the n are not being substituted into the third argument of If.

$\endgroup$
5
$\begingroup$
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]

enter image description here

% // N

(* -0.850562 *)

Plot[{f'[s], f[s]}, {s, 0, 10},
 PlotLegends -> Placed["Expressions", {0.5, 0.5}]]

enter image description here

NMinimize[{f[s], 0 < s < 10}, s]

(* {-0.777008, {s -> 3.11071}} *)

FindRoot[f'[s] == 0, {s, 3}]

(* {s -> 3.11071} *)
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.