Posts tagged with exponentiation

Commutativity is an easy property to render into English: it means order doesn’t matter.


For example “three groups of five rocks” totals the same as “five groups of three rocks”. In fact a general proposition is true: “L groups of R rocks” totals the same as “R groups of L rocks” for any L,R. Which is surprising if you think about arraying the stones in piles or spirals or circles

recursive "Square" function

but less so if you think about arraying them in grids



But what about associativity? It’s a basic assumption of category theory and every monoid or semigroup is associative. Since functional programming (F#, Haskell, etc) is based in these composition-friendly mathematics of braids, string diagrams, monads, and monoids, the associative assumption will come up in functional programming as well.

Parametric Monad

If the property holds then we can do things like this:

but what does it mean for associativity to hold? Just like I didn’t understand why the classical poetry I read in school was considered good until I read some truly bad poetry, I need some examples of non-associative things before I can understand what it means to assume some process is associative.

The sedenions aren’t associative


and neither are the octonions.

But these two algebras are unusual so in order to explain why they don’t translate evaluation parentheses, you have to first figure out how they work. Same with Okubo algebras, Jordan algebras, Poisson algebras, and vector cross-products. How about a more commonly understood subject matter?

Here is one: arithmetic of exponents.

The Berkeley calculator evaluates 2^2^2^2^2 right-to-left.

To access the Berkeley Calculator: Type bc -l at the terminal in Linux or Mac. In Windows get PuTTY and ssh

If the evaluation order doesn’t matter (associativity), then the square root of 2^2^2^2^2 should be the same as the base-two log of 2^2^2^2^2, since one cancels “from the bottom” and one of them cancels “from the top”.



But guess what?

The square root of 65536 is 256, but the log_2 of 65536 is ≈16. Since they’re not the same, exponentiation is non-associative.

Playing around with exponents of a few two’s and different evaluation orders can be done either in bc -l or on paper.



65536^2 = 4294967296
2^65536 = ridiculous

(2^3)^2 = 8^2 = 64
2^(3^2) = 2^9 = 512

And now that I’ve played around I have a plain-English description of what associativity means: "Order of evaluation doesn’t matter"

Readers of isomorphismes, you might enjoy powers of two tumblr.


2100 = 1,267,650,600,228,229,401,496,703,205,376 — one nonillion, two hundred sixty-seven octillion, six hundred fifty septillion, six hundred sextillion, two hundred twenty-eight quintillion, two hundred twenty-nine quadrillion, four hundred one trillion, four hundred ninety-six billion, seven hundred three million, two hundred five thousand, three hundred seventy-six (31 digits, 320 characters)

I think I’ve been subscribed since the 30’s. Never a letdown. And of course it’s only going to get more exciting.