# Breaking change of Total in Mathematica 12.0?

Total has been changed in Mathematica 12.0. The documentation seems to contradict itself. In one line it states:

Total[ $$f[ e_1,e_2,...]$$ ] gives the sum of the $$e_i$$ for any head $$f$$

In the next line one reads:

By default, Total only adds up elements inside List, SparseArray, StructuredArray and Association.

As a matter of fact, in Mathematica 12.0 Total[ f[a,b] ] does not evaluate to a+b as it did in Mathematica 11.3. Instead, the new option AllowedHeads was introduced and one can for example write now Total[f[a,b], AllowedHeads->Inherited] for obtaining the old output.

This is a breaking change. I wonder if this was intended by Wolfram?

• Given that the option AllowedHeads is illegal in V11.3 and permissible now in V12, I'd say the change was clearly intended. You could use SetOptions[Total, AllowedHeads -> Inherited] as a general workaround. (It seems the documentation could use a good copy editor.) – Michael E2 May 22 at 16:00
• Consider adding this here – Michael E2 May 22 at 16:01
• I've always thought the M11 behavior was just a bug, and a pain to workaround. – Carl Woll May 22 at 17:53
• @CarlWoll No, it was a feature not a bug. Total[expr] was supposed to be equivalent to Plus @@ epxr. – Anton Antonov May 23 at 8:10
• Please always use full version numbers. There is no Mathematica 11, but there are 11.0, 11.1, etc. I corrected this in the post for now. – Szabolcs May 23 at 8:19