# “MeasureDump” appears when using NIntegrate with decimal parameters

I have had a strange problem with NIntegrate. I have this function NInt2 depending on two complex parameters:

In[303]:=
Nint2[z1_, z3_] :=
Quiet[NIntegrate[
ComplexExpand[-2 I*z3/(z1 - z2)*1/(1 - Conjugate[z2]*z3), {z1, z2,
z3}] /. (z2 -> x + I*y), {x, y} \[Element] Disk[]]]
z1 = 1/2 - 0.1 I
z3 = I/2
Nint2[z1, z3]
2 Pi*Arg[1 - z1*Conjugate[z3]]
2 Pi*Arg[1 - z1*Conjugate[z3]] // N

Out[304]= 0.5 - 0.1 I

Out[305]= I/2

Out[306]= 3.14159 ((
0.5 + 0.1 I)/((0.26 + 1. Im[MeasureDumpX$178265[2.]] + Im[MeasureDumpX$178265[2.]]^2) (0. +
0.25 Re[MeasureDumpX$178265[1.]]^2)) - ((0.25 - 0.95 I) Im[ MeasureDumpX$178265[1.]])/((0.26 +
1. Im[MeasureDumpX$178265[2.]] + Im[MeasureDumpX$178265[2.]]^2) (0. +
0.25 Re[MeasureDumpX$178265[1.]]^2)) - ((0. + 0.5 I) Im[ MeasureDumpX$178265[1.]]^2)/((0.26 +
1. Im[MeasureDump`X$178265[2.]] + (and so on...) Out[307]= 1.46865 Out[308]= 1.46865 However if I define both numbers to have rational values then the problem disappears: In[292]:= Nint2[z1_, z3_] := Quiet[NIntegrate[ ComplexExpand[-2 I*z3/(z1 - z2)*1/(1 - Conjugate[z2]*z3), {z1, z2, z3}] /. (z2 -> x + I*y), {x, y} \[Element] Disk[]]] z1 = 1/2 z3 = I/2 Nint2[z1, z3] 2 Pi*Arg[1 - z1*Conjugate[z3]] // N Out[293]= 1/2 Out[294]= I/2 Out[295]= 1.53925 + 0.190458 I Out[296]= 1.53925 Do you have an idea of what this problem could be, and how to work around it? I would like to use random numbers as input eventually. • I think this depends on where you decide to apply the$(x,y)\$ replacement in your code. Try to do so within ComplexExpand, rather than after it. Also, why do you have Quiet? What are you suppressing? – MarcoB Feb 17 '17 at 15:52

To understand what is happening, consider

ComplexExpand[z2, z2]
(* I Im[z2] + Re[z2] *)

% /. (z2 -> x + I*y)
(* -Im[y] + Re[x] + I (Im[x] + Re[y]) *)

The code of Nint2, although more complicated, is doing the same thing. NIntegrate, not knowing what to do with the Re and Im operating on the variables of integration, returns the strange result shown in the question. (A more graceful response would be preferable.)

This problem can be eliminated by correcting the code to read

Nint2[z1_, z3_] := NIntegrate[ComplexExpand[-2 I*z3/(z1 - z2)*1/(1 - Conjugate[z2]*z3)
/. (z2 -> x + I*y), {z1, z3}], {x, y} ∈ Disk[]]

or more simply

Nint2[z1_, z3_] := NIntegrate[-2 I*z3/(z1 - z2)/(1 - Conjugate[z2]*z3)
/. (z2 -> x + I*y), {x, y} ∈ Disk[]]

since ComplexExpand is unnecessary here. Either way, the function with z1 and z3 as defined in the question yields

(* 1.46866 + 0.479793 I *)

along with warnings of poor convergence, presumably because the integrand is singular at a point in the domain of integration. However, the singularity appears to integrable, and the answer is insensitive to WorkingPrecision, so it probably is correct.

• Thanks a lot! You are right I should not use ComplexExpand here... It's only there because I copied the code from a another integral that suffered from instabilities without it, never mind why. – Wernli Feb 24 '17 at 14:27