In[]:=
Module[{x=RandomReal[{0,10}],y=RandomReal[{0,10}],ζ},ζ=x+Iy;{ {"total contour integral", -I2πNIntegrate[zLog[1+z]/(((x-z)^2+y^2)((x+z)^2+y^2)),{z,0,∞}]+2π^2NIntegrate[z/(((x-z)^2+y^2)((x+z)^2+y^2)),{z,1,∞}]-I2πNIntegrate[zLog[z]/(((x-z)^2+y^2)((x+z)^2+y^2)),{z,1,∞}]}, {"2π * res sum", (Iπ)/(4xy)(-Log[1-x+Iy](π+Arg[x-Iy]-ILog[Abs[x-Iy]])-Log[1+x-Iy](π+Arg[-x+Iy]-ILog[Abs[x-Iy]])+Log[1+x+Iy](π+Arg[-x-Iy]-ILog[Abs[x+Iy]])+Log[1-x-Iy](π+Arg[x+Iy]-ILog[Abs[x+Iy]]))}, {"target integral (isolated from imaginary part of res sum)", NIntegrate[zLog[1+z]/(((x-z)^2+y^2)((x+z)^2+y^2)),{z,0,∞}]},{"remainder of imaginary part of res sum", 1/(8xy)((ArcTan[1-x,y]-ArcTan[y/(1+x)])Log[x^2+y^2]+πLog[(1+x)^2+y^2]-ArcTan[y/x]Log[((1-x)^2+y^2)((1+x)^2+y^2)])+NIntegrate[(zLog[z])/((z^2y^2+(xz-1)^2)(z^2y^2+(xz+1)^2)),{z,0,1}]} }]//Grid
Out[]=
total contour integral | 0.503277-0.63842 |
2π * res sum | 0.503277-0.63842 |
target integral (isolated from imaginary part of res sum) | 0.0529313 |
remainder of imaginary part of res sum | 0.0529313 |