MathGroup Archive 1998

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

Search the Archive

Re: Evaluation Control

  • To: mathgroup at
  • Subject: [mg14864] Re: [mg14858] Evaluation Control
  • From: Wagner Truppel <wtruppel at>
  • Date: Mon, 23 Nov 1998 10:11:46 -0500
  • Sender: owner-wri-mathgroup at


try Print[ list[[i]] ] instead. Notice the double-bracket set
surrounding i. When you have Print[ list[i] ], list is evaluated to
whatever it is and  only then applied as a head to [i]. Since lists
aren't variables, you end  up with something like
{0.,.2,.4,.6,.8,1.}[i]. On the other hand, list[[i]]  evaluates to the
i-th element of list, which is what you want. The same  comments apply
to x=list[i].


At 2:17 AM -0500 on 11/20/98, phantomlord at wrote:

I am writing a function which involves manipulation of lists, but have
stumbled across a problem.  It seems as though when I call
"Print[list[i]]" in a Do[] loop (where i is the iterative variable) it
returns the following: {0.,.2,.4,.6,.8,1.}[i] i.e. it hasn't referenced
the one element I require for computation in the rest of the code.

I try to evaluate a function f[x] at x=list[i], which returns:
Cosh[{0.,.2,.4,.6,.8,1.}[i.]]+....bla bla bla so it seems that it
interprets i as a decimal and NOT an integer, is this the cause of the
problem or is there something else I am doing wrong?


-----------== Posted via Deja News, The Discussion Network ==----------       Search, Read, Discuss, or Start Your Own



 Dept. of Information and Computer Science   (949)  856 2192 (home)
 University of California, Irvine
 Irvine,  CA   92697    USA                   WTRUPPEL at


Automobile - A mechanical device that runs up hills and down people.
      Quoting one is plagiarism.  Quoting many is research.

  • Prev by Date: Stupid problems on bracket and parenthesis! Please Help
  • Next by Date: RE: Sqrt and Listability
  • Previous by thread: Evaluation Control
  • Next by thread: Re: Evaluation Control