Re: Checking for non-complex numerics
- To: mathgroup at smc.vnet.net
- Subject: [mg21024] Re: [mg20983] Checking for non-complex numerics
- From: BobHanlon at aol.com
- Date: Thu, 2 Dec 1999 21:41:35 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
NonComplexQ[x_] := NumericQ[x] && FreeQ[x, Complex]; a = -1.5; NonComplexQ[#] & /@ {Pi, E, 1, -2.6, a, b, Pi I, 1.1 + 3I} {True, True, True, True, True, False, False, False} Bob Hanlon In a message dated 12/1/1999 3:38:29 AM, noname at noname.com writes: >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. >