       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:=
Element[{a,b},Reals]

Out=
(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:=
Element[{a,2},Reals]

Out=
a \[Element] Reals

In:=
Element[Alternatives[a,2],Reals]

Out=
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:=
?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:=\$Version
>
> Out="4.0 for Linux (April 21, 1999)"
>
> In:=ReplaceAll[Element[Alternatives[a, b], Reals], Alternatives -> List]
>
> Out=(a | b) \[Element] Reals
>
> Why not replaced ??? Compare:
>
> In:=ReplaceAll[El[Alternatives[a, b], Reals], Alternatives -> List]
>
> Out=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/

```

• Prev by Date: Re: limits
• Next by Date: How do you create a ListContourPlot from a mesh of non-equally spaced real numbers?
• Previous by thread: Re: ReplaceAll in Element[] Q
• Next by thread: careers with mathematica?