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[MeasureDump`X$178265[2.]] +
Im[MeasureDump`X$178265[2.]]^2) (0. +
0.25 Re[MeasureDump`X$178265[1.]]^2)) - ((0.25 - 0.95 I) Im[
MeasureDump`X$178265[1.]])/((0.26 +
1. Im[MeasureDump`X$178265[2.]] +
Im[MeasureDump`X$178265[2.]]^2) (0. +
0.25 Re[MeasureDump`X$178265[1.]]^2)) - ((0. + 0.5 I) Im[
MeasureDump`X$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.
ComplexExpand
, rather than after it. Also, why do you haveQuiet
? What are you suppressing? $\endgroup$