Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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: [mg32343] Re: [mg32334] How To Change A Rule
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Wed, 16 Jan 2002 03:29:50 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

You can use rules to manipulate rules. In yur case:

In[11]:=
{s1 -> -11, s2 -> 12} /. (x_ -> (y_)?Negative) -> x -> 0

Out[11]=
{s1 -> 0, s2 -> 12}

Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/

On Tuesday, January 15, 2002, at 04:30  PM, Ariel Fligler wrote:

> 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: polar curve
  • Next by Date: RE: Entering constant placeholders
  • Previous by thread: Re: How To Change A Rule
  • Next by thread: Re: How To Change A Rule