When defining packages, can I put parameter values alone or along with functions into a package in subscripted form?
BeginPackage["Myfunction`"];
Subscript[q, 1] = 0;
Subscript[q, 2] = 0.5;
myfunction::usage ="...";
Begin["`Private`"];
myfunction[ak__List] := blablabla...;
End[];
EndPackage[];
Because these global subscripted parameters in the package are needed in many programs, I separated them from the main programs and put them into a single package. In the main programs, I only need to load the package rather than bothering to redefine these parameters again. For plain symbols, it works fine. But whem it comes to subscripted symbols, it fails. And I found that is because I used
Symbolize[ParsedBoxWrapper[SubscriptBox["_", "_"]]];
in the main program. subscripted symbols like
Subscript[q, 1]
are transformed into
q_Subscript_1
I also tried to use Symbolize function in the package, but it fails. The clarity for using subscripted symbols made me reluctant to avoid them.
Symbolize
) in the question and esp. question title... $\endgroup$ – Yves Klett Apr 10 '13 at 8:57Subscript
-ed forms, exactly like halirutan did in his anwer, or use functional forms likedq[1]=0; dq[2]=0.5
. $\endgroup$ – István Zachar Apr 10 '13 at 8:58