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 (rewritten)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67212] RE: [mg67153] ? about Rule (rewritten)
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sun, 11 Jun 2006 23:08:55 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Jack,

On my system, Version 5.2 it appears to work.

{y == z, t == 7, 1 <= x <= 2, u >= -4} /.
  (a_) <= (w_) <= (b_) -> (a + b)/2

{y == z, t == 7, 3/2, u >= -4}

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

From: jackgoldberg at comcast.net [mailto:jackgoldberg at comcast.net]
To: mathgroup at smc.vnet.net

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: List manipulation question
  • Next by Date: Re: ? about Rule (rewritten)
  • Previous by thread: Re: ? about Rule (rewritten)
  • Next by thread: Re: ? about Rule (rewritten)