MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Indexed element treated as number?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80055] Indexed element treated as number?
  • From: "Jung-Tsung Shen" <jushen at gmail.com>
  • Date: Sat, 11 Aug 2007 02:16:22 -0400 (EDT)

(* 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


  • Prev by Date: Re: frameticks and LogScale
  • Next by Date: RE: hardware for Mathematica 6.0
  • Previous by thread: Manipulate/Locator bug
  • Next by thread: Re: Indexed element treated as number?