MathGroup Archive 2010

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

Search the Archive

Re: Replacement Rule with Sqrt in denominator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114677] Re: Replacement Rule with Sqrt in denominator
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sun, 12 Dec 2010 05:47:09 -0500 (EST)

On 11 Dec 2010, at 07:52, Jack L Goldberg 1 wrote:

>
> a)  Input as typed:  2<==x<==4.  Look at its fullform.  On my Mac 
> running ver. 7 of Mathematica, I get returned,
>                    LessEqual[2,x,4].
>
> b)  Now type in Reduce[2<==x<==4].  You will get      
> Inequality[2,LessEqual,x,LessEqual,4].
>
> These are are different expressions!  How can one program replacement 
> rules when one can not be sure of the FullForm?  These structures are 
> entirely different.  Which fullform can one assume is the one Mathematica sees 
> in some complicated module wherein one step is a replacement rule?
>
> Jack Goldberg
> Mathematics
> University of Michigan
>

O.K. but I don't see anything here that in any way contradicts anything that has been said about the need for
for looking at FullForm before trying pattern matching. Actually, it is als
o an argument against using Copy and Paste. To see that, evaluate Reduce[2<==x<==4]. Now, copy the output and paste it into another cell and wrap FullForm around it, then evaluate. You will get  LessEqual[2,x,4].

I don't see this as a problem, do you? You can certainly match both forms with a single pattern:

 {2 <== x <== 4, Reduce[2 <== x <== 4]} /.
   (a_) <== x <== (b_) |  Inequality[a_, LessEqual, x, LessEqual, b_] :> {a, b}

{{2, 4}, {2, 4}}


Andrzej Kozlowski



  • Prev by Date: Re: Desperate due to NMinimize
  • Next by Date: Re: Replacement Rule with Sqrt in denominator
  • Previous by thread: Re: Replacement Rule with Sqrt in denominator
  • Next by thread: Re: Replacement Rule with Sqrt in denominator