This is not how Dynamic
work. May be the name Dynamic
is confusing. I think WRI should have picked a better name. But all what Dynamic
does, is keep the value of expression inside it up-to-date, at the spot in the screen the Dynamic
is located.
Lets try new name. Call it keepUpToDate
. So you can see that saying keepUpToDate[5]
does not make sense, since 5
can not change. It is a number, not a symbol. But when you write keepUpToDate[a]
then now everytime a
changes elsewhere, because may be your code did a=99
, then the spot where keepUpToDate[a]
is located, will update to the new value of a
which is 99
. So you will this spot keep changing as you change a
elsewhere in the notebook.
So each time you see Dynamic[someExpression]
replace it in your mind by keepUpToDate[someExpression]
. Mathematica keeps track of every symbol that changes in the notebook which is tagged as Dynamic
, When it sees a dynamic symbol change, it will go back and update everywhere an Dynamic expression that had this symbol in it, on that spot.