logoalt Hacker News

ameliusyesterday at 8:31 PM7 repliesview on HN

Ok, I guess I'm always confused why |S| on a set doesn't take the values into account, whereas |x| on a vector does take its values into account; how can mathematicians of all people be so inconsistent?


Replies

lackeryesterday at 10:59 PM

Think of it this way, how would you turn a set into a vector in the first place? We solve this in programming a lot, for example, the "one-hot" encoding for neural networks. Here, a set turns into a vector that has a zero for every item that isn't in the set, a one for every item that is.

Now, there are a lot of things that |v| for a vector can mean. In the L1 distance you just add up the absolute value of each dimension. You could argue that that's a simpler sort of |v| than L2.

And there you go! |S| on a set actually means exactly the same thing as |x| on a vector, if you interpret sets as vectors in the right way.

mswphdtoday at 1:30 AM

|x| on a vector is not well-typed. The notation for norms of vectors is ||x||, namely 2 bars on each side.

There still is a naming collision between |X| (cardinality of a set) and |x| (absolute value of a scalar). Sometimes this happens. It generally is still unambiguous though, as mathematicians tend to use different segments of the alphabet for different purposes, and also additionally tend to capitalize sets, and leave scalars lower case.

magicalhippoyesterday at 10:09 PM

I dunno I think it makes sense. For a vector x, the length |x| says something about its size relative to other vectors. For a set S, the cardinality |S| says something about its size relative to other sets.

The vector is always defined in a vector field which has a given dimension, and usually the dimension isn't that interesting. Typically it's either the same between the vectors you consider, or the vectors have one of a few fixed number of dimensions. Meanwhile the length of vectors is an interesting quantity.

For sets, since the values can be anything, nothing or everything in between, you can't really define many interesting functions or operations that work on the elements of sets in general. Meanwhile, the number of elements in a set is an interesting quantity.

Anyway, just my take, though I never did take much math.

layer8yesterday at 8:54 PM

Mathematicians use inconsistent notations all the time. Symbols meaning slightly different things based on the type of the arguments are among the benign cases.

For the present case, see https://en.wikipedia.org/wiki/Vertical_bar#Mathematics.

Joker_vDyesterday at 8:48 PM

Who do you think invented operator overloading?

kurlbergyesterday at 10:01 PM

There is a joke saying "a mathematician says X, writes Y on the board and means Z". The really amusing(?) thing is that other mathematicians still (sort of) perfectly understands Z. Once you have enough experience you fill in the blanks automatically.

Math exposition is tricky: too few details and you're just floating in the sky, too many details and the audience loses sight of the forest for all the trees. You can go (more or less) all formal, but it's a pain for the writer and a pain for the experienced reader.

If it's any consolation, the punchline to the joke is that it often is small/big lie: the other mathematicians reads "Y" and goes WTF!? And then 1 minute, 1 hour, 1 day, or one week later says "aaah, that's what he/she meant! I guess it was 'obvious' all along". :-)

show 1 reply