MathGroup Archive 2003

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

Search the Archive

Re: Functional programming

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39024] Re: Functional programming
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sat, 25 Jan 2003 01:24:00 -0500 (EST)
  • References: <b0r496$4lo$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Zachary Turner" <_NOzturner0826SPAM_ at hotmail.com> wrote in message
news:b0r496$4lo$1 at smc.vnet.net...
> I have a function f[a_,b_] defined some way.  i want to fix one argument,
> and then generate an array of values where the other argument varies.  How
> can I do this?
>
> For example, I want:
>
> {f[1, 4], f[2, 4], f[3, 4], f[4, 4]}
>
> Is there an easy way to do this?
>
> Thanks
>
>

Zachary,

    Table[f[x,4],{x,1,4}]

        {f[1, 4], f[2, 4], f[3, 4], f[4, 4]}

Or, for irregular values or a known list of values:

    f[x,#]&/@{ 1, 2.3, 8,-3+I, Pi,a}

        {f[x, 1], f[x, 2.3], f[x, 8], f[x, -3 + I], f[x, Pi],
          f[x, a]}


--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565





  • Prev by Date: Re: Re: Re: Multivariate-T Simulation Problem
  • Next by Date: RE: Lower Floor
  • Previous by thread: RE: Functional programming
  • Next by thread: RE: Functional programming