Linked Questions

114
votes
3answers
7k views

What is a Mathematica packed array?

A simple sounding question with a few sub questions: What is the difference between unpacked vs packed array? Are packed arrays more space efficent, how much so? Are packed arrays more time ...
51
votes
3answers
2k views

Are there guidelines for avoiding the unpacking of a packed array?

Packed arrays are very useful because they save memory and generally allow speedier and more efficient calculation times. If a list of data currently stored as a packed array is unpacked, it can slow ...
15
votes
8answers
994 views

Product of elements of a list

Sum is for functions; Total is for a list. Product is for a function; what is the command ...
21
votes
3answers
3k views

Fastest way to measure Hamming distance of integers

I am looking for a fast and robust way to calculate the Hamming distance of integers. The Hamming distance of two integers is the number of matching bits in their binary representations. I expect that ...
15
votes
2answers
1k views

Why it seems that there is no counterpart function as to multiplication, to `Total` as to addition?

Times and Plus have the same grammar, and so do Product and ...
12
votes
3answers
556 views

The speed of Sum[] varies strangely

I was curious about the difference in speed between Total and Sum. I found out Total was ...
20
votes
2answers
505 views

Incorrect Timing of Total

For demonstrating how fast C-compiled functions can be, in one of my courses I use the following function for finding the sum of a list of reals: ...
8
votes
1answer
348 views

Why does taking advantage of Listable change the results of a numerical computation slightly?

I have two variables: t0, and teta0. The first is computed using several nested sums, the second is computed taking advantage to ...
12
votes
2answers
223 views

Last@Accumulate not giving same result as Total

If I run the code: arr = Table[0.979, 249]; Last@Accumulate[arr] - Total[arr] on Mathematica 11.0 (Windows), I get the result ...
16
votes
1answer
283 views

How does Plus work on machine precision Real arguments?

I thought Kahan's summation method would make a nice example for students to use to think about round-off error [W. Kahan, Pracniques: Further Remarks on Reducing Truncation Errors, Commun. ACM 8  (...