GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing reference.wolfram.com — QuantityArray—Wolfram Documentation 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
Basic Examples
Scope
Properties & Relations
Possible Issues
See Also
Related Guides
Related Workflows
History
Cite this Page
QuantityArrayQuantityArray[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
Examplesopen all close allBasic Examples (3)A list of lengths, all given in meters: qa = QuantityArray[{2.3, 1.5, 9.0}, "Meters"]Extract its magnitudes and units separately: QuantityMagnitude[qa]QuantityUnit[qa]Normalize the quantity array: Normal[qa]A list of pairs {time,length}: qa = QuantityArray[{{1.4, 2.3}, {2.8, 2.7}, {4.2, 3.5}}, {"Seconds", "Meters"}]Normalize it: Normal[qa]Convert units: UnitConvert[qa, {"Minutes", "Feet"}]Normal[%]Convert a normal array of quantities into a QuantityArray representation: {{Quantity[1, "Seconds"], Quantity[3, "Newtons"]}, {Quantity[2, "Seconds"], Quantity[8, "Newtons"]}}QuantityArray[%]Scope (6)Construct an array of quantities with the same unit: QuantityArray[RandomReal[1, {10, 3}], "Meters"]Convert a normal array of quantities with the same unit: QuantityArray[{Quantity[1, "Meters"], Quantity[2, "Meters"], Quantity[3, "Meters"]}]Construct an array of tuples of quantities with different units: QuantityArray[RandomReal[1, {10, 8, 3}], {"Meters", "Seconds", "Kilograms"}]Convert a normal matrix of quantities with the same units in each column: QuantityArray[{{Quantity[1, "Meters"], Quantity[2, "Seconds"], Quantity[3, "Kilograms"]}, {Quantity[4, "Meters"], Quantity[5, "Seconds"], Quantity[6, "Kilograms"]}}]Construct an array of matrices of quantities with different units: QuantityArray[RandomReal[1, {10, 8, 2, 2}], {{"Meters", "Seconds"}, {"Kilograms", "Newtons"}}]Convert a normal matrix of quantities with the same units in each subarray: QuantityArray[{{{Quantity[1, "Meters"], Quantity[2, "Seconds"]}, {Quantity[3, "Kilograms"], Quantity[4, "Newtons"]}}, {{Quantity[5, "Meters"], Quantity[6, "Seconds"]}, {Quantity[7, "Kilograms"], Quantity[8, "Newtons"]}}}]Construct an array of quantities with IndependentUnit specifications: QuantityArray[Range[10], IndependentUnit["myUnit"]]Convert an array of Quantity objects into a QuantityArray expression: qs = {{Quantity[1., "Kilograms"], Quantity[2., "Newtons"]}, {Quantity[5., "Kilograms"], Quantity[10., "Newtons"]}, {Quantity[3., "Kilograms"], Quantity[6., "Newtons"]}}QuantityArray[qs]QuantityArray objects include properties that give information about the array: qa = QuantityArray[RandomReal[1, {10, 2}], {"Seconds", "Meters"}]qa["Properties"]The "Summary" property gives a brief summary of information about the array: qa["Summary"]The "StructuredAlgorithms" property gives a list of functions that have algorithms that use the structure of the representation: qa["StructuredAlgorithms"]The array of magnitudes and the elementary block of units can be extracted using properties: qa["Magnitudes"]qa["UnitBlock"]Properties & Relations (8)A QuantityArray object is interpreted as an array of Quantity objects: qa = QuantityArray[RandomReal[1, {20, 2}], {"Meters", "Seconds"}]It is an array: ArrayQ[qa]It is a list of pairs; hence, a matrix, not a vector: MatrixQ[qa]VectorQ[qa]It is an array of Quantity objects, not an array of numbers: MatrixQ[qa, QuantityQ]MatrixQ[qa, NumericQ]The QuantityArray representation is memory efficient: qa = QuantityArray[RandomReal[1, {100, 100, 2}], {"Meters", "Seconds"}]nqa = Normal[qa, QuantityArray];It uses only 6% of the memory of the corresponding normal representation: ByteCount[qa] / ByteCount[nqa]//NIt also allows faster extraction of magnitudes and units: QuantityMagnitude[qa];//AbsoluteTimingQuantityUnit[qa];//AbsoluteTimingCompare to the slower extraction from the normal array of quantities: QuantityMagnitude[nqa];//AbsoluteTimingQuantityUnit[nqa];//AbsoluteTimingA single quantity is automatically converted into a Quantity object: QuantityArray[7, "Meters"]%//InputFormThis is a list with one quantity: QuantityArray[{7}, "Meters"]%//NormalIt can also be given as: QuantityArray[{7}, {"Meters"}]%//NormalDuring conversion, QuantityArray does not try to change units: QuantityArray[{Quantity[1, "Meters"], Quantity[2, "Feet"]}]UnitConvert will unify the units: UnitConvert[%, "Meters"]Normal[%]The QuantityArray structure is preserved in multiple operations. Take two arrays: qa = QuantityArray[{{1, 20}, {3, 40}, {5, 60}, {7, 50}}, {"Meters", "Seconds"}]qb = QuantityArray[{{10, 2}, {20, 2}, {30, 2}, {40, 2}}, {"Feet", "Seconds"}]Addition of QuantityArray objects of compatible units, automatically converting some of them: qa + qbMultiplication of QuantityArray objects of compatible dimensions: qa qbTensor product of QuantityArray objects: TensorProduct[qa, qb]Transposition is special because it stores the permutation: Transpose[qa]%//InputFormFlattening is also special in that sense: Flatten[qa]%//InputFormPartition the array: Partition[qa, 2]%//InputFormFlatten it again: Flatten[%%, 1]The result is an equivalent representation of the original quantity array: % == qaTake a QuantityArray object with compatible but different units: qa = QuantityArray[{{1, 2}, {3, 4}, {5, 6}}, {"Meters", "Feet"}]CommonUnits will convert it into a single unit array: CommonUnits[qa]Normal[%]To select the unit, use UnitConvert: UnitConvert[qa, "Meters"]Normal[%]A QuantityArray object of infinite precision: qa = QuantityArray[{{1, 2}, {3, 4}}, {"Meters", "Seconds"}]Precision[qa]Numericize to precision 20: nqa = N[qa, 20]Precision[nqa]InputForm[nqa]The arithmetic operations take precision into account: Precision[2. qa]QuantityArray will automatically attempt to interpret an unknown unit string: QuantityArray[RandomReal[1, 10], "foot"]QuantityArray[{{1, 20}, {3, 40}, {5, 60}, {7, 50}}, {"fps", "Meterss"}]Possible Issues (1)Normalization of QuantityArray objects also normalizes purely numerical quantities such as percents: qa = QuantityArray[{10, 30, 79}, "Percent"]Normal[qa]Specify that only the QuantityArray structure should be normalized: Normal[qa, QuantityArray]Related GuidesRelated Workflows
Related Workflows
▪
Wolfram Research (2015), QuantityArray, Wolfram Language function, https://reference.wolfram.com/language/ref/QuantityArray.html (updated 2020).
TextWolfram Research (2015), QuantityArray, Wolfram Language function, https://reference.wolfram.com/language/ref/QuantityArray.html (updated 2020). CMSWolfram Language. 2015. "QuantityArray." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/QuantityArray.html. APAWolfram Language. (2015). QuantityArray. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/QuantityArray.html BibTeX@misc{reference.wolfram_2026_quantityarray, author="Wolfram Research", title="{QuantityArray}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/QuantityArray.html}", note=[Accessed: 12-November-2026]} BibLaTeX@online{reference.wolfram_2026_quantityarray, organization={Wolfram Research}, title={QuantityArray}, year={2020}, url={https://reference.wolfram.com/language/ref/QuantityArray.html}, note=[Accessed: 12-November-2026]} |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |