Message Boards Message Boards

0
|
1253 Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

Plot3D double integration takes a long time?

Posted 1 year ago

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 double integral is improper but I'm certain it converges.

Help! Hints?

Thanks!

POSTED BY: Leonard Wapner

Strangely, when I copy your code and paste it into a notebook, the integration endpoints get reversed. However, if you feed the symbolic integral directly into Plot3D, it attempts symbolic integration over and over again for every value of a,b. You should pre-calculate the integral as much as possible, and also use NIntegrate:

expr0 = (1/(2*Pi))*
  Integrate[
   Integrate[E^((-(1/2))*(x - a)^2), {x, y, 0}]/E^((1/2)*(y - b)^2), 
      {y, Infinity, 0}]
f[a_?NumericQ, b_] = expr0 /. Integrate -> NIntegrate
f[1/2, 1/2] // Timing
Plot3D[f[a, b], {a, 0, 2}, {b, 0, 2}]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract