Math4devs.com: List of mathematical symbols with their JavaScript equivalent
50 points
4 days ago
| 4 comments
| math4devs.com
| HN
shireboy
4 days ago
[-]
This is pretty cool. As a self-taught developer with a non-CS major, my math limited out at college algebra 2. I recently did Brilliant.org calculus just to try to make better sense of various CS papers, and I thought at the time I could probably understand some of the concepts in code better than standard mathematics notation. Something like this definitely helps me understand the math symbols better. I could see taking it to the next level and adding other languages and symbols.
reply
drproteus
4 days ago
[-]
How is Brilliant? I see it plugged in Sabine's videos and I'm really curious on brushing up my math and physics.
reply
shireboy
3 days ago
[-]
It’s ok for what it is. I learned some and enjoyed, but eventually cancelled for various reasons. Math Academy is good if you want a serious course (they are accredited and offer a transcript). Khan academy is good if you just want some online courses.
reply
joeframbach
2 days ago
[-]
1. Floor operator is `⌊n⌋`.

2. Exponentiation implementation depends on the size of the power. For very small powers normally they are represented as their reciprocal, then operated on within the exponent.

    y = b ** (1/x)

for very large x is rewritten as

    y = Math.exp(Math.log(b) / x)
reply
Rendello
4 days ago
[-]
I like this a lot. I've been going through HS-level math with Math Academy and I'm always intrigued when I see these symbols in advanced calculations elsewhere online.

I recently learned the syntax for half-open intervals. It's so frustrating that I can't bear to type it out. This is relevant: https://xkcd.com/859/

reply
shireboy
4 days ago
[-]
My son is using Math Academy and it's been excellent. A really good system if anyone is looking for online math course.
reply
Rendello
4 days ago
[-]
I've been at it consistently for a month, it really is good. The only downside is that I'm desperately on the search for other courses with its format to no avail.
reply
sxp
4 days ago
[-]
Do programmers use those weird font ligatures in practice? E.g, Rendering `a != b` as `a≠b`. I've only seen them used by people who want to show how far they can push coding style away from the standard monospace low ASCII, but haven't seen any good justification for them.
reply
tkcranny
4 days ago
[-]
I happily use Fira Code [1] with ligatures. It has nothing to do with pushing coding style away from monospace, and everything to do with readability. Aesthetics are certainly a part of it but perfectly compatible with it too.

Of particular note is that the JS arrow function becomes a real arrow ⇒, which is nicer than the operator-ish rendering of equals and a greater than sign. Other quality of life improvements are reshaping ripples of characters to be clearer, such as a reshape to www and **. Triple bar equals is nice too given the differences in JS.

[1] https://github.com/tonsky/FiraCode

reply
adrian_b
4 days ago
[-]
People who have little experience in mathematics are content with symbols like "!=".

On the other hand, people experienced in mathematics find silly to use a whole bunch of arbitrary composed symbols to replace the traditional mathematics symbols, some of which have been used for centuries, only because a half of century ago the ASCII character set standardized by Americans, for which the priority was its suitability for commercial correspondence written in English, not for mathematical formulae or programming languages, and previously the even more restricted character sets implemented by the IBM peripherals, have forced the designers of programming languages to substitute the classic mathematical symbols with whatever was available.

Now when Unicode is available, it is possible to design a new programming language that uses any desirable symbols.

However the most important legacy programming languages are still specified to use only ASCII, with the possible exception of identifiers. Ligatures allow one to see whatever symbols are preferred, while still delivering to the compiler ASCII text.

This tradition of using very restricted character sets has been imposed on the world by USA, and especially by IBM, to reduce their manufacturing costs in the early years of computer technology. Its consequences have been both the difficulties of using in computer applications the letters with diacritics that are essential for most non-English languages and also of writing mathematical formulae.

In the beginning, the programming languages partially or totally designed in Europe, like ALGOL 60 or CPL, were using much more mathematical symbols than available in the American computers. Because of this, eventually they had to be transliterated in order to be able to make compilers for them that could run on IBM computers or the like.

reply
LandR
3 days ago
[-]
Yes, a lot.

I use a plug in for vscode that does all sort of substitutions along with ligature.

E.g.

    (reduce + [1 2 3])
Shows as

    (Σ + 123)
Or

    (comp foo bar quax)
Becomes

    (∘ foo bar quax)
Etc, I find the conciseness so much easier to read.

Unfortunately the plugin can be buggy when you hsbe a lot if subs, I'd setup loads if I could. If only someone would fix it / make a version that works.

reply
spoiler
4 days ago
[-]
I use MonoLisa with ligatures and it helps me with reading code. I'm dyslexic so it helps me not go cross-eyed. There's better dyslexic fonts out there, but they tend to be ugly even if it makes reading stuff easier.

Mono Lisa strikes a nice balance. If you want a free version, I think JetBrains Mono is decent too

reply