# Computing multiple variable integral

I have a 2 variable function named 'wig', and I have to take double integral of its absolute value with respect to the variables p and q. Then subtract 1 from the final answer and 3D plot it with q and p. In short, I have to compute $$(\int\int dq dp |(wig)|) - 1$$ and then plot it. By using the following code, my integrals do not compute. Please tell me what is wrong with my code and how to correct it.

wig  = (2*(7 - 20*I*Sqrt[2]*p - 24*p^2 - 20*Sqrt[2]*q + 48*I*p*q + 24*q^2 + 8*(-3 + 8*p^2 + 8*I*p*(Sqrt[2] - 2*q) + 8*Sqrt[2]*q - 8*q^2)*Conjugate[p]^2 + 4*(-5*Sqrt[2] + 16*Sqrt[2]*p^2 + 28*q - 16*Sqrt[2]*q^2 - 4*I*p*(-7 + 8*Sqrt[2]*q))*Conjugate[q] + 8*(3 - 8*p^2 - 8*I*p*(Sqrt[2] - 2*q) - 8*Sqrt[2]*q + 8*q^2)*Conjugate[q]^2 + 4*Conjugate[p]*(-16*I*Sqrt[2]*p^2 - 4*p*(-7 + 8*Sqrt[2]*q) + I*(5*Sqrt[2] - 28*q + 16*Sqrt[2]*q^2) - 4*(-8*I*p^2 + 8*p*(Sqrt[2] - 2*q) + I*(3 - 8*Sqrt[2]*q + 8*q^2))*Conjugate[q])))/ (E^(2*Abs[-(1/Sqrt[2]) + I*p + q]^2)*(3*Pi*(Sqrt[2] - 4*I*p - 4*q)* (Sqrt[2] + 4*I*Conjugate[p] - 4*Conjugate[q])))

intofwig = Integrate[Abs[wig], q]

doubint = Integrate[intofwig, p]

delta = Solve[doubint - 1]

Plot3D[delta, {q, - 10 , 5}, {p, -10, 5}, PlotRange -> All]

• Your code has syntax errors. Also, I see no wig defined anywhere. It looks like you copied half the cell or something. Try again. Aug 16, 2023 at 10:22
• Oops let me fix that Aug 16, 2023 at 10:48
• I have tried to fix it. If I put it in a code block, 'wig' does not appear I don't know why. Aug 16, 2023 at 10:56
• No. You still have syntax errors. Ipq should be I*pq and ISqrt[2] should be I*Sqrt[2] and Ip should be I*p and IConjugate[p] should be I*Conjugate[p] and so on. Simply convert the code to input form and copy/paste that. All your I are for some reason stuck to the letters next to them. Aug 16, 2023 at 10:58
• Thanks. I copied the input form. Hope it's fine now Aug 16, 2023 at 11:02

wig = (2*(7 - 20*I*Sqrt[2]*p - 24*p^2 - 20*Sqrt[2]*q + 48*I*p*q +
24*q^2 +
8*(-3 + 8*p^2 + 8*I*p*(Sqrt[2] - 2*q) + 8*Sqrt[2]*q - 8*q^2)*
Conjugate[p]^2 +
4*(-5*Sqrt[2] + 16*Sqrt[2]*p^2 + 28*q - 16*Sqrt[2]*q^2 -
4*I*p*(-7 + 8*Sqrt[2]*q))*Conjugate[q] +
8*(3 - 8*p^2 - 8*I*p*(Sqrt[2] - 2*q) - 8*Sqrt[2]*q + 8*q^2)*
Conjugate[q]^2 +
4*Conjugate[
p]*(-16*I*Sqrt[2]*p^2 - 4*p*(-7 + 8*Sqrt[2]*q) +
I*(5*Sqrt[2] - 28*q + 16*Sqrt[2]*q^2) -
4*(-8*I*p^2 + 8*p*(Sqrt[2] - 2*q) +
I*(3 - 8*Sqrt[2]*q + 8*q^2))*Conjugate[q])))/(E^(2*
Abs[-(1/Sqrt[2]) + I*p + q]^2)*(3*
Pi*(Sqrt[2] - 4*I*p - 4*q)*(Sqrt[2] + 4*I*Conjugate[p] -
4*Conjugate[q])));

abs = Simplify@ComplexExpand@Abs[wig];
intofwig = Integrate[abs, q]


 doubint = Integrate[intofwig, p]


The above gets you the integral. I do not know what you are solving for what you type

delta = Solve[doubint - 1]


But I think you can take it from here since now the integrals evaluate.

May be you meant this?

delta=doubint-1
Plot3D[delta,{p,-1,1},{q,-1,1},AxesLabel->{"p","q"},
PlotLabel->"my nice plot in 3D",BaseStyle->14]


V 13.3 on windows.

• Thanks a lot! It works. Aug 16, 2023 at 11:13
• Yeah I am getting a bit different plot. Perhaps the reason is I am using the PlotRange-> All command. I am actually computing the negative region in the wigner function Aug 16, 2023 at 11:21
• @Anaya Adding PlotRange->All` does not change the plot for me. Screen shot !Mathematica graphics I am using V 13.3 May be you can post screen shot of the what you did showing the plot, starting from clean kernel. Aug 16, 2023 at 11:23
• My bad! I was actually using different values for 'q' and 'p'. Using your values, I got the same plot. Aug 16, 2023 at 11:25