MathGroup Archive 2012

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

Search the Archive

Re: how to check for NumericQ arbitrary data structure

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126212] Re: how to check for NumericQ arbitrary data structure
  • From: "djmpark" <djmpark at comcast.net>
  • Date: Wed, 25 Apr 2012 00:35:32 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201204201144.HAA21808@smc.vnet.net> <201204210431.AAA29236@smc.vnet.net> <15027170.70316.1335260574648.JavaMail.root@m06>

data1 = {2, {Pi, 0.5}, {1/2, {I, 3 Sin[2]}, {6}}};
data2 = {a, {Pi, 0.5}, {1/2, {I, 3 Sin[2]}, {6}}}; 

VectorQ[Flatten[data1], NumericQ]
VectorQ[Flatten[data2], NumericQ] 
True
False


David Park
djmpark at comcast.net 
http://home.comcast.net/~djmpark/index.html 



From: Ted Sariyski [mailto:tsariysk at craft-tech.com] 


Hi,
I have a data structure e.g. {a,{b,c},{d,{e,f},{g}}}, which I want to check
for NumericQ. For vectors and matrices I can use VectorQ[x,NumericQ] or
MatrixQ[x,NumericQ]. Is there a way to check an arbitrary data structure
that all elements are NumericQ or I have to construct a function for each
data structure?
Thanks in advance,
--Ted





  • Prev by Date: Re: Question about DayOfWeek
  • Next by Date: Re: how to check for NumericQ arbitrary data structure
  • Previous by thread: Re: is there internal variable like $0 in perl?
  • Next by thread: Re: is there internal variable like $0 in perl?