# Error Interpretation in NIntegrate

I am using a recursion algorithm developed by Migdal for Lattice Field Theory, and I have the following code:

(** The dimension of the representation **)
dim[r_] := 2 r + 1
(**The trace of a product around the loop, also the sum of the eigenvalues **)
χ[r_] := Sin[dim[r] θ/2]/Sin[θ/2]
(** The main equation in the paper I went out to 12 terms in the above sum **)
migdal[a_] := Sum[
((1/dim[r]) NIntegrate[(Sin[θ/2]^2)/(2 π) a χ[r], {θ, 0, 4 π}])^(λ^2)
* dim[r] χ[r], {r, 0, 3, 1/2}
]^(λ^(d - 2))

(** The λ used as expansion parameter **)
λ = 2^(1/10)

d = 4

l6 = Table[Table[Simplify[
Re[NIntegrate[
Log[Nest[
migdal,
Exp[(9/1000) (χ[1/2] - dim[1/2]) - (3/100000) (χ[1] - dim[1])
+ 0 (χ[3/2] - dim[3/2])],
i]] χ[j] Sin[θ/2]^2/(2 π), {θ, 0, 4 π}]]
], {i,0, 20}] , {j, 1/2, 1, 1/2}]


and it says that

NIntegrate::ncvb: "NIntegrate failed to converge to prescribed accuracy
after 9 recursive bisections in θ near {θ} = {9.71911}. NIntegrate obtained
6.127043317150083*^-15 and 1.1472584029987046*^-16 for the integral and
error estimates."


I have tried to change the MinRecursion, on the first NIntegrate, but then the integral converges too slowly, and there are further errors. Mathematica makes a number of recommendations having to do with changing error estimates, however I don't understand what it is referring to.

In my code $a$ is where my Boltzmann factor goes, more or less, as an initial input, followed by subsequent recursion of that factor. The factor itself depends the trace, $\chi$, and so depends on $\theta$.

FYI the initial conditions that are variable in this are the 9/1000, 3/100 000, and 0. The first two numbers are initial points that are plotted against each other with the first number corresponding to the x-axis, and the second corresponding to the y-axis. I have been varying their range andwhere from the current numbers to (1.2, 0.1) respectively.

If someone would be so kind as to help me with these error messages I would be grateful.

Thanks,

-
I think you should define \[Chi] = \[Chi][r_,\[Theta]_] in order to avoid confusion. For instance, there is \[Chi] both inside and outside NIntegrate in your definition of migdal. –  b.gatessucks Jun 15 '12 at 17:58
You could try to beautify your code a little –  belisarius Jun 15 '12 at 17:59
I would love to, I'm still a little naive though about coding, sorry... I will get better with practice I promise. I will try and rewrite the code so that it's more streamline and better looking. –  kηives Jun 15 '12 at 18:01
I think he's referring to the post itself which I formatted for you. When formatting code, I try to ensure that the reader does not have to scroll in order to read it. That way, mistakes or inconsistencies can be more easily seen. For instance, in your exponential you have the term 0 (χ[3/2] - dim[3/2]), and I don't know if you intended to keep that term, or not, because of the 0 coefficient. –  rcollyer Jun 15 '12 at 18:15
@kηives simple: LaTeX is enabled, so I used $\chi \pi \theta \lambda$ and copied the result from the preview pane. :) –  rcollyer Jun 15 '12 at 19:37

I found this to help somewhat. Note that it uses Chop, hence changes the semantics a bit. Probably not any more than different settings for NIntegrate though.

migdal[a_] :=
Sum[Chop[((1/dim[r]) NIntegrate[
ExpToTrig[
ExpandAll[
TrigToExp[(Sin[\[Theta]/2]^2)/(2 \[Pi]) a \[Chi][
r]]]], {\[Theta], 0, 4 \[Pi]},