VectorQ

VectorQ[expr]

gives True if expr is a list or a onedimensional SparseArray object, none of whose elements are themselves lists, and gives False otherwise.

VectorQ[expr,test]

gives True only if test yields True when applied to each of the elements in expr.

Details

Examples

open allclose all

Basic Examples  (3)

Test whether an object is a vector:

These are not vectors:

Use specific tests to generalize or specialize:

Scope  (3)

Test for a vector of integers:

Test for a vector of machine-real numbers:

Test for a vector of real-valued numeric quantities:

Faster test for explicit real-valued numbers:

Applications  (1)

Define a function that only evaluates for vector arguments:

Numerically find the minimum of the functions with components:

Properties & Relations  (3)

VectorQ is a special case of ArrayQ:

A function equivalent to VectorQ:

VectorQ effectively uses AllowedHeads"ListLike":

Wolfram Research (1988), VectorQ, Wolfram Language function, https://reference.wolfram.com/language/ref/VectorQ.html (updated 2003).

Text

Wolfram Research (1988), VectorQ, Wolfram Language function, https://reference.wolfram.com/language/ref/VectorQ.html (updated 2003).

CMS

Wolfram Language. 1988. "VectorQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2003. https://reference.wolfram.com/language/ref/VectorQ.html.

APA

Wolfram Language. (1988). VectorQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VectorQ.html

BibTeX

@misc{reference.wolfram_2024_vectorq, author="Wolfram Research", title="{VectorQ}", year="2003", howpublished="\url{https://reference.wolfram.com/language/ref/VectorQ.html}", note=[Accessed: 13-October-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_vectorq, organization={Wolfram Research}, title={VectorQ}, year={2003}, url={https://reference.wolfram.com/language/ref/VectorQ.html}, note=[Accessed: 13-October-2024 ]}