MathGroup Archive 2003

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

Search the Archive

Re: Functional programming

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39047] Re: Functional programming
  • From: "Zachary Turner" <_NOzturner0826SPAM_ at hotmail.com>
  • Date: Sun, 26 Jan 2003 05:22:36 -0500 (EST)
  • References: <b0r496$4lo$1@smc.vnet.net> <b0tb14$9c8$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Allan Hayes" <hay at haystack.demon.co.uk> wrote in message
news:b0tb14$9c8$1 at smc.vnet.net...
>
> "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]}

Good lord.  I didn't expect this many responses :)  Anyway, the Table method
seems the simplest.  Now I extend on this a little bit.  Is there any way I
can apply FullSimplify to the result before it gets inserted into the array?

Thanks



  • Prev by Date: Re: FilledPlot Question
  • Next by Date: Re: How to make a Mathematica notebook available on a web site?
  • Previous by thread: Re: Functional programming
  • Next by thread: Re: Functional programming