[HN Gopher] Floor, Ceiling, Bracket
       ___________________________________________________________________
        
       Floor, Ceiling, Bracket
        
       Author : beagle3
       Score  : 75 points
       Date   : 2021-04-15 15:49 UTC (7 hours ago)
        
 (HTM) web link (www.johndcook.com)
 (TXT) w3m dump (www.johndcook.com)
        
       | JadeNB wrote:
       | I knew Iverson introduced his bracket because I've always heard
       | it called "the Iverson bracket"--and I absolutely love it--but I
       | had no idea he invented the floor and ceiling functions, too.
       | 
       | At the risk of flippancy, who would think that the creator of APL
       | was also the source of such intuitive notations? Perhaps you have
       | to be willing to explore crazy out-there notation to be able to
       | find these occasional gems.
        
         | johndcook wrote:
         | Agreed. Say he introduced 100 bits of notation, 3 good and 97
         | bad. The net result is that the world absorbed 3 good ideas,
         | and the rest have vanished from memory. Not a bad track record.
         | I hope to give the world three good ideas.
         | 
         | Besides notation, APL introduced some ideas about vector
         | computing that have been adopted in languages like R and Python
         | (NumPy).
        
       | _Microft wrote:
       | Look at this abomination that someone posted in the comment
       | section there:
       | 
       | [?]e[?] = [?]p[?]
       | 
       | This is ... _evil_.
        
         | [deleted]
        
         | jameshart wrote:
         | We need to bring in the other atoms of mathematics to really
         | capture the transcendent beauty of this fundamental
         | relationship:                   [?]e[?]    0         ------ = i
         | [?]p[?]
        
           | nvader wrote:
           | I would buy this t-shirt.
        
         | UI_at_80x24 wrote:
         | [?][?] Characters like these remind me of the C64 and how they
         | could be strung together to make graphics [ANSI/ASCII/NCURSES
         | are close].
        
           | rzzzt wrote:
           | There is a Unicode block dedicated to these symbols:
           | https://en.wikipedia.org/wiki/Box_Drawing_(Unicode_block)
        
             | banana_giraffe wrote:
             | I'm always a little sad how poorly these can work:
             | 
             | https://imgur.com/a/mCLZVwp
             | 
             | I'm sure there's some amount of font twiddling and changing
             | to a different terminal that'll fix this, but using these
             | characters out of the box is problematic.
        
               | UnquietTinkerer wrote:
               | For comparison (not trying to be argumentative!), it
               | looks pretty good in gnome terminal on linux mint:
               | 
               | https://utio.net/demos/box_drawing.png
               | 
               | I only mention this because I've used these to decorate
               | tables in my own notes in the past. It's not really worth
               | the trouble, but I remembered being impressed with how
               | nice these characters looked at the time.
               | 
               | If anyone else wants to try it, paste this into a python
               | REPL:                   print("\u250f\u2501\u2513\n\u2503
               | \u2503\n\u2517\u2501\u251b")
        
         | ska wrote:
         | not evil.
         | 
         | mildly amusing, but also a demonstration/reminder of how both
         | functions work.
         | 
         | Assuming you have approximations of both in easy memory, which
         | probably covers most of HN readership.
        
         | sigjuice wrote:
         | How is it evil? To me, it is a mildly amusing coincidence.
        
           | imglorp wrote:
           | Which is greater? e^pi or pi^e?
           | 
           | https://www.youtube.com/watch?v=SPHD7zmLVa8
        
       | RodgerTheGreat wrote:
       | The reverse operators in APL are very visually suggestive if you
       | imagine a matrix and mirror it about the centerlines-
       | 
       | Reverse around last axis: [?]
       | 
       | Reverse around first axis: [?]
       | 
       | The grade operators (indices by which one could index to sort
       | ascending or descending) are likewise easy to remember-
       | 
       | Grade up: [?]
       | 
       | Grade down: [?]
       | 
       | I suspect that the reason only a handful of APL's notational
       | ideas made it into mainstream mathematics is because few
       | mathematicians felt the need to describe algorithmic processes,
       | and those who did were willing to settle for big sigma/pi, set
       | builder notation, piecewise function notation, or a handwave at
       | ALGOL, Pascal, or whatever else was in vogue at the time.
       | 
       | Their loss, I'm afraid.
        
         | taeric wrote:
         | This somewhat begs the question that those symbols are the best
         | they can be, though. That is, yes, if you know one of those set
         | of "grade" symbols, and you know that you can grade "up" or
         | "down", then it somewhat follows. If you just show me those
         | symbols flat out, though, I have no idea what they do.
         | (Granted, I'm not entirely clear what it means to "grade" in
         | this sense, either...)
         | 
         | Of course, that also begs the question of "do we need
         | characters for all operations?" But, I'm not entirely sure we
         | do. What is the advantage? There are plenty of operations that
         | are just fine with their symbol being a word. (As evidenced by
         | programming, in general, right?)
        
           | beagle3 wrote:
           | "grade" (as opposed to "sort") means "find a permutation that
           | puts this into order". So the sorted version of the list
           | "name" is in APL, name[[?]name] (read "name indexed by the
           | permutation that puts name into ascending order), but if you
           | have two corresponding lists, "name" and "age", then you can
           | get names sorted by age using name[[?]age]. It is, in that
           | sense, a more fundamental operation than sorting.
           | 
           | Before Iverson added the celing and floor symbols, those
           | weren't known either, even though you had a better chance of
           | guessing them.
           | 
           | And w.r.t to "characters for all operators" - this is, of
           | course, subjective. But I've never met a programmer who
           | prefers COBOL's "ADD 1 TO X GIVING X" to C's "++x"; Anything
           | that's common enough deserves a symbol, both because it's
           | shorter and easier to recognize visually, and because it
           | reduces the language barrier (in the same way that "3+4" is
           | easy for a 6-year old Thai in the way that "3 plus 4" in
           | English letters isn't)
           | 
           | In my opinion Arthur Whitney's refinements of Iverson's ideas
           | (called "K", an APL-related-language) is the right way to go.
           | He mostly converged on ~50 operations that deserve symbols.
           | Many algorithms end up as orthogonal combinations of those,
           | e.g. |/0(0|+)\ which is a complete, efficient O(n) solution
           | of the maximum-subarray-sum problem; or ",//:" which is a
           | complete, though not very efficient, implementation of
           | "flatten".
        
             | taeric wrote:
             | Certainly I think things that you do regularly and that we
             | can pull back to the standard tools of associative and
             | distributed computations makes sense to do so. I confess
             | that I am less clear on why to do this on things that
             | cannot be pulled back to those conventions. I further have
             | to acknowledge that there is a non-fine line on where to
             | stop, though. Otherwise, near every job function at work
             | would have a unique symbol for it. :D
             | 
             | That is to say, I was not intending to contradict you. Just
             | trying to shine light on the ambiguous part.
        
       | wperron wrote:
       | Whenever someone tells me "it's just syntax sugar, it doesn't
       | matter" I usually point them to mathematics. This is both
       | beautiful and horrifying in equal measure and _I love it_
        
       | defrex wrote:
       | Whilst it's obviously powerful, I often find myself wishing math
       | used syntax even half as easy to understand as any decent
       | programming language.
       | 
       | I suppose it's a result of being developed on a chalk board, but
       | math seems be value _terseness_ above all else. Rather than a
       | handful of primitives and simple named functions, it's single
       | greek characters and invented symbols. Those kind of shenanigans
       | would never pass a code review, but somehow when we're talking
       | about math they're "elegant" and "powerful".
       | 
       | I call bullshit. Math syntax is bad.
        
         | currymj wrote:
         | in computer science people can use pseudocode or descriptive
         | variable and function names, and do sometimes, but still often
         | fall back on math notation and Greek letters.
         | 
         | sometimes the terseness, and leaving certain details implicit,
         | does actually add to clarity rather than hurting it. the eye
         | can only take in so much at one time.
        
         | paulpauper wrote:
         | are you kidding. math syntax is super easy . but maybe that is
         | just me. It's mostly just the same dozen or so Greek symbols
         | used over and over
        
           | User23 wrote:
           | The use of invisible operators is obnoxious because it means
           | symbol names must all be atoms. Why is yz (multiply y z) but
           | 23 is (toint (cat "2" "3"))? A great deal of mathematical
           | syntax is actually ambiguous as written too. Plenty of it is
           | fine, but it's intellectually dishonest to deny that many
           | common notations have no merit beyond widespread historical
           | usage. Which in case it isn't clear means yes of course the
           | student should learn them for the benefit of reading great
           | works of the past.
        
             | taeric wrote:
             | You aren't even getting into the fun of "display numbers"
             | where, 2.000 could be 2000 or 2,000 or 2'000 depending on
             | who wrote it. :D
        
         | phailhaus wrote:
         | Oooh don't even get me started on how they name things after
         | people instead of anything remotely descriptive or helpful.
         | Imagine if you named functions after yourself.
        
           | taeric wrote:
           | Shell's sort would like a word. Or Bloom's filter, for that
           | matter...
        
             | dhosek wrote:
             | Or currying
        
               | Jtsummers wrote:
               | Dijkstra's algorithm, Turing machines, von Neumann
               | architecture, Hoare triples, Hamming distance,
               | Levenshtein distance, Fisher-Yates (or Knute) shuffle,
               | ...
               | 
               | https://en.wikipedia.org/wiki/List_of_algorithms - many
               | of the items in this list are named after people.
        
               | beagle3 wrote:
               | Krebs' cycle, HeLa cells and Lugol's formula in medicine
               | as well; And also an Allen key, a Phillips screwdriver,
               | many of the physical units (Ampere, Volt, Tesla, Weber,
               | Newton, ...).
               | 
               | It happens in all fields. For that matter, the Hebrew
               | word for masturbation is named after Onan, who was
               | described in the bible as having done so.
        
           | tartoran wrote:
           | I find it a good thing to name it after someone who
           | discovered something or pioneered branch in the field.
           | Sometimes it makes it confusing but most of the time the name
           | reference makes it very easy to remember as well
        
         | User23 wrote:
         | See Dijkstra's thoughts on the matter for the take of a
         | mathematician turned programmer[1].
         | 
         | [1]
         | https://www.cs.utexas.edu/users/EWD/transcriptions/EWD13xx/E...
        
         | IngoBlechschmid wrote:
         | Working mathematician here. Generally I concede.
         | 
         | However I'd like to add that often in mathematics, we are
         | discussing very generic situations. For instance, we are not
         | talking about the radius of some specific circle, which perhaps
         | should be named `wheelRadius`, but about the radius of an
         | arbitrary circle or even an arbitrary number.
         | 
         | I wouldn't really know a better name for an arbitrary number
         | than `x`. The alternative `arbitraryNumber` gets old soon,
         | especially as soon as a second number needs to be considered --
         | should it be called `arbitraryNumber2`? I'll take `y` over that
         | any day :-)
         | 
         | Also there are contextually dependent but generally adhered to
         | naming conventions which help to quickly gauge the types of the
         | involved objects. For instance, `x` is usually a real number,
         | `z` is a complex number, `C` is a constant, `n` and `m` are
         | natural numbers, `i` is a natural number used as an array
         | index, `f` and `g` are functions, and so on.
         | 
         | My favorite symbol is by the way `yo` which denotes the Yoneda
         | embedding and is slowly catching on. All the other commonly
         | symbols for the Yoneda embedding clashed with other common
         | names. This has been a real nuisance when studying category
         | theory.
        
       | remcob wrote:
       | I use brackets with a subscript as notation for the modulo
       | operation. This way expressions with multiple / nested moduli
       | become much more readable. I'm particularly fond of how concisely
       | the Chinese Remainder Theorem can be stated:
       | 
       | https://xn--2-umb.com/17/chinese-remainder-theorem
        
       | lordleft wrote:
       | Something I think makes mathematics both incredibly powerful but
       | difficult to break into is the notation
        
         | beagle3 wrote:
         | I don't think notation is what's making things hard.
         | 
         | The concepts behind are the hard thing. If you can't figure out
         | the concept, the notation doesn't make much sense - and it is
         | the notation that you meet first, so it seems to be the
         | culprit.
         | 
         | Which is not to say that all notation is equally good - some is
         | exceptionally bad, and other just confusing. The article
         | mentions [x] which was i use for almost 200 years despite being
         | confusing - but was then fixed into something non-confusing.
         | 
         | Similarly, for most uses, Leibniz's differential notation
         | (dy/dx) is superior to Newton's (y with a dot on top) - and is
         | now universally used in those uses - but for a long time
         | Newton's dominated, mostly for political reasons (yes, over 250
         | years later).
         | 
         | But these are the exceptions: Usually, like in the floor/ceil
         | case, when a better notation comes along, it is quicky (30-40
         | years...) adopted.
        
       | tlb wrote:
       | Knuth [0] discusses in more detail some advantages of indicator
       | notation, in particular that, when you eliminate the limits on
       | summations, it makes it much easier to do algebra on summations.
       | 
       | [0] https://arxiv.org/abs/math/9205211
        
       | User23 wrote:
       | I find these kind of discussions of notation really interesting.
       | They're not at all the bike-shedding they might first appear to
       | be. One of the last EWDs[1] is an interesting meditation on the
       | topic.
       | 
       | [1]
       | https://www.cs.utexas.edu/users/EWD/transcriptions/EWD13xx/E...
        
       ___________________________________________________________________
       (page generated 2021-04-15 23:00 UTC)