       • To: mathgroup at smc.vnet.net
• Subject: [mg67165] Re: ? about Rule
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Sun, 11 Jun 2006 02:17:41 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <e6e2gu\$1va\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```jackgoldberg at comcast.net wrote:
> 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,

First, I am afraid that your transformation rule is erroneous.

In:=
b = {x == 1, (1 & )*#8804; (y & )*#8804; 2, z == 3}

Out=
{x == 1, 2, z == 3}

In:=
b /. ((a_ & )*#8804; (u_ & )*#8804; 2) -> 12

Out=
{x == 1, 12, z == 3}

Indeed, this rule is equivalent to the following one
In:=
b /. 2 -> 12

Out=
{x == 1, 12, z == 3}

Now, check the value of 'b'. Whatever the compound expression 1 &#8804;
y &#8804; 2 might possibly mean to you, to Mathematica this is the pure
function 1 applied to the slot number 8804, followed by the pure
function y applied to the slot number 8804, and finally the atomic
expression 2 that returns its own value 2 as value of the whole compound
expression.

In:=
{x\[Equal]1,1&#8804;y&#8804;2,z\[Equal]3}//HoldForm//FullForm

Out//FullForm=
HoldForm[List[Equal[x,1],CompoundExpression[Times[
Function,Slot],Times[Function[y],Slot],2],Equal[z,3]]]

In:=
%//ReleaseHold//FullForm

Out//FullForm=
List[Equal[x,1],2,Equal[z,3]]

Best regards,
Jean-Marc

```

• Prev by Date: structure array equivalent in Mathematica
• Next by Date: Re: Selecting Real Roots, Again