MathGroup Archive 2008

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

Search the Archive

Re: substitution within a substitution list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88597] Re: [mg88551] substitution within a substitution list
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 9 May 2008 03:26:18 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

Any one of these or similar variants

subs = subs /. (b -> _) -> (b -> 20)

subs = Join[Select[subs, FreeQ[#, b] &], {b -> 20}]

subs = Join[DeleteCases[subs, b -> _], {b -> 20}]

You can use Sort in the last two if the order matters to you.


Bob Hanlon

---- Bipin <bipin.caz at googlemail.com> wrote: 
> HI,
> 
> I'm trying to find a way of changing the substitution values within a
> substitution list.
> 
> For example, if I have the following substitution list:-
> 
> subs = {a->1, b->2, c->2}
> 
> I want to programmatically replace the value associated with 'b' from
> 2 to 20, ie ending up with
> 
> subs = {a->1, b->20, c->2}
> 
> Does anyone know of a mathematica function for doing this?
> 
> Bipin.
> 



  • Prev by Date: Re: substitution within a substitution list
  • Next by Date: Re: substitution within a substitution list
  • Previous by thread: Re: substitution within a substitution list
  • Next by thread: Re: substitution within a substitution list