MathGroup Archive 2002

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

Search the Archive

Re: How To Change A Rule

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32363] Re: [mg32334] How To Change A Rule
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Wed, 16 Jan 2002 03:30:25 -0500 (EST)
  • References: <200201150730.CAA04564@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

You may try this:

In[1]:=
a = {s1 -> -11, s2 -> 12};

In[2]:=
a /. Rule[x_, y_] -> Rule[x, y*Sign[y]]
Out[2]=
{s1->11, s2->12}

Tomas Garza
Mexico City

----- Original Message -----
From: "Ariel Fligler" <ariel.fligler at cellpay.biz>
To: mathgroup at smc.vnet.net
Subject: [mg32363] [mg32334] How To Change A Rule


> Greetings,
>
> I'm quite newby to Mathematica programming and will thank you if you could
> help me solve the following:
>
> I have a list of rules of the form:
> {s1->-11, s2->12}
> And would like to change every rule in the list that it's RHS is negative
to
> 0 so that I will get:
> {s1->0, s2->12}
> I tried to find an access function to manipulate rules but could not.
>
> Any help ?
>
> TIA,
>
> Ariel.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Thanks,
>
> Ariel Fligler
>
>
>



  • Prev by Date: Re: How To Change A Rule
  • Next by Date: Re: How To Change A Rule
  • Previous by thread: Re: How To Change A Rule
  • Next by thread: How To Change A Rule