Problems of Traditional Math Notation (2004)
xahlee.info
xahlee.info
It doesn't require a grammar, because it is interpreted by humans, not parsed by a computer.
Ambiguity is a major problem in computer languages. It is not so in human languages—human languages are riddled with ambiguity from start to finish. But they've also been developed over a period of hundreds of years to assist human communication.
Math is written for humans to read. Programs are written for computers to read. What's good for one, is very bad for the other. Don't confuse the two—computers are very precise, and very stupid. Humans are very smart up to a point, but no further. Their needs are very different.
The author is prematurely optimizing math - is Leibniz notation _really_ going to cause problems, or ambiguity with the meaning of parenthesis. Out of all the things that cause me difficulties with math, notation is the least significant. If notation _is_ a problem, then that means that I don't know what I'm doing.
If you really need to be specific, there are plenty of ways to do so using the English language.
It's all very much just an extension of human language, just like you said.
If programs were written for computers to read, we would still be writing them in machine language. Quite the contrary - programming language design is to a large degree a human-interface problem, because programs are primarily written to be read by humans: our teammates, our successors, even ourselves, coming back to the project after working on something else.
The existence of Brainfuck demonstrates that computers are indifferent to the qualities which make a programming language useful or legible to humans.
The irony in your comment that "math is written for humans to read" is that I find traditional math notation to be practically illegible. I typically cannot make any sense out of the pseudocode in a CS paper until it has been translated out of traditional math notation into some more familiar, programming-language-style notation.
The operative word here is "I"
And computer languages are obviously designed to be understandable by both humans and computers, but it is still the human that has to bend to the ways of the computer.
... elder programmers. who would be called computers in olde times.
The real problem is symbolism, though it's necessary, because only in symbols can we express a wrong statement, while on the other hand you can't take an apple and another apple and have three in the end.
The latter is crazy. Consider the expression "F{e^{-t^2-y^2}}", which might stand for the fourier transform of a 2d gaussian, or it might be the fourier transform of t, with a parameter y, or it might just be the fourier transform of a constant function, or... It is only really defined in the surrounding text. The notation is incomplete and while in this example that might not be such a large problem it just gets worse as you pile on complexity. All integral transforms are written like this, as are expected value, variance and so on.
A lot of times notation in math is choosen to be suggestive. For example, the integral and sum notations are actually pretty neat, since they make common manipulations more visually clear. In particular, since the order of integration doesn't matter, putting the binder inside the integral as a "factor" is actually pretty inspired - commutativity makes Fubini obvious. The "d/dx" the author complains about can be made precise and is similarly great. Consider "dx/dz = dx/dy dy/dz", doesn't this just look entirely natural? But there's something about manipulating functions as first class objects that seems so unnatural to mathematicians that it needs cryptic notation to ward of the unwary...
Plus there are reasons to treat functions of functions differently. Often there are subtle assumptions made on the domain of a function of a function. The space of functions is just too damn big to work with naturally. Almost none of the things you want to do to functions are applicable to all functions. R^R consists mostly of pathologies and monsters.
That the set theoretic definition of "function" as a functional relation between sets is rarely useful isn't really so surprising that you need to emphasize that you use a more reasonable notion of function all the time.
And the integral transform notation is frequently changed, but only ever locally and in different ways by different authors. Pick up two books on "Fourier transforms for engineers" and I promise you that you will find different notations for the same thing and probably even different notations within the same book. And none of them will be good.
Maybe I'm missing something, but I don't see an issue at all. Perhaps you can present some examples?
I understand where you're going with the Fourier example, you often need surrounding context to know what's going on, you need to know what it is used for.
This is perhaps the biggest difference between math and computer notation, but it's a feature, not a limitation. If you want to you could easily repeat all the variables on the left side of each expression, to make it clear what the frequency domain variable is. But you don't do that, because there is no need for each expression to stand on its own. It's not even needed in all computer languages, e.g. Swift is typesafe but type is inferred and often not even explicit anywhere.
Definition and equality are really the same thing. A definition is just an introduction of a term/variable, and an equality giving it a value. So the only difference is if a term in the equation hasn't been introduced yet.
> The bracketing placement of symbols for absolute value, is not a matching pair, thus is ambiguous (when nested or sequential).
How was it not a matching pair? I only see two |'s in each equation so they have to pair up. What other way is there to interpret it?
> the notation for differentials “dy/dx” rapes the division notation. The differential notion has no position in math regarded as a computer language, as implied by the math philosophies of formalism and logicism.
I believe the original reasoning for notating derivatives as dy/dx is that it is a limit of a faction and so approaches a fraction of infinitesimals. with that background the division notation is simply extended to a new class of numbers.
I am not sure what the second sentence is trying to say.
Also pretty much all of the issues could be solved with gratuitous parenthesis. So we have a solution to get a formal grammar; we use the current notation because it is faster to read and write. So without any concrete proposals, this critique has very little content.
Yeah, I get the issue in general, but the quote I referenced was specifically referring to the equations from Wikipedia.
My thought is that pretty much any mathematician would not choose to use absolute value bars in a case where it would be ambiguous. For example (|a|)b(|c|) would be instead written |ac|b and |a(|b|)c| would be written |abc|. And so unless it the equations are specifically about showing properties of absolute value (in which case just use parenthesis), I don't see a case where the ambiguity would pop up in real discourse.
That changes the meaning. You're now relying on multiplication being commutative which is not true for all sets.
As I said at the end of my last comment: I don't see a case where the ambiguity would pop up in real discourse. If you are dealing with non-commutative objects you can deal with a few more parenthesis. Just like non-associative objects result in many more.
In CS we talk about l-values and r-values. Only an l-value can be assigned to, but you can compare r-values for equality. So there is a solid distinction there between types of expression which is upheld in programming languages.
For example i^2 = -1 is the generally accepted definition of the imaginary unit.
See n+k patterns in Haskell for a programming exception to the rule you mention.
An interesting way of justifying how two things are really the same thing, that is, by acknowledging their difference.
The point is that the pointed ambiguity (the difference) can be quite significant, and these become apparent when studying these sentences in a formal logic. Hence, the significance of the ambiguity.
This (and the article under discussion) just echoes the idea that mathematical sentences and proofs are considered "rigorous" but "informal", where "formal" is the domain of logic.
You could substitute quite a lot of other things for 'mathematicians/math' and this would ring equally true. I've noticed that people often defend the system they learned within even (or perhaps because?) when its limitations are creating a barrier for potential new entrants.
I mean, I get that there is a lot to be confused by. There is a lot going on. But the points being argued here seem irrelevant to the point of someone just trying to get pedantry points.
If anything, I think everyone should be encouraged to create their own notation and have fun with it. A large part of the challenge will be translating it between their notation and a common one.
In that, notation is really no different from a specialized language. A sentence like "a monad is a monoid in the category of endofunctors" doesn't make sense if you don't know what those strange words mean; but if you understand the concepts, you probably also know what they are called.
Contrived examples of ambiguous expressions like in the article are pointless, since there are always non-ambiguous ways to write the same thing.
The flexibility of math notation makes it flow much better, you can vary the level of verbosity to suit the context. There are even conventions around variables names, so that no one would misunderstand an expression such as f = x^2 and think that f is a constant.
It's a beautiful, intuitive, highly efficient system evolved over millennia. It might not be perfect but if someone had come up with an improvement it would have been implemented already.
I find that it's very seldom that I struggle to understand an expression because of limits in the notation system, I think this is more a case of someone coming from computer science, where notation by necessity is completely unambiguous, and being dissatisfied with math notation on a philosophical level.
Math notation is a bit like writing down spoken languages, the intention is to provide just enough information so that a native speaker can understand which word is being referenced. It's definitely not to provide an encoding of the sounds that can be decoded by anyone with a simple table of correspondences.
Sometimes I find myself looking at an expression and understanding what is meant, but not really knowing _how_ I can understand it. Like when you intuitively can pronounce a word you've never seen before, but you can't consciously determine what rules you applied to arrive at that pronunciation. I think that is beautiful!
Doing the CS guys a kindness will probably pay the field back several times over. The latex-fussing and symbol collision in mathematics is not pretty.
In the same way, you could say that in one sense (though possibly not the mathematical sense) there are lots of different uses for "=". Most of the time this obviously hasn't been an issue, if it had been, people would have introduced new symbols. For some cases they have done just that, it can sometimes be useful to explicitly distinguish definitions with ":=" or a triangle above the =. In the same way people sometimes use a triple line = for "is identical with". But seeing that everyone knows these symbols, but still make do with just = in most cases, even they are only half useful.
Whereas in the professions, we are so deep into sub-specialties and sub-languages that even without ambiguity we are approaching a Babel where mathematician does not understand mathematician and lawyer does not understand lawyer.
Because people with a math background, rather than those with a CS background, dominate the field of math, the notation is unlikely to change ever.
Why there is no Hitchhiker’s Guide to Mathematics for Programmers https://jeremykun.com/2013/02/08/why-there-is-no-hitchhikers...
A mathematician can of course think about it and know what is meant. But there are many alternate notations that could be used, where such ambiguities don't even occur (e.g., balanced parens).
Autoscaling does seem like a nice solution in this case, which preserves the traditional notation while resolving the ambiguity...
Except in this case the ambiguity comes from typography rather than notation. ‖c‖a|b| for example is exactly the same statement with different typography and is a lot less ambiguous. The problem here isn't math notation, but trying to apply that notation using only pure ASCII.
‖.‖ : V → ℝ
...where V is a vector space. I guess technically the reals fulfil the definition of a vector space, but I'd imagine that would grate against most people!I suppose one could read ||c||a|b| as norm(c).a.abs(b), but usually the sets involved and typesetting would distinguish this. (i.e., It's only ambiguous in ASCII!)
R can definitely be seen as a vector space, just like R^3 for example, but then you wouldn’t also have absolute valley.
It wouldn’t be ambiguous in ASCII either because c would be defined earlier, you’d know what it is.
It is easy to see that the postfix expression is just a composition of a bunch of functions "fac ln 2 ^ -1 ^", but not so easy in the infix case. It is also easy to derive the inverse of it: "-1 ^ 1/2 ^ exp fac^-1"
I'm also not convinced that (a x n ^ *) is going to catch on as a replacement for ax^n.
I think some kind of postfix notation could be nice for category theory though, it always confuses me that X -f-> Y -g-> Z is a diagram for gf, not fg.
> the ambiguities of the equations
Mathematical language is the least ambiguous language you will find anywhere, other than executable code.
It's messy to actually draw a triangle, but there are alternative notations for it.
(a+b)/a = a/b = φ
Does the author not like that a new symbol is introduced like that?