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

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: [mg88596] Re: [mg88551] substitution within a substitution list
  • From: DrMajorBob <drmajorbob at att.net>
  • Date: Fri, 9 May 2008 03:26:07 -0400 (EDT)
  • References: <26620531.1210237667995.JavaMail.root@m08>
  • Reply-to: drmajorbob at longhorns.com

subs = {a -> 1, b -> 2, c -> 2};

subs /. Rule[b, _] -> Rule[b, 20]

{a -> 1, b -> 20, c -> 2}

subs /. Rule[b, x_] -> Rule[b, 10 x]

{a -> 1, b -> 20, c -> 2}

ReplacePart[subs, {2, 2} -> 20]

{a -> 1, b -> 20, c -> 2}

etc.

Bobby

On Thu, 08 May 2008 03:13:41 -0500, 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.
>
>



-- 

DrMajorBob at longhorns.com


  • Prev by Date: 2 domain PDE, NDSolve
  • Next by Date: Fwd: substitution within a substitution list
  • Previous by thread: Re: substitution within a substitution list
  • Next by thread: Fwd: substitution within a substitution list