Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: (x|y) \[element] Integers in Reduce function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82596] Re: (x|y) \[element] Integers in Reduce function
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Fri, 26 Oct 2007 05:12:07 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <ffn0le$5sp$1@smc.vnet.net> <ffpqjg$lkk$1@smc.vnet.net>

Jean-Marc Gulliet wrote:

> Steven Siew wrote:

>> Consider the following
>>
>> Reduce[x^2 - 2 y^2 == 1 && x>= 0 && y>=0 && (x|y) \[element] Integers,
>> {x,y} ]
>>
>> What does " (x|y) \[element] Integers "   mean?
>>
>> Does it mean:
>>
>> (a) x is an Integer  AND  y is an Integer
>>
>> (b) x is an Integer  OR  y is an Integer
> 
> The correct answer is (b). The vertical bar | stands for *Alternatives* 
> in pattern matching (equivalent to the non-exclusive logical OR). See 
> ref/Alternatives and also the tutorial "Patterns Involving Alternatives" 
> in the documentation center (tutorial/PatternsInvolvingAlternatives).
> 
> Note that the correct syntax for \[element] is \[Element] (with a 
> capital 'e').

Please, disregard my above erroneous misleading comment. As other 
posters have already pointed out, (a) is the correct answer.

In[1]:= Element[x | y, Integers] /. {x -> 1, y -> Pi}

Out[1]= False

In[2]:= Element[{x, y}, Integers] /. {x -> 1, y -> Pi}

Out[2]= False

In[3]:= Element[x, Integers] && Element[y, Integers] /. {x -> 1,
   y -> Pi}

Out[3]= False

In[4]:= Element[x, Integers] || Element[y, Integers] /. {x -> 1,
   y -> Pi}

Out[4]= True

Regards,
-- 
Jean-Marc


  • Prev by Date: Re: Converting notebooks to use Mathematica Player
  • Next by Date: Re: Selecting Rows Where All Columns Satisfy a Condition
  • Previous by thread: Re: (x|y) \[element] Integers in Reduce function
  • Next by thread: Re: (x|y) \[element] Integers in Reduce function