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


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

Re: how to check for NumericQ arbitrary data structure

Started by"djmpark" <djmpark@comcast.net>
First post2012-04-25 04:38 +0000
Last post2012-04-25 04:38 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#9788 — Re: how to check for NumericQ arbitrary data structure

From"djmpark" <djmpark@comcast.net>
Date2012-04-25 04:38 +0000
SubjectRe: how to check for NumericQ arbitrary data structure
Message-ID<jn7v44$6f9$1@smc.vnet.net>
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


[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web