# Plot3D Question Involving Double Integral Taking a Long Time to Execute

I'm trying to plot f(a,b) over [0,2]x[0,2] using Plot3D. See attached. I terminate after letting it run for 10 minutes because I get no output and no error messages. Should it take longer than this? I'm able to evaluate the function without a problem but, for some reason, I'm unable to plot it. I believe the syntax is correct. The expression involves an improper integral which definitely converges.

• (1) People here generally like users to post code as Mathematica code instead of just images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find the meta Q&A, How to copy code from Mathematica so it looks good on this site, helpful. (2) You're recomputing the integral for every point computed for the plot. It's probably better to compute the integral first. Oct 1, 2022 at 15:20

\$Version

(* "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)" *)

Clear["Global*"]

int1[a_, y_] = Integrate[Exp[-(x - a)^2/2], {x, 0, y}]

(* Sqrt[π/2] (Erf[a/Sqrt[2]] - Erf[(a - y)/Sqrt[2]]) *)

int2[a_?NumericQ, b_?NumericQ] :=
1/(2 Pi) NIntegrate[Exp[-(y - b)^2/2] int1[a, y], {y, 0, Infinity}]

Plot3D[int2[a, b], {a, 0, 2}, {b, 0, 2},
AxesLabel -> Automatic]
`