Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*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 2006

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

Search the Archive

Re: ? about Rule

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67167] Re: ? about Rule
  • From: Peter Pein <petsie at dordos.net>
  • Date: Sun, 11 Jun 2006 02:17:45 -0400 (EDT)
  • References: <e6e2gu$1va$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

jackgoldberg schrieb:
> Hi Everyone,
> 
> I am totally puzzled by this and I'm not an Mathematica beginner.  
> 
> Let   b = {x == 1, 1 &#8804; y &#8804; 2, z == 3}   I want to replace  1 &#8804; y &#8804; 2  by something else, for this question say  12.  So  b/. (a_ &#8804; u_ &#8804; b_) -> 12 should return  
> {x == 1, 12, z == 3}   It doesn't.  Why?  Even this  b/. (1&#8804; y &#8804; 2) -> 12  doesn't work.   I'm at a loss...
> 
> Jack
> 
Hi Jack,

Mathematica 5.1 gives me the following results:

In[1]:=
b = {x == 1, 1 <= y <= 2, z == 3}
Out[1]=
{x == 1, 1 <= y <= 2, z == 3}
In[2]:=
b /. (a_) <= (u_) <= (b_) -> 12
Out[2]=
{x == 1, 12, z == 3}
In[3]:=
b /. 1 <= (u_) <= 2 -> 12
Out[3]=
{x == 1, 12, z == 3}
In[4]:=
b /. 1 <= y <= 2 -> 12
Out[4]=
{x == 1, 12, z == 3}

Do you get the strange results with a freshly started kernel?

Peter


  • Prev by Date: Re: mg67144: 3rd try!
  • Next by Date: Re: Mathematica doesn't know what it's doing.
  • Previous by thread: ? about Rule
  • Next by thread: Re: ? about Rule