subscripted variables in Modules
- To: mathgroup at smc.vnet.net
- Subject: [mg30106] subscripted variables in Modules
- From: "Arny" <someone at somewhere.sometime>
- Date: Sat, 28 Jul 2001 01:51:06 -0400 (EDT)
- Organization: University of California, Riverside
- Sender: owner-wri-mathgroup at wolfram.com
Hello All, (After some effort) I have gotten a proggy with subscripted variables to do what I want and have come to appreciate the utility of Mathematica's decision to not declare subscripted variables as variables but as expressions, i.e. In: FullForm[X_i] Out: SubScript[X,i] The value being that one can create formulas with subscripted variables, then apply replacement rules that automatically handle the iterators, i.e.: In: Sum[X_i , {i,n} ] /. {n->Length[data], X_i -> data[[i]]} Out:data[[1]] + data[[2]] + data[[3]] + ... etc ...+ data[[Length[data]]] Ok, no problem. However when I do my algorithm inside of a Module[] I am not able to declare X_i as a local variable because it isn't a variable, it is an expression. So long as I am not using X_i's elsewheres this is no problem, but of course I would like to protect everything and would like to do so. Any suggestions???? B -- Bernard Gress Department of Economics University of California, Riverside 1150 University Ave. Riverside, CA 92521-0247 Fax: (909) 787-5685 Phone: (909) 778 9813 BGRESS at MAIL.UCR.EDU http://csep.ucr.edu/staff/bernard/index.htm