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 ≤ y ≤ 2, z == 3} I want to replace 1 ≤ y ≤ 2 by something else, for this question say 12. So b/. (a_ ≤ u_ ≤ b_) -> 12 should return
> {x == 1, 12, z == 3} It doesn't. Why? Even this b/. (1≤ y ≤ 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