Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9788

Re: how to check for NumericQ arbitrary data structure

From "djmpark" <djmpark@comcast.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: how to check for NumericQ arbitrary data structure
Date 2012-04-25 04:38 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jn7v44$6f9$1@smc.vnet.net> (permalink)
References <201204201144.HAA21808@smc.vnet.net> <201204210431.AAA29236@smc.vnet.net> <15027170.70316.1335260574648.JavaMail.root@m06>

Show all headers | View raw


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@comcast.net 
http://home.comcast.net/~djmpark/index.html 



From: Ted Sariyski [mailto:tsariysk@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


Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: how to check for NumericQ arbitrary data structure "djmpark" <djmpark@comcast.net> - 2012-04-25 04:38 +0000

csiph-web