[Date Index]
[Thread Index]
[Author Index]
Re: ? about Rule (rewritten)
*To*: mathgroup at smc.vnet.net
*Subject*: [mg67190] Re: [mg67153] ? about Rule (rewritten)
*From*: Bob Hanlon <hanlonr at cox.net>
*Date*: Sun, 11 Jun 2006 23:07:51 -0400 (EDT)
*Reply-to*: hanlonr at cox.net
*Sender*: owner-wri-mathgroup at wolfram.com
{y==z, t==7, 1 <=x<=2, u>=-4}/. (a_<= w_ <=b_)->w==(a+b)/2
{y == z, t == 7, x == 3/2, u >= -4}
Bob Hanlon
---- jackgoldberg at comcast.net wrote:
> 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: ? about Rule (rewritten)**
Next by Date:
**Re: ? about Rule (rewritten)**
Previous by thread:
**RE: ? about Rule (rewritten)**
Next by thread:
**Re: ? about Rule (rewritten)**
| |