MathGroup Archive 1998

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

Search the Archive

Re: Evaluation Control

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14864] Re: [mg14858] Evaluation Control
  • From: Wagner Truppel <wtruppel at ics.uci.edu>
  • Date: Mon, 23 Nov 1998 10:11:46 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Paul,

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].

Wagner

At 2:17 AM -0500 on 11/20/98, phantomlord at my-dejanews.com 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?

Thanks
Paul

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

____________________________________________________________________

   WAGNER LUIZ TRUPPEL           ***   ARMS ARE FOR HUGGING   ***
____________________________________________________________________

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

                http://www.physics.uci.edu/~wtruppel
____________________________________________________________________

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