# Generate this contour plot

I have the following complex function:

Fnew[a_, b_, c_, d_, e_, f_, g_] := (4 Sqrt[a/b] b E^(-(((c + d)^2 + (2 I a + b (c + d - 2 e) + 2 I f)^2/b^2)/(4 g^2))) Sqrt[a/(b g^2)] (π Erf[(2 a - I b (c + d - 2 e) + 2 f)/(2 b g)] + I (Log[-(b/(2 I a + b (c + d - 2 e) + 2 I f))] -
Log[b/(2 I a + b (c + d - 2 e) + 2 I f)])))/((2 a - I b (c + d - 2 e) + 2 f) Sqrt[π])


where all of the quantities a,c,d,e,f,g are real. I want the following contour plot

ContourPlot[Integrate[Abs[Fnew[1, 1, c, d, e, 0, g]]^2, {c, -∞, ∞}, {d, -∞, ∞}], {e, 0, 20}, {g, 0, 50}]


However the difficulty is in finding the integral of Abs[Fnew[1, 1, c, d, e, 0, g]]^2 first. Mathematica returns the same input.

Any suggestions on how to calculate this integral or generate the contour plot?

• ContourPlot only handles 2 dimensional functions! – Ulrich Neumann May 15 '19 at 13:05
• @UlrichNeumann, indeed! I am trying to plot the function over the variables e and g. – Sid May 15 '19 at 13:27
• Sorry! Perhaps you can take a step further bei substituting the integrand Abs[...]^2 by ComplexExpand[# Conjugate[#] &[Fnew[1, 1, c, d, e, 0, g]]] // Simplify – Ulrich Neumann May 15 '19 at 13:44

A workaround could be the numerical integration:

integrand[c_?NumericQ, d_?NumericQ, e_?NumericQ, g_?NumericQ] =
ComplexExpand[# Conjugate[#] &[Fnew[1, 1, c, d, e, 0,g]]] // Simplify

f[e_?NumericQ, g_?NumericQ] :=NIntegrate[integrand[c, d, e,g], {c, -\[Infinity], \[Infinity]}, {d, -\[Infinity],\[Infinity]}]


For example

f[1, 1]
(*72.8287*)


But evaluation is very slow, though ContourPlot[f[e,g],...] might run a long time.

• Using ComplexExpand[# Conjugate[#] instead of Abs[]^2 is in fact exactly what I had before. Using Conjugate usually is a little tricky since it conjugates all parameters rather than just changing I for -I. Also, how long would it take to generate a contour plot using f[e,g]? – Sid May 15 '19 at 15:02
• Setting , AccuracyGoal -> 3, PrecisionGoal -> 3 inside NIntegrate the calculation of one point lasts ~5seconds. ContourPlot might take >500seconds... – Ulrich Neumann May 15 '19 at 15:19
• ok, i guess I'll have to do a ListContourPlot. What should be a good step size for this? – Sid May 15 '19 at 15:22