4 ms·
>Writing |x| for abs(x) (abs() is obviously a function, it shouldn't have special notation) >Calling abs "modulus" Both of those are because the absolute value
by Maken 11y ago
>Writing |x| for abs(x) (abs() is obviously a function, it shouldn't have special notation)
>Calling abs "modulus"
Both of those are because the absolute value of a number is the norm of the one-dimensional space.
- mrob 11y agoI've been successfully using abs() for a very long time, and I have no idea what "the norm of the one-dimensional space" is. If the notation requires understanding something of so little practical relevance to make sense then it's bad notation.
- schoen 11y agoIt's a generalization, and it makes sense as one: https://en.wikipedia.org/wiki/Norm_%28mathematics%29 https://en.wikipedia.org/wiki/Norm_%28mathematics%29 It allows you to think about |x| when x is a vector (or even other kinds of objects!) rather than just a real number. This kind of generalization can be a really powerful thing about mathematics, making existing insights more broadly applicable.
- mrob 11y agoSo it's a special notation that I can overload to use with multiple types. I can already do that with normal function call notation. How does the added complexity benefit me?
- Maken 11y agoWell, using "abs()" for it would be a bad idea, because "|x|" (or "||x||") means "whatever is the distance I've defined between two elements of this particular space". For all that I know, the only reason to write "|x|" instead of "norm(x)" or "length(x)" is because brevity and because it is a well accepted notation. Edit: wrong post.
- kaitai 11y agoI force my students to use this overloaded notation because I want to make very clear to them the commonality of ideas. They need to know that determinant of a matrix, length of a vector, and absolute value are all ways of measuring "size" in different contexts that fit together into a harmonious whole. abs(Matrix) just doesn't... do that. Doesn't make sense.
- deleted 11y ago[deleted]