Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Indexed element treated as number?

  • To: mathgroup at
  • Subject: [mg80087] Re: Indexed element treated as number?
  • From: Jens-Peer Kuska <kuska at>
  • Date: Sun, 12 Aug 2007 07:17:01 -0400 (EDT)
  • References: <f9jl5e$3c6$>



a /: Im[a[37]] = 0

does not work ?


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

  • Prev by Date: Re: question
  • Next by Date: Re: BothSides.m
  • Previous by thread: Indexed element treated as number?
  • Next by thread: Re: Indexed element treated as number?