Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Annotated equations for increased readability and understanding of papers (twitter.com/sibinmohan)
192 points by visviva on Jan 11, 2022 | hide | past | favorite | 90 comments


From comments here it sounds like people already deeply familiar with the mathematical notation used in a domain really want to stick with the compact, black-ink-only equation representation. However, as an engineer who occasionally wants to translate papers from a mathematical field I rarely encounter into code I will use all the time, annotations like this would greatly increase the utility I could derive from a paper in a given amount of time.

Also, as yunruse mentioned in [0], and as I have done in my own videos that include math, syntax highlighting for math is very useful for absorbing new math. How acceptable would that be to practitioners already deep in their fields?

So, could annotations of this form be acceptable to both groups if they were switchable on or off in an online version of a paper?

[0] https://news.ycombinator.com/item?id=29899938


I think this is very useful for presentations (I wish there was a mathml version) and books. The issue with using this for articles is that most journals (at least in my field) have tight page limits, while this uses quite a lot of space. So using these annotations would mean cutting down significantly on the rest of the paper, which would likely degrade readability.


How would this help you? Now these explanations are just in the paragraph next to the equation and are not limited to 3 words.


> Now these explanations are just in the paragraph next to the equation and are not limited to 3 words.

Not necessarily. Will Crichton, a PhD student at Stanford University, has been working on a tool called Nota [0] that he's hoping might serve as a platform for online paper publication. I'd suggest checking out the initial presentation of Nota [1] to see some ideas of how syntax highlighting-type effects can be made as toggle-able capabilities that are not intrusive nor dislocated as you suggest.

[0] https://nota-lang.org

[1] https://willcrichton.net/nota/


It activates more information channels into my brain.

Prose is just one transfer channel, and for me, not a very efficient one (though I love reading!). Mathematical notation is one more.

But that leaves out word association, color, spatial relationships, conceptual graphs, diagrams, etc. The more channels I can activate, the faster I can build intuition, and intuition facilitates practical application.

Here's an example of how I like to use color from my own modest work: https://youtu.be/iyjIVSnrPSo?t=424

Another example: https://youtu.be/iyjIVSnrPSo?t=345

In this case, each independent variable in the equation gets its own color, and that color corresponds to a label on the graph above. The imaginary unit also gets a special color, which matches the color of its definition, for those of my audience who are unfamiliar with or out of practice with complex numbers. And the syntactic elements are muted to make the shape of the equation "pop" for those whose eyes are not routinely trained to read math notation. Elsewhere in the video I use different colors to represent positive, negative, and zero frequencies.

So to restate, it's all about giving information as many paths into my brain as possible.


As an engineer translating formulas into code, I'd rather go and get the deep and clear understanding of the meaning behind the formulas, rather than rely on a highlighting to help me away with the vagueness of my understanding.


Does the average mathematician have any incentives to create easily understandable explanations for their equations and algorithms? Ones that engineers can use to implement various ideas.


The average mathematician does not work on anything engineers would care about. Maybe you are talking about CS professors instead of mathematicians? I've noticed that many here on HN mix the two. They aren't the same, CS professors aren't specialists on math, they use math as a tool and often don't understand it well enough to explain it properly in a paper. Not to mention that repeating the same explanation in every paper creates a lot of redundancy, the material is already much better explained in many books or online.


It depends on the CS professor and university. At U of Waterloo, for example, there are two separate degrees one can get as a CS major. One that's a BMath, the other as a BCS. I studied engineering (BASc) there, and while the website may say otherwise[0], everyone recognized that the BMath was the more serious of the two degrees even if there were exceptions here and there. Anyway, all of this to say that mathematicians and computer scientists are highly related. Even more so than mathematicians and physicists. They both deal is pure, (usually) computable abstractions.

[0] https://cs.uwaterloo.ca/current-undergraduate-students/major...


It's definitely advantageous if you can claim that people in industry are using something you invented (and in other fields I'm more familiar with there are a lot of consulting opportunities)


For many of the papers I read (engineering) I would love to be able to click on symbols in an equation and have it link me back to where that term was first defined in the paper, either in another eqn or in the text. Tracing back in this way is a major pain point e.g. when trying to reproduce calculations. Seems like something journals/latex could easily implement in an automated fashion (maybe already possible?)


I use glossaries-extra. It allows the usual glossary stuff (acronyms), but can also be used to define symbols. All symbols then become hyperlinks, linking to the nomenclature at the beginning or end of the document. And in that nomenclature, glossaries- extra allows one to have a column of "first used", specifying the page of first occurrence.


