5
$\begingroup$

If memory and speed are not concerns, is there a reason to use QuantityArray instead of an array of quantities?

$\endgroup$
2
  • 1
    $\begingroup$ @DanielHuber, it is possible to have something like QuantityArray[RandomInteger[10, {1000, 2}], {"Meters", "Seconds"}], where units are different at the deepest level. This actually works for the n deepest levels. The simplest case is indeed when n = 0, with all entries having the same unit. $\endgroup$
    – jose
    Commented Feb 18 at 19:45
  • $\begingroup$ @jose You are right, I was mistaken. Thanks for the hint. I deleted my note. $\endgroup$ Commented Feb 18 at 19:50

1 Answer 1

4
$\begingroup$

I think speed and memory are the primary reasons for using a QuantityArray.

Another benefit is the formatting, a summary box is a more compact visual representation. At a glance you can see the dimensions of the array, the units, and with one click you can see the min and max values.

$\endgroup$
2
  • 1
    $\begingroup$ The compact summary box is indeed quite useful. Clicking the Plus sign gives you bounds information, for example. $\endgroup$
    – jose
    Commented Feb 18 at 19:48
  • $\begingroup$ Thanks Jose - I updated the response. $\endgroup$
    – Jason B.
    Commented Feb 19 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.