MathGroup Archive 1998

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

Search the Archive

Re: Evaluation Control

  • To: mathgroup at
  • Subject: [mg14877] Re: [mg14858] Evaluation Control
  • From: BobHanlon at
  • Date: Mon, 23 Nov 1998 10:11:55 -0500
  • Sender: owner-wri-mathgroup at

In a message dated 11/20/98 4:45:54 AM, phantomlord at

>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?


x = Table[Random[], {10}]


If the function is Listable, then just apply the function to the list


"Cosh[z] gives the hyperbolic cosine of z." Attributes[Cosh] =
{Listable, NumericFunction, Protected}

Cosh[x] == Cosh /@ x == Table[Cosh[x[[i]]], {i, 10}]


If the function is not Listable, then map it onto the list



f /@ x


f /@ x == Table[f[x[[i]]], {i, 10}]


Bob Hanlon

  • Prev by Date: tab key
  • Next by Date: Re: Sqrt and Listability
  • Previous by thread: Re: Evaluation Control
  • Next by thread: Re: Evaluation Control