# Why is Mathematica "de-evaluating" my expressions when I try to generate a Table? [duplicate]

I am attempting to plot a combination of StreamPlot and ParametricPlot that is a function of a parameter. When using Manipulate or Animate, the evaluation is slow but the graphs are outputted as intended.

However, when attempting to generate a Table of these plots over the same range of parameter values, Mathematica will both fail to generate any plots and will also "de-evaluate" all of my previous expressions (as if I had opened the notebook where I stored them for the first time)!

Mathematica will not output an error or otherwise indicate that there was an issue in the evaluation. Is there a simple fix, or is this some unavoidable bug?

Code that replicates the problem:

Sol[s_, T_] := {x[s], x'[s]} /.NDSolve[{x''[t] + Sin[x[t]]*(1/2 -(10)*Cos[8*t]) == 0, x[0] == Pi, x'[0] == 0.01}, x, {t, 0, T}];
p1[T_] := StreamPlot[{v, -Sin[x]*(1/2 - 10*Cos[8*T])}, {x, Pi - 0.05, Pi + 0.05}, {v, -0.05, 0.05}, StreamPoints -> Fine, FrameLabel -> {{\!$$\*OverscriptBox[\(\[CurlyPhi]$$, $$.$$]\),}, {\[CurlyPhi],"\!$$\*OverscriptBox[\(\[CurlyPhi]$$, $$..$$]\) + \sin(\[CurlyPhi])(1/2 - 10cos(8*" <> ToString[T] <> "))= 0"}}]
p2[T_] := ParametricPlot[Sol[s, T], {s, 0, T}];
plots2 = Table[Show[p1[T], p2[T]], {T, 0.001, 3.72*Pi, ((3.72*Pi) - 0.001)/100}];


In order to show the error isn't in the p1 or p2 objects, you can replace the Table line of code with Manipulate[Show[p1[T], p2[T]], {T, 0.001, 3.72*Pi}]and you will find both graphs plotted correctly.

• Table[Show[p1[T], p2[T]], {T, 1, 2}] works fine to plot two figures, you are probably trying to do too many different values of T. Commented Mar 22, 2019 at 2:46
• I agree that it’s probably a memory issue, but I’ve generated Tables of graphs of exactly the same size before and haven’t gotten this issue—I also don’t know why Mathematica wouldn’t throw up a “failure” message (or crash) if it just turned out to be a simple memory overload. Commented Mar 22, 2019 at 3:10
• The de-evaluation of the variables (they all turn blue) suggests that you have run out of memory and crashed the kernel. Why do you need to generate all these pictures? How are you going to look at 100 different pictures, all of which show basically the same thing as the final one? Commented Mar 22, 2019 at 4:24
• As it turns out, the memory error was coming not from storing the graphs but from some specific values of the parameter itself causing StreamPlot to fail (which is itself mystifying). Regarding why I’m storing these graphs, I usually export high-quality animations of graphics by storing the frames as a Table object and then using Export. Commented Mar 22, 2019 at 18:19
• @aghostinthefigures Would you summarize your findings in a self-answer? Commented Mar 22, 2019 at 18:40

StreamPlot[{v, -Sin[x]*(1/2 - 10*Cos[4.21486])}, {x, Pi - 0.05, Pi + 0.05}, {v,-0.05, 0.05}, StreamPoints -> Fine, FrameLabel -> {{\!$$\*OverscriptBox[\(\[CurlyPhi]$$,$$.$$]\),}, {\[CurlyPhi],"\!$$\*OverscriptBox[\(\[CurlyPhi]$$, $$..$$]\) + \sin(\[CurlyPhi])(1/2 - 10cos(8*T))= 0"}}]