Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Re: Re mg17548 Is it a bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17962] Re: [mg17890] Re: Re mg17548 Is it a bug?
  • From: Adam Strzebonski <adams>
  • Date: Mon, 7 Jun 1999 02:51:19 -0400
  • Organization: Wolfram Research, Inc.
  • References: <7jadon$mu4$2@dragonfly.wolfram.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Mathematica 4 has a new function Element which tests for
the mathematical property of set membership (as opposed
to testing for an explicit data type which is done by functions
like IntegerQ or RealQ).

Element[x, set] gives True if Mathematica can prove that x
belongs to set, False if Mathematica can prove that x does
not belong to set, and stays unevaluated otherwise.
The built in sets are Primes, Integers, Rationals, Reals,
Algebraics, Complexes, and Booleans.

Please note that Reals are contained in Complexes, so to test
that x is complex in the meaning of the original posting we
need to use

In[1]:= ComplexNotReal[x_]:=Element[x, Complexes] && !Element[x, Reals]

Here are some examples.

In[2]:= ComplexNotReal/@{1+6 I, 1+Sqrt[2] I}

Out[2]= {True, True}

In[3]:= ComplexNotReal[Sqrt[x]]

Out[3]= Sqrt[x] \[Element] Complexes && !Sqrt[x] \[Element] Reals

In[4]:= Simplify[%, x<0]

Out[4]= True

Best Regards,

Adam Strzebonski
Wolfram Research

Andrzej Kozlowski wrote:

> This doesn't actually work, at least not in the sense Mr.  A. Mail
> (E-Mail?)
> meant it:
>
> In[1]:=
> ComplexQ[x_]:= (Head[N[x]] == Complex);
>
> In[2]:=
> ComplexQ[3]
> Out[2]=
> Real == Complex
>
> In[3]:=
> ComplexQ[I^I]
> Out[3]=
> True
>
> which is plain false. One can fix it of course but really there is no
> point.
>
> --
> Andrzej Kozlowski
> Toyama International University
> JAPAN
> http://sigma.tuins.ac.jp
> http://eri2.tuins.ac.jp
>
> ----------
> >From: jsobel at sdav01.seinf.abb.se (Jarl R Sobel)
To: mathgroup at smc.vnet.net
> >To: mathgroup at smc.vnet.net
> >Subject: [mg17962] [mg17890] Re: Re mg17548 Is it a bug?
> >Date: Wed, Jun 2, 1999, 1:22 PM
> >
>
> >
> > ComplexQ[x_]:= (Head[N[x]] == Complex);
> >
> > Cases[A,x_/;ComplexQ[x]]
> >
> > does what you want.
> >
> >
> >
> > In article <7innpd$6t2 at smc.vnet.net>, Anony Mail
> <AnnonyMai1 at nym.alias.net>
> > wrote:
> >
> >> Yes, it is a strange result.
> >>
> >> The responses to date do not answer this mans problem.  They only
> state
> > how Mathematica behaves.  Mathematicas behaviors are understood, but
> they
> > do not solve the problem.
> >>
> >> Mathematica behaves in a counterintuitive manner here, therefore
> the
> > result should be considered strange.  One should not be required to
> know
> > the internal formats of numbers in order to query whether they are
> complex.
> >>
> >> One can argue that Cases is meant explicitly for pattern matching,
> > therefore it should behave this way.  That is a valid point and I
> have no
> > argument with that concept.  This idea, however, still leaves the
> mans
> > problem unresolved.
> >>
> >> There should be a ComplexQ test for situations like this.  We
> already
> > have EvenQ, NumberQ, all kinds of Q -- but no ComplexQ.  We need
> ComplexQ
> > Let Mathematica figure out its own internal forms, and just tell us
> whether
> > a given number is complex.  Thats all we want to know.  I am not
> impressed
> > by the machinations required to make the simple determination of a
> numbers
> > status.  Give us ComplexQ and let Mathematica do all that nonsense.
> >>
> >> Then people who need pattern matching per se can use Cases.  The
> rest of
> > us who just want to determine if a number, whether algebraic or
> machine, is
> > complex, will use ComplexQ.
> >>
> >>
> >>
> >> F. Mittermayr mitterma at linz.vai.co.at wrote in message
> > news7hgdfs4bu at smc.vnet.net...
> >> A = 1 + Sqrt2 I , 1 + 2  3 I
> >> CasesA, _Complex
> >>
> >> Out1 = 1+6 I
> >>
> >> Isnt it a strange result?
> >>
> >>
> >>
> >> .





  • Prev by Date: Re: Insufficient Memory
  • Next by Date: ADDING TO THE HELP FILE
  • Previous by thread: NDSolve - large systems of ODE's
  • Next by thread: ADDING TO THE HELP FILE