Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

When I plotted an undefined function, Mathematica also spends considerable time to process it. It returns a blank figure necessarily. What confuses me is where the Plot spends the time.

For example, assuming that I forgeted to define the function f, I execute the code below. After a moment, I will get a blank graphics.

Plot3D[Im@f[1/4, u + I v], {u, -2, 2}, {v, -2, 2}, Mesh -> None,  
       PlotStyle -> Directive[Opacity[0.7], Orange], ImageSize -> Large, PlotPoints -> 50]

During this moment, what happened to Mathematica?

share|improve this question
add comment

1 Answer

If you enclose the Plot command with Timing, you can see that it does take some time, on my computer, about 0.05 seconds.

 Timing[Plot3D[ ... ]]

You can see what it's doing using

 Trace[Plot3D[ ... ]]

The answer is that it's doing a lot! It's going through lots of possible options, lots of system calls, lots of Charting, some Legends, and then some Graphics3D=$fail. Then you get the empty plot. All that in only 0.05 seconds!

share|improve this answer
It takes 20 seconds for me! –  cmc Apr 3 '13 at 13:51
It takes 20 seconds in Mathematica 8 and 0.04 second in Mathematica 9. –  cmc Apr 3 '13 at 13:54
@cmc I get 2.1 and 0.03, respectively. It runs faster on 9 because it processes the function differently, figuring out it is undefined pretty quickly. –  rcollyer Apr 3 '13 at 14:02
@rcollyer Those 2 seconds still seem quite excessive, and if the function is defined as f[x_, y_] /; x > 0 && y > 0 := 1, then it takes 2 seconds on v9 too. Also, these 2 seconds are measured on a relatively fast computer. I can imagine that a 5-6 year old laptop or a netbook would take 20 seconds. –  Szabolcs Apr 3 '13 at 14:38
@bill s, thanks for the Trace. I have always wondered if such a command was available (yet, never went to look for it). –  Sosi Apr 3 '13 at 14:40
show 2 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.