8 ms·
A cheat-sheet for mathematical notation in code form
- antegamisou 5y agoSee also: https://en.wikipedia.org/wiki/List_of_mathematical_symbols_by_subject https://en.wikipedia.org/wiki/List_of_mathematical_symbols_b... http://detexify.kirelabs.org/classify.html http://detexify.kirelabs.org/classify.html
- dan-robertson 5y agoMost latex symbols are named after their shape (e.g. \nabla or \Rightarrow) rather than their meaning or just one of their meanings (e.g. \times or \frac or \over or \binom). So I’m not sure detexify really helps that much.
- thewakalix 5y agoAt the very least, text is more searchable.
- maweki 5y agoSome functional patterns would be nice as well. Like summation and product are also folds and there are only imperative examples. This would be helpful as well: foldr (*) 1 [1..6] while this is the shown pattern: var value = 1 for (var i = 1; i <= 6; i++) { value *= i }
- Koshkin 5y agoThis a very good point; I would also stress that mathematics itself is highly “functional” (in its modern form anyway), and that it is stateless (unlike its representation in an imperative language).
- bawolff 5y agoI feel like if you are used to programming in haskell, you'll have no problem with math syntax
- wyager 5y agoMath generally suffers from a great deal less precision than Haskell. It’s always a treat for me as a Haskell user to find a math or physics text that’s truly notationally precise. Only authors who really understand what they’re doing at a deep level can pull it off.
- jhgb 5y agoHave you read Structure and Interpretation of Classical Mechanics by any chance? Sounds right up your alley.
- bernardv 5y agoThis is great. Thanks for putting together and sharing.
- Robotbeat 5y agoDo they have this in PDF form?
- iKlsR 5y agoJust use a markdown to pdf tool. Eg, https://www.markdowntopdf.com/ https://www.markdowntopdf.com/
- blondin 5y agoi thought github displayed latex? would be nice if this repo also included the mathematical symbols. speaking of that, would be nice if github provided rendering of music notation :)
- nixpulvis 5y ago> speaking of that, would be nice if github provided rendering of music notation :) https://opensheetmusicdisplay.org https://opensheetmusicdisplay.org should fit the bill, though you may need a tool to generate the MusicXML. I'm using it on my website a little bit, e.g. https://nixpulvis.com/musings/my-sound https://nixpulvis.com/musings/my-sound
- DaedPsyker 5y agoFantastic endeavour. I'm someone who has needed to force myself in mathematics for my career. I needed extra help at school, but had no real trouble in any other class. I thought I was just too dumb for maths. I came to realise that my problem was not in mathematical concepts which it turns out are fairly easy, but in the language of maths itself and how it is taught (some exceptions such as Strang who is just a wonderful educator). Programming in particular really helped me to learn. That's not to say that certain areas aren't still difficult but reformulating away from the traditional notation and teaching style has helped me.
- UncleOxidant 5y agoI'm very similar. Show me a big mathematical formula and I'll have to dig into it for a while to understand it. Show me the code that implements the formula and it makes sense a lot quicker (for me anyway).
- mhh__ 5y agoI am the exact opposite. I look at code written by some analyst or whatever at work, and it's usually borderline unreadable if you ask me. Pretty print it as latex and I can visualize what it actually does almost immediately. Besides, I don't really care about "the code" i.e. the mechanics of computation but rather the properties of that expression that exist regardless of how it is communicated i.e. it's shape or how it behaves asymptotically etc.
- porknubbins 5y agoI have had this same experience of finally understanding a mathematical idea by seeing it implemented in a programming language. You can always eventually understand a program because there can't be any ambiguity or the compiler couldn't decide how to compile it. Math is not supposed to have ambiguity but it arises because there is too much convention and assumptions in the notation (granted sometimes they are saying something broader than can be expressed in code). But higher mathematics as a field seems to me to be like a programmer who uses single letter variables, never write comments and really like clever bitwise operators.
- deleted 5y ago[deleted]
- monitron 5y agoI really like this. It took me a minute to figure out that having GitHub in dark mode was making the embedded math images effectively invisible. Just in case this trips anyone else up, switching to light mode will make this doc make a lot more sense :)
- toastal 5y agoBecause this document should be published to a static site so there's opportunity to aid in legibility. Personally I find the characters-per-line to be too much, and there's no value in the GitHub branding encompassing the document.
- Kosirich 5y agoI think it would be neat to have a browser add-on that would explain meaning, use and code equivalent of a mathematical notation when user would hover over it.
- _Microft 5y agoThat would be difficult. How would it know if f * g is a product or a convolution for example?
- gammalost 5y agoIt could be ordered from most to least likely like search results. Multiplication is more common so put it at the top. People will assume that it's not the right thing and work down the list
- contravariant 5y agoWell if it's mathematics then it's almost certainly a convolution. Although it could also be a mistyped sub or superscript star on f, which has various different meanings.
- Koshkin 5y agoWhy would you want to have something like this translated into code: a + b ----- c + d Math, in this sense, is already a language, and what you see is already code. (So, basically, all you are talking about is translation, like, from Ruby to Python.)
- Kosirich 5y agoThis is not what I meant at all. What I want is that I can select "sum symbol" for example, and I can get small description in a popup window. (for more complicated things that is)
- Pxtl 5y agoSo I guess somebody else saw Freya Homer's Twitter thread? Because this was in the replies. https://mobile.twitter.com/FreyaHolmer/status/1436696408506212353 https://mobile.twitter.com/FreyaHolmer/status/14366964085062...
- iKlsR 5y agoHaha, I posted it actually. I knew it would make it here again, this is where I first saw it years ago. I saw the repo get about 1k stars since and I had to disable my likes notification.
- BeetleB 5y agoOuch! For me, looking at the formula I can instantly see what it is, whereas I have to think a bit when I look at the code. Given how often I've used summations in physics/maths, I shudder at how verbose it would be in code. Something I could write in one line may take up a whole page.
- Cybiote 5y agoThe code on the right is an explanation or implementation you could jump into. The replacement for use would be the function name, such as `summation` or `product`. A computer language is already used to communicate almost all math these days: LaTeX. A slightly lighter syntax, perhaps with optional unicode names, built on a symbolic math package would not be any more cumbersome.
- DethNinja 5y agoThat is pretty amazing. I really wish that entire science would just move on from usage of symbols to algorithms, it would considerably reduce the total information one needs to know before starting to study some fields with more esoteric symbolic notations.
- deleted 5y ago[deleted]
- Koshkin 5y ago> entire science I am not sure how you would replace the structural formulas used in organic chemistry, for example. Going beyond science, most engineering disciplines use schematic notation that you would find esoteric, yet with no chance to be translated into algorithms in any meaningful way.
- evnix 5y agowow I so wish I was taught this way. I am currently paying a math teacher to teach me derivatives all over again. I know how to solve those since I am from a science background but don't know what they really mean. even simple things dy/dx, is that dx multiplication or is d a function. It took me 2 frustrating classes to even let the teacher know what I am trying to ask. Math as algorithms would make self learning so much easier and fun. I would love the field of mathematics if it was not so ambiguous.
- nimih 5y ago> I would love the field of mathematics if it was not so ambiguous. IME the ambiguity is usually intentional. Take dy/dx for instance. In some sense, d/dx is acting as an operator (or "function" to use programming terminology) acting on the function y to produce y'. However, the intuition here is that we're calculating a slope (ie. a ratio), and the particular ratio we want is the limit of [a sequence of] Δy/Δx. Both of these viewpoints are important to keep in mind to understand calculus, and the point of the notation is to aid that intuition. There are, as I'm sure you're aware, alternative notations for derivatives, and the d/dx notation survives because it suggests things beyond its formal definition. I think this becomes the most clear when we consider the chain rule, dx/dy * dy/dz = dx/dz. We can't just "cancel out" the dys (outside of exotic approaches such as nonstandard analysis), but allowing that sort of visual pun in our notation makes the formula easier to remember and gives a sense as to why it might be true. And, if we didn't know the chain rule ahead of time, it would likely prompt us to try and prove it in the first place. The bigger story here is that a lot of mathematics runs on human intuition, and finding a notation which communicates and facilitates that intuition is quite important.