Re: Indexed element treated as number?

*To*: mathgroup at smc.vnet.net*Subject*: [mg80087] Re: Indexed element treated as number?*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Sun, 12 Aug 2007 07:17:01 -0400 (EDT)*References*: <f9jl5e$3c6$1@smc.vnet.net>

Hi, and a /: Im[a[37]] = 0 does not work ? Regards Jens Jung-Tsung Shen wrote: > (* The following problem and alike have been asked before. I have > searched extensively the archive of this forum but couldn't find a > perfect solution. *) > > > To get an array of length n, where n is large and post-given, one > issues the command, for example, > > n=100; > kList1=Array[a, n]; > > but it seems that there are some limitations to this approach. For > example, in cases that I know all of the elements are real, and would > like to issue, say, > > a[37]/:Im[a[37]]=0; > > I get an error message saying > "TagSet::sym: Argument a[37] at position 1 is expected to be a > symbol." To declare the element to be explicitly zero sometimes speed > up the computation. > > For a list such as > > kList2={k1, k2, k3, ..., k100}; > > there's no such limitations, but since the number of elements is > large, and is post-given, I couldn't have this before hand. > > Is there any solution(s) to this "problem"? > > Thanks! > > JT >