Mike,
I woke up remembering that there was an example in the documentation highlighting the way that Animate interacts with normal evaluation order that is worth studying.
Animate[Plot[
Evaluate[{Sin[x], Normal[Series[Sin[x], {x, 0, n}]]}], {x, -10, 10},
PlotRange -> 3], {n, 1, 20, 2},
AnimationDirection -> ForwardBackward, AnimationRunning -> False]
Note that if you remove the Evaluate, it errors because when Animate evaluates its expression, it sets n to be a value and evaluates the Plot, however, Plot will set a value for x everywhere in the term
{Sin[x], Normal[Series[Sin[x], {x, 0, n}]]}
which is a problem because Series needs to have a variable, not a number where 'x' appears. So the evaluation must be controlled so that n is first given a value, then the Series[] is evaluated, and only then can x
take on values in the Plot[]. Animate handles the assignment of n but the Evaluate[] causes the Series to be evaluated out of order -- it comes first before Plot[] sets a value for x
. You can edit the example and see the errors and see why it breaks.
To be a bit more clear, the Evaluate really only needs to be around the Series[] because this is the part that has evaluation order issues.
Animate[Plot[{Sin[x],
Evaluate[Normal[Series[Sin[x], {x, 0, n}]]]}, {x, -10, 10},
PlotRange -> 3], {n, 1, 20, 2},
AnimationDirection -> ForwardBackward, AnimationRunning -> False]
(Also note that even without the Animate, the Evaluate[] is necessary because the error arises because of the Plot[]. The animate makes it conceptually harder because it adds another variable, n
, to the evaluation order issue.)
Your original term
Graphics[gList, PlotRange -> {{-5, 5}, {-4, 4}}]
has a similar problem -- if you evaluate that Graphics[] expression, it errors because the variable t
is not yet defined.
I hope this helps.
Regards,
Neil