1
$\begingroup$

I can usually crash the Mathematica Kernel by using Table to generate a List of ParametricPlots, as follows:

 testpara[α_] :=
 ParametricPlot[
  {
   {Cos[θ], Sin[θ]},
   {2 Cos[α] + Cos[θ], 
    2 Sin[α] + Sin[θ]},
   {r, 0}
   },
  {θ, 0, 2 π},
  {r, 1, 2},
  PlotRange -> 3,
  Frame -> False
  ]

Table[testpara[α], {α, 0, 2. π - π/36, π/36.}]

The current "high" number of plots, with a step size of π/36, crashes the Kernel every time. Starting with a large step size (eg. π/6) often works well on first execution, but also crashes if I execute the cell again. The smaller the step size (leading to a larger number of plots in the List), the higher the regularity of the Kernel crashes.

  • Surely a list containing 12 ParametricPlots isn't too much?
  • How can I prevent this crashing behavior?

(For example, is it something I can code differently, or do I need to change available memory in Options somewhere or ...?)

$\endgroup$
11
  • $\begingroup$ I cannot reproduce this problem (V10.1, Win7-32). $\endgroup$ Commented May 1, 2015 at 10:06
  • $\begingroup$ Failed to reproduce also in 9.0.1, 8.0.4, 7.0.1. $\endgroup$ Commented May 1, 2015 at 10:32
  • $\begingroup$ I have the problem in v10.1.0 (OSX 10.10.3 Yosemite, Intel i7 2.2 GHz, 16GB ram). $\endgroup$ Commented May 1, 2015 at 12:04
  • $\begingroup$ @zentient Unfortunately (or fortunately perhaps?) I can't reproduce your crash either. I am using V10.1 on Win7-64bit. As an aside, ParallelTable shaves at least a couple of seconds off the execution time on my system. Is there any difference if you use that instead of Table in your case? $\endgroup$
    – MarcoB
    Commented May 1, 2015 at 12:27
  • 1
    $\begingroup$ Confirmed w 10.1/linux. If I change the Table to Do it runs through but any attempt to retain all the plots (Reap/Sow , Append, etc ) result in a kernel quit with no error message $\endgroup$
    – george2079
    Commented May 1, 2015 at 14:09

2 Answers 2

4
$\begingroup$

On further look, your ParametricPlot expression is a bit odd. You have something like :

 ParametricPlot[{ f[t] , g[t] , h[r] } , {t,trange} , {r,rrange } .. ]

By supplying ParametricPlot with two independent variables it thinks you want to plot regions, yet none of your functions depends on both variables.

Try this:

 testpara[\[Alpha]_] := Show[{
       ParametricPlot[{
           {Cos[\[Theta]], Sin[\[Theta]]},
           {2 Cos[\[Alpha]] + Cos[\[Theta]],2 Sin[\[Alpha]] + Sin[\[Theta]]}
                       }, {\[Theta], 0, 2 \[Pi]},
                          PlotRange -> 3, Frame -> False],
       ParametricPlot[{{r, 0}}, {r, 1, 2}, PlotRange -> 3,
           Frame -> False, PlotStyle -> {Thick, Red}]}]
 Table[ testpara[\[Alpha]], {\[Alpha], 0, 2. \[Pi] - \[Pi]/36, [Pi]/36.}]

enter image description here ( Etc ... )

A more simple example in case that doesn't make sense: This apparently works just fine

 ParametricPlot[ { r, r^2  } , {r, 0, 1}, {p, 0, 1}]

enter image description here

but looking close,

 Cases[ Normal@% , _Polygon , Infinity] // Length

3136

that curve is rendered as thousands of tiny degenerate polygons.

Of course having the kernel just shut down is never acceptable, but it least we can sort of see why.

$\endgroup$
0
$\begingroup$
ClearAll[t, al];

set[t_, al_] := {{Cos[t], al + Sin[t]}, {2 Cos[al] + Cos[t], 2 Sin[al] + Sin[t]}, {al, t}};

ParametricPlot[set[t, al], {t, 0, 2 \[Pi]}, {al, 1, 2}, PlotRange -> All]

Table[set[1., al], {al, 0, 2. \[Pi] - \[Pi]/36, \[Pi]/36.}] // TableForm

Taking one parameter only in the Table, it works.

$\endgroup$
2
  • $\begingroup$ not sure what you mean to do , but this is a completely different figure. $\endgroup$
    – george2079
    Commented May 1, 2015 at 18:11
  • $\begingroup$ As it is I tried to put in two parameters only, at first to avoiding a crash as given combination is too cramped. $\endgroup$
    – Narasimham
    Commented May 1, 2015 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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