# 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 Sum. So is there a function doing multiplication that has the same grammar as Total does then?

If yes, what is it? If no, why?

Now I learn from @AntonAntonov that there is less need to design a ListProduct function. So this indicates that multiplication and addition cannot be treated on the same footing.

About "duplicate": I think not. Because my question is not aimed at finding how, but at why.

About "off-topic": I think it constructive to make some of the design "philosophy" behind clearer to facilitate deeper understanding.

• Related prior MSE thread – Daniel Lichtblau Apr 21 '18 at 15:58
• Possible duplicate of Most Efficient Way to Calculate the Product of All Items in a List? – MarcoB Apr 21 '18 at 18:13
• How about prod = Apply[Times]? prod[{1,2,3,4}] --> 24. – Szabolcs Apr 22 '18 at 17:36
• Also Fold[Times], which can be faster than Apply[Times] on packed arrays. And Tr[#, Times] &. although Tr is slightly slower than Apply. – Michael E2 Apr 22 '18 at 18:20
• Um, "If yes, what is it?" seems "aimed at finding how." And, it seems to me, that many if not most users who ask "why?" are really interested in "how?", judging by which answer they accept. Of course, (1) you're not most users, just one, and (2) I'm not voting to close anyway. – Michael E2 Apr 23 '18 at 3:20

I designed and implemented Total 17 years ago. Its first version was named ListSum. The primary reason for ListSum's implementation was to encapsulate the functionalities dealing with error accumulation while summing a list of numbers. (A well known phenomena in, say, numerical solvers for ODE's.)

Of course, I also considered ListProduct, having analogous functionality. But there was not really a strong reason or use case for it.

(During the final design phase Stephen Wolfram renamed ListSum to Total.)

@tomd

My memory of things is that before Total, Tr@lst was considered faster than Plus@@lst if lst was a packed array, an observation Ted Ersek attributes to Rob Knapp

Rob Knapp was supervising my work on the Total project.

• Thanks for the historical context! – Henrik Schumacher Apr 22 '18 at 0:28
• @HenrikSchumacher Thanks, I thought it might be of interest... – Anton Antonov Apr 22 '18 at 14:14
• @AntonAntonov I think it interesting too. – Αλέξανδρος Ζεγγ Apr 22 '18 at 14:28

Total is different from Plus@@ because it uses tricks to minimize round-off error. It is thus a useful addition to the toolkit. Times@@ doesn't suffer from the problem, so no similar function is needed.

• Could you please give a concrete example demonstrating that, concerning to round-off errors, Total and Plus@@ are different? – Αλέξανδρος Ζεγγ Apr 21 '18 at 16:07
• I prefer to state it as Apply[Plus] rather than the syntax Plus@@, because Apply[Plus] is actually a function now that we're in the brave new curried world! – Patrick Stevens Apr 21 '18 at 16:09
• @ΑλέξανδροςΖεγγ See the documentation of Total, section Examples->Options->Method. – Anton Antonov Apr 21 '18 at 16:10
• My memory of things is that before Total, Tr@lst was considered faster than Plus@@lst if lst was a packed array, an observation Ted Ersek attributes to Rob Knapp – user1066 Apr 21 '18 at 17:39
• @ΑλέξανδροςΖεγγ Related: (103771), (145019) – Michael E2 Apr 21 '18 at 18:51