Subscript
is not special except of the way it is formatted. Let's replace it with e.g. h
to clearly show what is the problem:
h[m, e] = 10;
m = 20;
m/h[m, e]
20 / h[20,e]
This was the first evaluation. You expected 10
instead of h[20, e]
but since nothing prevents m
or e
from evaluation you end up with h[20,e]
. And there is not any rule associated with h[20, e]
, only with h[m,e]
(since it was created before m
had value). You can confirm it with:
h[Unevaluated[m], e]
10
Now comes the second evaluation, which happens in different circumstances because m
already has a value 20
, which means that m
will freely evaluate and:
h[m, e] = 10;
Will add h[20, e] = 10
to downvalues of h
. Which will make
m/h[m, e]
evaluate in following steps:
m / h[m, e] ---> 20 / h[20, e] ---> 20 / 10 ---> 2
You can always use Trace
to inspect evaluation steps or use ?
to display rules associated with symbols. Where the latter was tricky in your case as it was about rules for Subscript
you've created.