1
$\begingroup$

I'm a beginner on mathematica.. I'm trying to calculate a simple sum of a function,

F1[n_]:=NSum[(V^2*8)/d^2*(I*ω[m]-I*Sign[ω[m]]*Sqrt[(ω[m])^2 +
  (d/2)^2])*1/(I*ω[m]+I*ν[n]-Σf), {m, -Infinity, Infinity}]

Where:

ω[n_] := ((2*n + 1)*π)/β
ν[n_] := (2*n*π)/β
d=12
V=0.25
Σf = 1 + I
β=1

For n=2, for example. But when I try to do this it returns an error message:

"Summand (or its derivative)...is not numerical at point m = 15 "

But when I choose upper and lower bound of simulation with the function:

F2[n_, min_, max_] :=NSum[(V^2*8)/d^2*(I*ω[m] - 
  I*Sign[ω[m]]*Sqrt[(ω[m])^2 + (d/2)^2])*1/(I*ω[m] + I*ν[n] - Σf), {m, min, max}]

Mathematica returns a value for small limits, for example:

F2[2, -10, 10] = 0.000757504 - 0.00143062 I

But, for: F2[2, -100, 100] I have a similar error mensage.

"Summand (or its derivative)...is not numerical at point m = -85."

I will be grateful if someone help-me on this calculations of infinity sum.

$\endgroup$
5
  • 1
    $\begingroup$ First, you have mismatched parenthesis somewhere. Second, your function [Nu][n] needs a definition. $\endgroup$
    – bill s
    Commented Jul 8, 2016 at 15:36
  • $\begingroup$ I Forgot, [Nu][n_] := (2*n*[Pi]) And the parentesis is of [omega] that i mismatched. But the problem persist $\endgroup$
    – T. Cysne
    Commented Jul 8, 2016 at 15:58
  • $\begingroup$ Is Beta defined? $\endgroup$
    – Young
    Commented Jul 8, 2016 at 16:15
  • $\begingroup$ Yes, Sorry, I Choose [Beta]=1 $\endgroup$
    – T. Cysne
    Commented Jul 8, 2016 at 16:25
  • $\begingroup$ with V=1/4; F1[n_]:=NSum[Simplify[V^2* 8/d^2* (I* ω[m]-I* Sign[ω[m]]* Sqrt[ω[m]^2+(d/2)^2])* 1/(I* ω[m]+I* ν[n]-Σf)], {m,-Infinity, Infinity}]; F1[2] it quickly concludes ComplexInfinity $\endgroup$
    – Bill
    Commented Jul 8, 2016 at 17:02

1 Answer 1

5
$\begingroup$

Try changing the method of summation:

Clear["Global`*"]

β = 1;
d = 12;
V = 1/4;
Σf = 1 + I;
ω[m_] := ((2*m + 1)*π)
ν[n_] := (2*n*π)/β

F1[n_] := 
 NSum[(V^2*8)/
    d^2*(I*ω[m] - 
     I*Sign[ω[m]]*
      Sqrt[(ω[m])^2 + (d/2)^2])*1/(I*ω[m] + 
      I*ν[n] - Σf), {m, -Infinity, Infinity}, 
  Method -> "WynnEpsilon", WorkingPrecision -> 30]

0.0004521 - 0.0014314 I

Or increasing NSumTerms:

F2[n_, min_, max_] := 
 NSum[(V^2*8)/
    d^2*(I*ω[m] - 
     I*Sign[ω[m]]*
      Sqrt[(ω[m])^2 + (d/2)^2])*1/(I*ω[m] + 
      I*ν[n] - Σf), {m, min, max}, 
  NSumTerms -> 200000]

F2[2, -100000, 100000]

0.000450002 - 0.00143142 I

This post was helpful: Is this a bug of NSum?

Since NSum[] uses Euler-Maclaurin summation as its default, and since that method involves taking the derivative of the summand, you get what you observe. -J.M.

$\endgroup$
1
  • $\begingroup$ Now everything is working. In fact there is a problem with derivatives on this function. I'm in debit with you $\endgroup$
    – T. Cysne
    Commented Jul 8, 2016 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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