Tangentially, one of the things I always enjoyed seeing in the wild was semantic colouring in equations. The educational YouTuber 3Blue1Brown [0] and to some extent the maths side of YouTube in general tend to make use of them, colouring like terms the same to give a subtle visual aid, similar to pretty printing.

[0] https://youtube.com/3blue1brown


I definitely see value in this, but it's currently too much of a hassle to use. It requires lots of tedious code duplication and requires the user to manually set positions and lengths for the arrows and annotations, defeating the purpose of allowing writers to focus solely on the content of their work. However, this would be a great thing to try to encapsulate in a package.


I was reading Russian political Telrgram earlier today, and one of the better channels ("Толкователь") had a post about a scientific study on why people prefer conspiracy theories over scientific information.

The study's summary says that this is because conspiracy theories are communicated in a language that is understandable, while scientific communication uses language that is opaque for most people.

Which leads me to the conclusion that any effort towards making scientific communication more understandable to general public -- including the annotated equations -- is a good thing.


> The study's summary says that this is because conspiracy theories are communicated in a language that is understandable, while scientific communication uses language that is opaque for most people.

Well, when you remove the constraint to be truthful, you can do a lot of things to make statements that are more plausible and convincing to a layman. In other words, of course when the main requirement is just to sound good you end up with statements that are more convincing.

Did you know that 74.13% of all statistics are completely made up? It's true! I've got a report from the Institute of Data & Information Oriented Technology Studies right here!


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 ;-)


> 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.


Yes, with the assumption that the reader is familiar with any symbol or notation not explained in said paragraph. I find it very irritating and a barrier to sharing knowledge when I'm unable to understand a paper because some notation is just assumed to be known - especially because there's no sensible way of looking up math/symbols online.


If you don’t know the notation, you almost surely don’t know the concepts themselves, and so the barrier to your understanding is lack of your background knowledge, not just notation issues. Math is just genuinely complex and hard, and people who have experience with basic mathematics in school or university simply should not expect the advanced stuff to be within easy grasp, as they sometimes do.

Consider this classic, very well written paper: https://math.berkeley.edu/~nadler/atiyah.classification.pdf

The “Generalities” section has only one page and hardly any equations, author simply defines notation he uses. And yet, it requires something like 2+ years of prior education in advanced mathematics (either in strong undergrad program, or in a graduate program) to really grasp it. Author even defines his notation: “E [is] the sheaf of germs of regular sections of E, and \Gamma(E) [is] the vector space of global regular sections of E, thus \Gamma(E) = H^0(X, E).”. Sure, he doesn’t define what H^0(X,E) is, but if I told you that it’s the degree zero sheaf cohomology group of E, would that make any difference to you?


> If you don’t know the notation, you almost surely don’t know the concepts themselves,

I find that this isn't true. I spent quite a few years working on number theory problems on my own, just out of interest. I developed several techniques that I just couldn't understand when other people used them, because they had really weird notations, like |x-Σbⁿdₙ|<ϵ, with no definitions for any of the letters. (Feel free to guess what that means. Hint: nothing to do with set membership.)

Sure, you can work it out if you can compare several different papers, so it's only a barrier for a few days… but it's still a barrier.


> If you don’t know the notation, you almost surely don’t know the concepts themselves

The difference is that it is much easier to websearch a concept by name than by notation. "degree zero sheaf cohomology group" is a big handle to search, discover, and learn things with, whereas "H^0(X,E)" is a deadend.


Or, you can just pick a relevant textbook, which will be better than anything you can possibly google.


Yet so many papers I read are just another Gaussian wearing another pants.


I've found this book to be very helpful: Mathematical Notation: A Guide for Engineers and Scientists [0]. It's compact, very well organized, and has several indexes to make symbol lookups easier and good summaries of what they mean.

[0] https://www.amazon.com/gp/product/1466230525


Theoretically, we could do the same with comments no? Make the code extremely compact and explain it, perhaps even in a format like literate programming?


I think this is an interesting and promising idea. Code that doesn't exist can't have bugs, and when you're just fooling around rather than writing production code you can just write the formulas without the explanation.

To some extent the Scheme and Haskell communities do this already, because their favored languages are compact enough to allow them to include their programs in more or less conventional math papers.

http://canonical.org/~kragen/sw/dev3/paperalgo is a notation I developed for writing procedural programs with paper and pencil, extending mathematical notation with lightweight notation for classes, methods/functions, assignment, iteration, conditionals, and pattern matching. For many years I have used it whenever I'm writing code on paper or a whiteboard, but still find it harder to read than more traditional notations like Python and Scheme.

In addition to compact code and explanation, it's often useful to have example inputs and outputs (the way spreadsheets and Jupyter notebooks or R notebooks do), as well as proofs.


