Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: setting discrete values for a function -- newbie

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97619] Re: setting discrete values for a function -- newbie
  • From: Nicholas <physnick at gmail.com>
  • Date: Tue, 17 Mar 2009 04:58:55 -0500 (EST)
  • References: <gpld42$qj5$1@smc.vnet.net>

On Mar 16, 7:28 am, "Karsten W." <Karsten.G.Wein... at googlemail.com>
wrote:
> Hello,
>
> my task is to set some function values f[[a], f[b], ... to zero. Is
> there a nicer way to do this than this one:
>
> Clear[f];
> args = Partition[{a,b,c}, 1];
> Apply[(f[#] = 0 )&, args, {1}];
>
> Especially, can I avoid calling Partition?
>
> Best wishes,
> Karsten.
I happened to run across Scan, and it looks like that is what you
need. E.g.,

Scan[(f[#] = 0) &, {a, b, c}]

Good luck,
Nick.


  • Prev by Date: Re: setting discrete values for a function -- newbie
  • Next by Date: Re: importing fixed width data
  • Previous by thread: Re: setting discrete values for a function -- newbie
  • Next by thread: Re: setting discrete values for a function -- newbie