Re: Reducing a function to one argument
- To: mathgroup at smc.vnet.net
- Subject: [mg36190] Re: [mg36155] Reducing a function to one argument
- From: "Y.A.Tesiram" <yas at pcomm.hfi.unimelb.edu.au>
- Date: Mon, 26 Aug 2002 04:16:11 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
G'day, Looks like you forgot to define base in your Machine function and when using pure functions, don't forget the ampersand. Thus NestList[Machine[10,7,#]&, 3, 22] returns {3, 8, 4, 2, 1, 7, 10, 5, 9, 11, 12, 6, 3, 8, 4, 2, 1, 7, 10, 5, 9, 11, 12} with base = 2. Yas On Fri, 23 Aug 2002, Bob Harris wrote: > Howdy, > > I'm trying to figure out the correct syntax to do the following. I have > some function with three arguments, and I want to syntactically describe the > single-argument function that holds two of those arguments constant (i.e. > without creating that single-argument function). > > More specifically, I have defined > > Machine[radix_,multiplier_,state_] := Module [{c,s}, > c = Floor[state/base]; s = Mod[state,base]; > multiplier*s + c > ] > > where I have a generalize 'machine', defined by the radix and multiplier, > which converts one state into another state. So I'd like to be able to do > something like this: > > NestList[Machine[10,7,#], 3, 22] > > to get the series of states that the radix-10 multiplier-7 machine runs > through (starting with state 3). However, this syntax doesn't seem to do > what I want. > > I hope that description makes sense. It seems like there must be a syntax > to describe the function Machine[10,7,#]. > > Anyone have any ideas? > > Thanks, > Bob H > > >