Using subscripts would significantly improve the structure of my code. Until now I used the following two lines to implement this.
Needs["Notation`"];
Symbolize[ParsedBoxWrapper[SubscriptBox["_", "_"]]];
This allows me to define a symbol like
Subscript[a, r] = 10
This works fine up to the point where I want to define e.g.
f[r_] = r Subscript[a, r][r]
I want the result to be
f[x] = 10 x
The problem is that Mathematica recognizes the r
in Subscript[a, r]
as an variable. Hence I can not use the subscript in such a case. Is there an easy way to solve this?