Yes. 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.


> 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.


I guess it depends on how concrete the code is. For very general things there just are no good names. I see the point in calling a variable anualSalary, say, but in a function for reversing a list is elementOfList really better than element or than x (which would be my preference)?

This, by the way, is probably the main reason math uses single letters for names (with some rules of thumb that hint at the type, like n for an integer, X for a scheme, calligraphic F for a sheaf, etc.).


I'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.


After developing equations through 100 lines and few pages or blackboards, you’ll see that dropping letters is inevitable.

You shouldn’t really read the equations before understanding what they are about.

They are usually written down to get rid of ambiguities of the natural language.


Source code isn't ambiguous either, and tends to get way longer than a hundred lines or a few pages.


It’s not a single equation though where you’d need to rewrite the same variables 100 times.


Another perspective: Working memory for equations becomes tricky once they span lots of lines or multiple pages and long variable names make this worse.

Same reason one often sees I1 + I2+I3+I4 in estimates. For the moment you actively don't want the mental overload of all the details. You just want to know that there are four terms to be discussed, now forget about all others and let us start looking at the first one.

Similarly long notation/names just do not work well on blackboards/whiteboards.


The problem is that code comments tend to skew from the actual code over time. Let's just stick with readable code everywhere.


I believe this is basically what programming with APL looks like.


Exactly. Just without the comments.


Variable 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.


Maybe the problem is implied multiplications. Most programming languages don't have them, and are easier to read with longer variable names.


It’s important to see patterns in equations and verbose variables makes it harder to see.


Patterns occur in code, too, especially when allowed to span multiple lines with indentation.


It'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...


The alphabets (and typefaces, like blackboard bold or cursive) are mathematicians' version of syntax highlighting. They are often used to represent different types of objects.


