Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Relational operators on intervals: bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128678] Re: Relational operators on intervals: bug?
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Fri, 16 Nov 2012 01:51:55 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k7p3j3$ca3$1@smc.vnet.net> <20121112080708.39931690E@smc.vnet.net> <k7skt2$ku3$1@smc.vnet.net> <20121114062826.C02FC69AC@smc.vnet.net> <6F6D7B27-201F-4AC9-9553-809ABA30A7CE@mimuw.edu.pl> <9488D537-DAE3-45F6-A088-38486CB999AB@math.umass.edu> <20121115085735.202336A1D@smc.vnet.net> <3AA0624E-54D6-4BBD-8320-A47ED2838A75@mimuw.edu.pl>

On Nov 15, 2012, at 4:45 AM, Andrzej Kozlowski <akozlowski at gmail.com> wrote:
>
> On 15 Nov 2012, at 09:57, Andrzej Kozlowski <akozlowski at gmail.com> wrote:
>>
>> On 14 Nov 2012, at 22:01, Murray Eisenberg <murray at math.umass.edu> wrote:
>>
>>> On Nov 14, 2012, at 5:39 AM, Andrzej Kozlowski <akozlowski at gmail.com> wrote:
>>>
>>>>
>>>> On 14 Nov 2012, at 07:28, Richard Fateman <fateman at cs.berkeley.edu> wrote:
>>>>
>>>>> On 11/12/2012 9:13 PM, Murray Eisenberg wrote:
>>>>>
>>>>>>
>>>>>> Here is the empty interval in Mathematica:
>>>>>>
>>>>>> Interval[{1, 0}]
>>>>>>
>>>>>> Indeed:
>>>>>>
>>>>>> Resolve[Exists[x, IntervalMemberQ[Interval[{1, 0}], x]]]
>>>>>> False
>>>>>>
>>>>> Apparently this doesn't mean what you think it does. It gives the same
>>>>> answer for Interval[{0,1}].
>>>>
>>>> Of course that is because
>>>>
>>>> IntervalMemberQ[Interval[{0, 1}], x]
>>>>
>>>> False
>>>
>>> What remains surprising to me is:
>>>
>>> Resolve[Exists[x, x \[Element] Reals, IntervalMemberQ[Interval[{0, 1}], x]]]
>>> False
>>>
>>
>> I don't find it surprising.
>> All you are doing is, evaluating Exists[x,Element[x,Reals],False]  which is False and then  Resolve[False] which is also False.The fact that IntervalMemberQ[Interval[{0, 1}], x] immediately evaluates to False (unlike, for example, 0<x<1, which evaluates to itself)  is responsible for this and shows that IntervalMemberQ is not intended to be used in symbolic expressions. Compare this with
>>
>> Resolve[Exists[x, x \[Element] Reals, 0 < x < 1]]
>>
>> True
>>
> Maybe the following example will make my point clearer.
>
> Compare:
>
> Resolve[Exists[x, Element[x, Primes]]]
>
> True
>
> with
>
> Resolve[Exists[x, PrimeQ[x]]]
>
> False
>
> Mathematica `predicates (functions ending with Q) always evaluate immediately to True or False and thus are generally unsuitable for use in symbolic expressions of the above kind.

OK, that provides an explanation of sorts.  In fact, the documentation of PrimeQ makes the distinction in saying, "Simplify[expr\[Element]Primes] can be used to try to determine whether a symbolic expression is mathematically a prime."

But the documentation for IntervalMemberQ does not say any such thing. Moreover, one might be misled into thinking

   Simplify[0.5 \[Element] Interval[{0, 1}]]

should return True, but it returns 0.5 \[Element] Interval[{0, 1}] instead.

Is the general rule about functions whose names end with Q documented somewhere?

---
Murray Eisenberg                                    
murray at math.umass.edu
Mathematics & Statistics Dept.      
Lederle Graduate Research Tower            phone 413 549-1020 (H)
University of Massachusetts                               413 545-2838 (W)
710 North Pleasant Street                         fax   413 545-1801
Amherst, MA 01003-9305








  • Prev by Date: Re: improving speed of simulation using random numbers
  • Next by Date: Re: Problem with SetDelayed lhs:=rhs
  • Previous by thread: Re: Relational operators on intervals: bug?
  • Next by thread: Re: Relational operators on intervals: bug?