13 ms·
Mathematics seems to be obsessed with one-liners Single letter variable names (often from different alphabets) and complex expressions that should be broken do
by muth02446 5y ago
Mathematics seems to be obsessed with one-liners
Single letter variable names (often from different alphabets) and complex expressions that should be broken down would never make it through a code review ;-)
- Ar-Curunir 5y agounlike programming, you're not mutating and updating mathematical variables. Having "intelligible" names doesn't actually help that much to understand the core mathematical concepts anyway.
- nomel 5y ago> core mathematical concepts anyway But it can really help understand the practicalities of it, like any paper involving models, which are pretty numerous outside of pure mathematics. Unfortunately, I've seen many papers that "leave it to the reader" when it comes to equations used, with no translation between variable names and what they actually represents.
- Ar-Curunir 5y agoI feel like that's an issue of the paper, and not the idea; instead of making the math verbose, the paper should provide a legend or key that documents each symbol, or at least the main ones.
- kergonath 5y agoVariable names with more than one letter (excluding superscripts and subscripts) are awful to read and difficult to parse. Kerning issues become confusing as you try to figure out where are the implied multiplications. There is nothing wrong with single letters as long as they are chosen appropriately and are clearly defined in the text.
- deleted 5y ago[deleted]
- DennisP 5y agoMaybe the problem is implied multiplications. Most programming languages don't have them, and are easier to read with longer variable names.
- omaranto 5y ago> Mathematics seems to be obsessed with one-liners Not at all. Formulas in a math paper always come with at least a paragraph of text explaining them. You aren't supposed to read the formula without the explanation. > Single letter variable names (often from different alphabets) and complex expressions that should be broken down would never make it through a code review ;-) That's done for readability. The text explains the terms of the formula and the formula concisely summarizes the precise relationship between them.
- netizen-936824 5y agoTheoretically, we could do the same with comments no? Make the code extremely compact and explain it, perhaps even in a format like literate programming?
- omaranto 5y agoYes. But it would be tough to change the culture. Math papers are meant to be read, so people pay attention to the explanations. Computer programs (at least if they garner users!) are run much more often than read, so it's natural to focus on the code and neglect the comments.
- nomel 5y ago> But it would be tough to change the culture. I think it would be tougher to find anyone willing to read programs written like this. Requiring an explanation to understand the variables is very similar to encoding the variables names and putting a lookup table below. Why force someones eyes to dart back and forth between the program and lookup table, just to get an idea of what the variable are, rather than also including a very rough explanation of what they variables are doing, in the program itself, by giving them meaningful names? We only have so much working memory. Giving variables names frees up a significant amount.
- netizen-936824 5y agoI've personally written code that was immensely difficult to read. Branchless stuff with single letter variables. Even though I commented it thoroughly, its ridiculously difficult to read and modify. This was a good lesson for me, I won't do that again and I'm far more verbose now. My thinking is that maybe math should learn from things like that as well, perhaps expanding equations and being more verbose within the equation instead of an explanation next to it would make maths more accessible to a broader audience.
- enaaem 5y agoIt’s important to see patterns in equations and verbose variables makes it harder to see.
- nitrogen 5y agoPatterns occur in code, too, especially when allowed to span multiple lines with indentation.
- joppy 5y agoIt's very hard to see the patterns in mathematical expressions or equations without compressing the notation down to be very small, which is the main reason this is done. However, mathematicians break complex expressions down into simpler reusable parts all the time...
- jstx1 5y agoThis is one of my gripes with the Julia programming language. The community really likes Greek letters and math notation mixed in with their code. And I just can’t.
- enriquto 5y agoHa! this is precisely the thing that I love about Julia! Only thing missing is to have the empty string as the product operator. I want to write "y = ax + b" and that it computes the product of "a" with "x".
- jstx1 5y agoWhat happens when you have "a", "x" and "ax" as variables in scope?
- enriquto 5y agoI'm not a language designer, but maybe there should be a warning or a compilation error or something, instead of a silent but arbitrary decision. But it gets ugly easily, with three-leter variable names that can be grouped in different ways. If I designed a new language from 0, I'd like to allow only single letter variable identifers (possibly with unicode sub-indices and modifiers).
- jstx1 5y ago> If I designed a new language from 0, I'd like to allow only single letter variable identifers (possibly with unicode sub-indices and modifiers). In the nicest possible way - this is absolute madness.
- enriquto 5y agoDo you think so? It may seem risky in itself, but I think this would capture many current practices in mathematical notation. The language could aid you to clarify your code. For example, by forcing each variable to be declared explicitly at the beginning of its scope, on a line all by itself. Then the compiler could put a warning if one of these declarations didn't have a comment.
- fault1 5y agomathematical notation would be kind of unreadable without the terse and compact symbology, imho. it makes it much easier for the mind to parse. mathematics is partially a language (maybe one of the most universal ones), once you learn common conventions, it becomes easier. Obviously it's no problem for human minds to learn huge numbers of symbols, just like some CJK languages with a large number of ideographs that have to be understood in context. I do think auto-annotation, as well as other types of interactivity are great, though!
- deleted 5y ago[deleted]
- dunham 5y agoThe alphabets (and typefaces, like blackboard bold or cursive) are mathematicians' version of syntax highlighting. They are often used to represent different types of objects.
- snicker7 5y agoMathematicans read very slowly relative to, say, computer programmers. A page can easily take an hour or more. Bad notation (e.g. variable names) can interrupt one's flow.
- red_trumpet 5y agoI think mathematical formulas are partly optimized to be easily manipulated with a pen on paper. Imagine trying to derive a slightly complex function where the variables are called `growth_rate`, `duration` and `distance`.