I encountered a peculiar situation. I made a gif showing the problem.

enter image description here

You can see variable eig is different, after I created a new cell and simply reevaluated it. It seems that it substitute previous value of bandmix and delt. But I already cleared these two variables, as you can see they are all blue. What is going on here?

  • 2
    $\begingroup$ Nope... can't see anything. Post code (not images). $\endgroup$ – David G. Stork Jan 21 '18 at 3:08
  • $\begingroup$ Can we assume you've tried restarting the kernel? $\endgroup$ – aardvark2012 Jan 21 '18 at 4:46
  • $\begingroup$ @aardvark2012 No, on the contrary, I tried not to destroy this buggy state, so that if someone have some ideas to check something, I can do some following check. $\endgroup$ – matheorem Jan 21 '18 at 4:56
  • $\begingroup$ Hi, @David G. Stork, but I am afraid this buggy front end problem can not be checked with copying code. Because the code is quite normal $\endgroup$ – matheorem Jan 21 '18 at 4:58
  • 2
    $\begingroup$ @matheorem Is there any chance, you have a Manipluate or DynamicModule that is not shown in the screenshot? $\endgroup$ – halirutan Jan 21 '18 at 5:43

Here is a minimal example of what I believe happens. Consider a useless dynamic that sets a global variable test

 test = t,
 {t, 5, 10}

After evaluating this, you can move the slider and test is set appropriately. If you use the global variable test in a new cell, it will, of course, have this value. Now, let's say you do ClearAll[test] in a cell like you did, then test is un-set, but as soon as the dynamic content get's re-evaluated, it has again the slider value.

This seems to be happening for you. You clear your delt and bandmix and can calculate the expression. But then, something triggers a re-evaluation of one of your Manipulates at which point the variable get values again.

If this is the case, I hope you have learned your lesson about global variables. You can always use DynamicModule inside Manipulate to scope local variables.

  • $\begingroup$ Thank you so much. This solves problem. $\endgroup$ – matheorem Jan 21 '18 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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