Re: setting discrete values for a function -- newbie
- To: mathgroup at smc.vnet.net
- Subject: [mg97641] Re: setting discrete values for a function -- newbie
- From: Raffy <raffy at mac.com>
- Date: Tue, 17 Mar 2009 05:03:07 -0500 (EST)
- References: <gpld42$qj5$1@smc.vnet.net>
On Mar 16, 4: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. Scan[ (f[#]=0)&, {a, b, c} ] Do[ f[x] = 0, { x, {a, b, c} } ] DownValues[f] = HoldPattern[f[#]] -> 0 & /@ {a, b, c}