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: [mg32357] Re: How To Change A Rule
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 16 Jan 2002 03:30:11 -0500 (EST)
  • References: <a20mon$4hf$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Arial,
Us a replacement rule

{s1 -> -11, s2 -> 12} /. (x_ -> n_ /; n < 0) -> (x -> 0)

{s1 -> 0, s2 -> 12}

or

{s1 -> -11, s2 -> 12} /. (x_ -> n_) -> (x -> Max[n, 0])

{s1 -> 0, s2 -> 12}

--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


"Ariel Fligler" <ariel.fligler at cellpay.biz> wrote in message
news:a20mon$4hf$1 at smc.vnet.net...
> 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: Simple Trigonometric Integrals
  • Previous by thread: Re: How To Change A Rule
  • Next by thread: Re: How To Change A Rule