# Why does this code cause a kernel crash, but only when evaluated in a single cell?

I'm using MMA 10.1.0.0 on a MacBook Pro 11,3 (mid-2014, 16 GB RAM) running MacOS Sierra 10.12.3.

If I run this code in one cell (source: Need help translating Mathematica code to LaTeX)....

rose[x_, theta_] :=
Module[{phi = (Pi/2) Exp[-theta/(8 Pi)],
u = 1 - (1/2) ((5/4) (1 - Mod[3.6 theta, 2 Pi]/Pi)^2 - 1/4)^2, y,
r}, y = 1.95653 x^2 (1.27689 x - 1)^2 Sin[phi];
r = u (x Sin[phi] + y Cos[phi]);
{r Sin[theta], r Cos[theta], u (x Cos[phi] - y Sin[phi])}]

ParametricPlot3D[rose[x, theta], {x, 0, 1}, {theta, -2 Pi, 15 Pi},
PlotStyle -> {Glow[Red]}, PlotTheme -> {"NoAxis", "ZMesh"},
Lighting -> {{"Directional", GrayLevel[.4], {{0, 0, 1}, {0, 0, 0}}}},
PlotPoints -> {25, 250}]


Followed by this code in a separate cell....

ParametricPlot3D[rose[x, theta], {x, 0, 1}, {theta, -2 Pi, 15 Pi},
PlotStyle -> {Glow[Red]}, PlotTheme -> {"NoAxis", "ZMesh"},
Lighting -> {{"Directional", GrayLevel[.4], {{0, 0, 1}, {0, 0, 0}}}},
PlotPoints -> {25, 250}, Mesh -> False]


Everything works fine:

But if I try to run it all in one cell, the kernel (but not the program) crashes silently before completing the second graphic. The issue is reproducible — the kernel always crashes. Quitting and restarting MMA, and rebooting the Mac, has no effect.

Is there some reason I shouldn't be running this code in a single cell, or is this a known issue with MMA 10.1? If not, can others (especially those running 10.1 on a Mac) try replicating this?:

• I cannot reproduce this problem on V11.0.1 or V10.4 (Win 64, 24 GB RAM).
– gwr
Mar 11, 2017 at 18:02
• There were several types of crashes involving ParametricPlot3D that were fixed in 10.1.1, and at least a couple more in 10.3. My suggestion: upgrade. Mar 11, 2017 at 18:05
• @gwr Thanks for catching that, I've corrected it in the post. [Note to others: that was a copying error in the post; it does not affect my results—as can be seen from the screenshot, the bracket was present in the notebook.] Mar 11, 2017 at 18:10
• @rcollyer Thanks for letting me know, sounds like it is time to upgrade. But I'm going to wait three more days, until 3/14, to see if they offer another Pi Day promotion this year :). I'll report back after doing so. Mar 11, 2017 at 18:50