MathGroup Archive 2001

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

Search the Archive

Re: Local iterator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29384] Re: [mg29361] Local iterator
  • From: BobHanlon at aol.com
  • Date: Sat, 16 Jun 2001 02:47:55 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 2001/6/15 2:39:43 AM, vvasta at btinternet.com writes:

>I would like to write a function like Table, or Do, that takes an iterator
>and invokes a specified function for each value in the iterator interval,
>I
>could write something working without iterator:
>
>SetAttributes[myfun,HoldAll];
>myfun[fun_, it_, vmin_, vmax_] := Block[{it},
>    For[it = vmin, it <= vmax, ++it, Print[fun]]
>    ]
>
>myfun[N[Log[x]],x,1,10]
>
>
>How can I write a function like myfun[f,{i,mix,max,step}] ?
>

What exactly do you want the function to do that cannot be done directly with 
Table?

Table[Log[x], {x, 1., 9., 2.}]//TableForm

Table[{x, N[Log[x]]}, {x, 1, 9, 2}]//TableForm


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: roots
  • Next by Date: Re: Can Mathematica evaluate step by step
  • Previous by thread: Local iterator
  • Next by thread: Re: Local iterator