MathGroup Archive 2006

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

Search the Archive

? about Rule (rewritten)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67153] ? about Rule (rewritten)
  • From: jackgoldberg at comcast.net
  • Date: Sun, 11 Jun 2006 02:17:01 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi, 

My post on this topic was garbled.  Here I hope is a clearer version :-).

I want to replace an inequality of the type  1 <=  x <= 2 which appears in a list some of whose entries are  y==3 or z >= 1 and so forth.  (This arose in using Reduce on a set of linear inequalities.)  My life is simpler if  1 <= x <=2  is replace by an interior point of the interval, say  x ==1.5.   It has frustrated me for about a week since I thought I knew the ins and outs of Rule and ReplaceAll.  So, 2 questions.  The first and most important is how to do it (keep in mind that the list I am speaking of is constructed by programming and I do not want to examine it and make the replacement that way).  The second question is, why doesn't the following technique work?
   (1)       {y==z,  t==7, 1 <=x<=2, u>=-4}/. (a_<=w_<=b_)->(a+b)/2
To save space, I choose not to write all my variations of trying this including the obvious one of finding the FullForm of  1 <=x<=2  and using it in  (1).  I might mention also that every now and then, in isolation from my module, I have managed to make it work, not often but enough to delay my plea for help.  I am guessing that there is a pattern matching issue here (sort of obvious comment) but I am at a loss anyway.

Incidentally I have designed a work around that is so combersome that if there were a prize for the klutzest Mathematica code, this would be a candidate for top prize.

Jack


  • Prev by Date: Re: No StringCompare in Mathematica?
  • Next by Date: Re: Llearning Mathematica
  • Previous by thread: Re: mg67144: 3rd try!
  • Next by thread: Re: ? about Rule (rewritten)