Re: Checking for non-complex numerics
- To: mathgroup at smc.vnet.net
- Subject: [mg20985] Re: [mg20983] Checking for non-complex numerics
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Thu, 2 Dec 1999 21:41:02 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In[1]:=
NonComplex[x_] := Element[x, Reals] && NumericQ[x]
seems to satisfy your requirements:
In[2]:=
Map[NonComplex, {Pi, 2.3, 2.3*I, b, Pi*I, E^(Pi)}]
Out[2]=
{True, True, False, False, False, True}
> From: "DIAMOND Mark" <noname at noname.com>
> Organization: The University of Western Australia
> Date: Wed, 1 Dec 1999 01:50:56 -0500 (EST)
> To: mathgroup at smc.vnet.net
> Subject: [mg20985] [mg20983] Checking for non-complex numerics
>
> I would like a function that returns True for non-complex numerics only. To
> be more specific, anything that results in NumericQ returning True is OK,
> such as Pi, E, 1, -2.6.
>
> a=-1.5;
> followed by NonComplexQ[a] should return True. But
> NonComplexQ[b] and NonComplexQ[Pi I] should return False as should
> NonComplexQ[1.1 + 3 I].
>
> I have been able to a function that satisfies various subsets of these
> conditions, but not the whole lot ... yet it seems the kind of problem for
> which there should be a simple and obvious solution.
>
>
>
>
>