I 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`.


unlike 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.


> 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.


I 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.


mathematical 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!


Mathematicans 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.


This 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.


Ha! 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".


While Julia doesn't go that far, it does allow implicit multiplication if the first operand is a constant:

    julia> x = 19; w = 5; y = 10x + 2.0w
    200.0


Julia lets you write `3x` for `3 * x` because it’s unambiguous, since variables may not start with numerals, but `ax` is not `a * x`, because `ax` is a legal identifier.


What happens when you have "a", "x" and "ax" as variables in scope?


I'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).


> 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.


Do 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.


I like these somewhat crazy ideas. You could get some of this behavior with macros in Julia, probably.


Mathematica already does this, as do other similar languages/environments.


While I like the annotations, I have to say they make it difficult to make out the original equation. It parses and highlights variables and gets in the way of seeing a cohesive whole equation.

I think an annotated version would be good as a supplement.


I'd prefer definitions of terms to appear when you hover the mouse over them. And the proofing software to enforce that all terms are thus defined. Somehow in 2021 at least, undefined terms were still slipping through the review process :-/


I was skeptical when I clicked but that’s actually amazing.

It will eventually allow us to make even more complex constructs.


No it won't. It will allow a bunch of people to skim-read detailed research publications and miss all the nuances that matter. No equation, no matter how many colours and arrows you cram into it, has any meaning on it's own. If you want to know what the author means by each of the symbols, read the damn paper.

Yes, in some fields certain symbols are known by tradition to mean something and older papers that were published with a limited audience in mind omitted some descriptions which is awfully annoying, but this is solved by having a section describing what your abbreviations and symbols refer to, not with highlighter spam.


> It will allow a bunch of people to skim-read detailed research publications and miss all the nuances that matter.

I have to disagree, there’s nothing stopping readers from doing this already, I think it’s quite common

I do agree that one needs to actually read the paper to really understand the context of some equation, but honestly flipping between the abbreviation table or the dense prose of “where x is foo, y is bar, zzz” it’s just not readable. I don’t think it’s would make sense to use this style for every equation ever, but I think it has utility


I disagree. These annotations help to bind the variables to the context and the “detailed nuances”.

Yes this is called a lookup table, and while it can seem obvious to you when you have spent 1y working on the same subject, it is not for the others.

People will anyway skim-read it, as I do, and put it aside for detailed reading, if the overall idea is good or if I found an interesting technique.

Anyway, the best papers I read were short and concise. Cf. historically Lebesgue paper about measure theory and his correspondance with Picard, compared to Borel’s theory.


I always wondered why no one is doing syntax (or, semantical) coloring/highlighting for stuff like mathematics or sheet music. It could even help with simple plain text.

The reason is probably that "it's always been like that", just like keyboard layouts. Though one could argue that coloring would be not be very disruptive and backwards-compatible, so it wouldn't hurt traditional reading much.


> It could even help with simple plain text.

I've always found it interesting how video games (e.g. Legend of Zelda) will make certain key words in text a different color. It works well—but why do we only do it in video games?


Rendering the different symbols in different colors might be enough, as long as those colors are used in the text defining the symbols. Used sparingly (i.e. only for the symbols that are relevant to the argument), it can greatly enhance readability.

I feel like these annotations go slightly overboard; the entire equation/annotation construct is visually pleasing, but hard to parse.


Seeing this presented for use in papers is a very good thing. These annotations look alot like slides many people make (sometimes showing relations between multiple equations, etc). However, much of this readability is customarily stripped out for the sake of uniformity. I think most journals im familiar with enforce specific formatting for equations.


Definitely something that could be nice in an active-document.

By analogy, Wikipedia articles have a feature where, if you mouse-over a link, it'll display a preview of the link-target (https://en.wikipedia.org/wiki/Wikipedia:Tools/Navigation_pop... ). This can be an efficient way for a reader to conveniently glance at the definition of a term while reading.

Mathematical notation varies significantly between fields, and many papers define custom symbols with their own paper-specific definitions. So this sort of feature isn't just something for math-newbies, but rather something that could significantly benefit experts too.

The same sort of annotations might be more situational in non-active documents, where there'd be more of a trade-off between helpful-annotations and clutter.


TBH, I don't think the annotations add anything. You can simply write

" Lap(x | mu, b) = ...

where b>0, a scalar parameter. "

What is needed is some better way to motivate the concepts behind any maths that is confusing for people who might be confused.


Here are the examples in long-form rather than a tweet:

https://github.com/synercys/annotated_latex_equations


Finally! This is super useful! I wanted to do stuff like this ten years ago for small code samples but didn't get very far with TikZ. Doing it for equations is even more complicated to get into a pleasent shape, I guess.


> I wanted to do stuff like this ten years ago for small code samples but didn't get very far with TikZ.

I'm a no-code tools developer. Yours sound like an interesting problem to solve, could you elaborate on your use case? What programming languages? What kind of information did you need to annotate? Which are your expectations on usability?


On one hand I like this, and have used similar visuals in presentations, on the other hand I feel it's a less a problem related to math literacy per se, and more needing a workaround relating to the artificial limits and style restrictions imposed by journals (as well as the limitations of a paper medium, to some extent).

The whole "pay £1000 per extra page" by itself has been enough to reluctantly cause me to cram math inline and assume symbols are known to the field without too much explanation.


I understand math is optimized for writing, but honestly I've always felt it would be better if we just used long variable names instead of single letters.


It’s not. The entire point of math papers is to get the idea across to other mathematicians. Unlike code, which can be useful even if others don’t understand it, a paper that can’t be understood is entirely useless. You are just not in the target audience, that’s all.


I’m not sure I understand what the point of this is.

If I’m reading academic papers on a particular topic then I already know the notation the math is written in.

If I’m reading a paper outside of my field then I’m not really interested in the details of the equation but more of its application and what it means.


> If I’m reading academic papers on a particular topic then I already know the notation the math is written in.

This is not true in my field - notation is all over the place, even for the same topic.


A famous quote in Lee's "Introduction to Smooth Manifolds":

> differential geometry is the study of properties that are invariant under change of notation


> differential geometry is the study of properties that are invariant under change of notation

That ought to go on a t-shirt.


> If I’m reading a paper outside of my field then I’m not really interested in the details of the equation but more of its application and what it means.

This is fine, until you find the application interesting, and try to apply it. I've had to contact authors just to figure out which one of several parameters a, b, c, or d actually represented. To be fair, these came with apologies.


Welp, you might be a special case. When I'm reading papers outside of my field its because I'm looking for understanding. Annotated equations in this fashion seem real neat for that purpose.


It would be very good to include this in a future release of TeXLive.


Basically, anything on CTAN under a Free licence gets into TeX Live.


I don't think I like this as a replacement for simply defining terms in the text. You could do both but something like "S a subset of Range(X)" when the equation is about the probability that X is in S doesn't seem important enough to take that prominent a position in the equation.

I can see this style of annotation it being helpful when you need to add some context or want to explain a pre-existing formula.

And I can definitely see this being used to highlight key ideas during a tricky derivation, stuff like partial integration could be a lot neater if you can point out the part of the equation that you're partially integrating.


I want the explanations but without the highlighting. I get why it's highlighted but personally I find it distracting.


why not link directly to the github repo? but that aside, it's quite neat


At the time I posted this, the README for the repo did not include the images that are there now.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: