I have two different Mathematica notebooks with similar, but different functions. Both work fine when they're the only notebook open. One of them consistently fails when the other notebook is open, despite my (liberal) use of Clear[] to clear out the relevant variables.
Call this one, say, GlobalManipulate
ClearAll["Global`*"]
Clear["Global`*"]
Definition[linear]
linear[x_] := a x;
quad[x_] := a x^2;
functionList := {linear, quad};
Manipulate[
Plot[function[dummy], {dummy, -10, 10}],
{function, functionList}, {a, -10, 10},
LocalizeVariables -> False, TrackedSymbols -> All
]
Call this one, say, LocalManipulate
Clear["Global`*"];
Manipulate[
{
linear := a x; quad := a x^2;
linear, quad, function,
Plot[ReleaseHold@function, {x, -10, 10}]
},
{function, {HoldForm@linear, HoldForm@quad}},
{a, -10, 10}, TrackedSymbols -> All
]
When run by itself, GlobalManipulate works as expected and I see the plot that updates as a
is changed. The definition of linear produces Null
.
When LocalManipulate is open, running, GlobalManipulate no longer works. even when it's rerun It's plot appears for a second and then vanishes.
I've reproduced this using my local copy of Mathematica 8 and a remote copy of Mathematica 7.
The problem must involve the functions linear[x_]
and quad[x_]
since
GlobalManipulatePrime:
ClearAll["Global`*"]
Clear["Global`*"]
Definition[linear]
linear1[x_] := a x;
quad1[x_] := a x^2;
functionList := {linear1, quad1};
Manipulate[
Plot[function[dummy], {dummy, -10, 10}],
{function, functionList}, {a, -10, 10},
LocalizeVariables -> False, TrackedSymbols -> All
]
works fine.
Edited to add bold text to stress that I'm rerunning Global, and that I'm trying to figure out why functions persist despite my ClearAll[].