(no title)
defrex | 4 years ago
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.
IngoBlechschmid|4 years ago
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 `よ` 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.
mattmanser|4 years ago
So you're sort of arguing against a straw man there, almost no programmer would expect you to name such a concept 'arbitraryNumber2', we would also name it x or y if it made sense in the code.
DougMerritt|4 years ago
"My favorite symbol is by the way `よ` which denotes the Yoneda embedding" which was named after its mathematician inventor/discoverer Yoneda [1]
The character is the syllable "Yo" in Japanese katakana, and although not everyone knows katakana, still it is mnemonic for "Yoneda" rather than being wholly arbitrary. [2]
[1] https://en.wikipedia.org/wiki/Yoneda_lemma
[2] https://en.wikipedia.org/wiki/Yo_(kana)
robocat|4 years ago
I think saying programming languages are better than Mathematics is just due to your familiarity.
phailhaus|4 years ago
WalterBright|4 years ago
Ooh, good idea! I'm getting sick and tired of foo(), it's time for walter().
taeric|4 years ago
tartoran|4 years ago
ithinkso|4 years ago
It might be awful from the outsider's perspective but so is a foreign language if you never learned it. Hard to complain about it though and if you want to know what others are taking about there is no other way around but to learn it - it won't change in order to make it easier for you, it will change to make it easier for the speakers
User23|4 years ago
[1] https://www.cs.utexas.edu/users/EWD/transcriptions/EWD13xx/E...
yongjik|4 years ago
On the other hand, in a typical math textbook, the kind that will take you a full year to read through, the list of "all the symbols ever used in this book" usually fits in a single page.
There's no point in writing "CircumferenceRatio" when π does the job. Imagine solving a partial differential equation with CircumferenceRatio appearing five times each line.
creata|4 years ago
> Those kind of shenanigans would never pass a code review
Yes, because code is used in very different ways to a mathematical expression. When you see code in a repository or a textbook, I doubt you find yourself copying it out over and over again in your own work.
ben_bradley|4 years ago
At least with programming, you generally don't see different semantics depending on the value of something! With math, there's sin^2 as in: sin^2 theta + cos^2 theta = 1, which reads the square of the sin of theta, etc. But then there's sin^-1 which means the inverse sine AKA arcsine, and NOT 1 / sine, which would be consistent with previous usage.
paulpauper|4 years ago
User23|4 years ago
edflsafoiewq|4 years ago
[deleted]
currymj|4 years ago
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.
elihu|4 years ago
Anyways, programming languages generally follow math notation, and use radians for trig functions and so on. Usually that's not too much of a problem, but when applied to file formats like VRML which were meant to be human readable, the results are ugly.
For the most part though, I think math notation is pretty good. At least when compared to something like standard music notation, which is full of weird rules and historical accidents.
mannerheim|4 years ago
Calculus is generally worse with degrees. The derivative of sin(pi/180 x) is pi/180 cos(pi/180 x). That's pretty inconvenient, especially if you're writing any sort of models that need to solve differential equations. Same reason base e is preferred for exponents.
hervature|4 years ago
neolog|4 years ago