Re: ReplaceAll in Element[] Q
- To: mathgroup at smc.vnet.net
- Subject: [mg25640] Re: [mg25599] ReplaceAll in Element[] Q
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Mon, 16 Oct 2000 03:04:57 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Indeed, this looks strange but actually are a victim of an "optical illusion". Observe: In[1]:= Element[{a,b},Reals] Out[1]= (a | b) \[Element] Reals In other words, Element[List[variables],Domain] is automatically converted to Element[Alternatives[ variables],Domain]. These two forms are equivalent if entered as input, e.g. In[2]:= Element[{a,2},Reals] Out[2]= a \[Element] Reals In[3]:= Element[Alternatives[a,2],Reals] Out[3]= a \[Element] Reals You can understand why these two approaches, using List and using Alternatives, are equivalent if you look at the documentation for Element: In[4]:= ?Element Element[x, dom] asserts that x is an element of the domain dom. Element[{x1, x2, ... }, dom] asserts that all the xi are elements of dom. Element[patt, dom] asserts that any expression matching the pattern patt is an element of dom. Since Alternatives[a,b] is a pattern, the last part of the above applies. The statement Element[Alternatives[variables],dom] means that any expression matching Alternatives[variables] is an element of Dom. But every variable in variables matches Alternatives[variables]. Thus the statement amounts to saying that all variables are in dom, which is the same as Element[List[variables],dom]. on 00.10.11 4:50 PM, Arturas Acus at acus at itpa.lt wrote: > > Dear Group, > > Could anybody help me in understanding this > obviously strange behaviour > > In[22]:=$Version > > Out[22]="4.0 for Linux (April 21, 1999)" > > In[23]:=ReplaceAll[Element[Alternatives[a, b], Reals], Alternatives -> List] > > Out[23]=(a | b) \[Element] Reals > > Why not replaced ??? Compare: > > In[24]:=ReplaceAll[El[Alternatives[a, b], Reals], Alternatives -> List] > > Out[24]=El[{a, b}, Reals] > As expected > > Dr. Arturas Acus > Institute of Theoretical > Physics and Astronomy > Gostauto 12, 2600,Vilnius > Lithuania > > > E-mail: acus at itpa.lt > Fax: 370-2-225361 > Tel: 370-2-612906 > -- Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ http://sigma.tuins.ac.jp/