QuantityArray

QuantityArray[mags,unit]

represents an array of quantities with magnitudes mags and common unit.

QuantityArray[mags,{unit1,unit2,}]

represents an array of lists of quantities with units {unit1,unit2,}.

QuantityArray[quants]

converts an array of Quantity objects into a single QuantityArray object.

Details

Examples

open allclose all

Basic Examples  (3)

A list of lengths, all given in meters:

Extract its magnitudes and units separately:

Normalize the quantity array:

A list of pairs {time,length}:

Extract its magnitudes and units separately:

Convert units:

Convert a normal array of quantities into a QuantityArray representation:

Scope  (6)

Construct an array of quantities with the same unit:

Convert a normal array of quantities with the same unit:

Construct an array of tuples of quantities with different units:

Convert a normal matrix of quantities with the same units in each column:

Construct an array of matrices of quantities with different units:

Convert a normal matrix of quantities with the same units in each subarray:

Construct an array of quantities with IndependentUnit specifications:

Convert an array of Quantity objects into a QuantityArray expression:

QuantityArray objects include properties that give information about the array:

The "Summary" property gives a brief summary of information about the array:

The "StructuredAlgorithms" property gives a list of functions that have algorithms that use the structure of the representation:

The array of magnitudes and the elementary block of units can be extracted using properties:

Properties & Relations  (8)

A QuantityArray object is interpreted as an array of Quantity objects:

It is an array:

It is a list of pairs; hence, a matrix, not a vector:

It is an array of Quantity objects, not an array of numbers:

The QuantityArray representation is memory efficient:

It uses only 6% of the memory of the corresponding normal representation:

It also allows faster extraction of magnitudes and units:

Compare to the slower extraction from the normal array of quantities:

A single quantity is automatically converted into a Quantity object:

This is a list with one quantity:

It can also be given as:

During conversion, QuantityArray does not try to change units:

UnitConvert will unify the units:

The QuantityArray structure is preserved in multiple operations. Take two arrays:

Addition of QuantityArray objects of compatible units, automatically converting some of them:

Multiplication of QuantityArray objects of compatible dimensions:

Tensor product of QuantityArray objects:

Transposition is special because it stores the permutation:

Flattening is also special in that sense:

Partition the array:

Flatten it again:

The result is an equivalent representation of the original quantity array:

Take a QuantityArray object with compatible but different units:

CommonUnits will convert it into a single unit array:

To select the unit, use UnitConvert:

A QuantityArray object of infinite precision:

Numericize to precision 20:

The arithmetic operations take precision into account:

QuantityArray will automatically attempt to interpret an unknown unit string:

Wolfram Research (2015), QuantityArray, Wolfram Language function, https://reference.wolfram.com/language/ref/QuantityArray.html (updated 2020).

Text

Wolfram Research (2015), QuantityArray, Wolfram Language function, https://reference.wolfram.com/language/ref/QuantityArray.html (updated 2020).

BibTeX

@misc{reference.wolfram_2021_quantityarray, author="Wolfram Research", title="{QuantityArray}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/QuantityArray.html}", note=[Accessed: 18-October-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_quantityarray, organization={Wolfram Research}, title={QuantityArray}, year={2020}, url={https://reference.wolfram.com/language/ref/QuantityArray.html}, note=[Accessed: 18-October-2021 ]}

CMS

Wolfram Language. 2015. "QuantityArray." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/QuantityArray.html.

APA

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