by pointedset · 5y ago · 0 comments
It almost irritates me when I read a book or a paper and they say that the zero/empty case is "by convention". I almost want to yell, "no! it's because that's how you make the definition uniform!"
Addition is usually defined as a binary operation, a+b, but really it should be defined as an n-ary operation; associativity tells us that doing "two layers" of addition should boil down to doing a single layer of addition on the concatenated list of operands. That forces 0-ary addition to be zero, which can always be added to the list of operands without affecting the result.
Something similar happens with empty products (which explains the factorial), empty spans, etc. In all cases, the trick is to figure out, what is the equivalent of associativity? What "syntactic" operations on the inputs (for example, concatenating a list of lists of operands) correspond to operations on the outputs (you can get the total sum by first computing partial sums)?
A fun puzzle, if you enjoy this kind of thing: what's the determinant of the 0x0 matrix (over your favourite field or ring)? For all (square) sizes, the determinant of the zero matrix is zero, but the determinant of the identity matrix is one, and the 0x0 matrix is kind of both. So which pattern should win? Which one is stronger? I know my own answer ;)
- n-dimensional volume is a function from (some) subsets of space to real numbers
- it should be additive under union
- it should scale by t^n when you scale the space by a factor of t
I think the upshot of the conversation was that 0-dimensional volume of a shape should be its Euler characteristic. In the simple case of a finite set of points, the "volume" would be the number of points.
And by your earlier comment, span({}) consists of a single point, so its volume should be 1. It all works!
1, because 0x0 seems like a more elegant base case for the recursive det formula than 1x1.
Even just one number theory course helped a lot, since it brought that kind of consistency into its own concept, where [this set of rules] forms a ring, and [this set] forms a field, etc.
all([]) == True
any([]) == False
all: no false elements any: not all false elements
Mental models often get spicy with empty/"corner" cases. This isn't quite the same, but a lot of kids struggle with division as sharing rather than division as measuring, which makes division by a number less than 1 conceptually difficult. http://langfordmath.com/ECEMath/Multiplication/DivModels.htm...
And so, begun the array indexing war has.