Why Don't Computer Scientists Learn Math? (2016)
lamport.azurewebsites.net
lamport.azurewebsites.net
So, I watched the lecture on youtube. Speaking as someone who was glossing over the mathematical notation and essentially deferring to the speaker for correctness, I could not do it from the time he called it into attention to the time he asked for hands up. I wouldn't have put my hand up, had I been at the audience then.
Had he asked "are you able to understand this notation", then I'd put my hands up. Scanning to see if anything unfamiliar is there takes hardly any time at all. Actually reading and being confident that you understand what it means and all the implications takes time, for someone who doesn't do that on a daily basis.
Using a very silly example: e = mc^2. Can you read it? Certainly. Do you understand it?
It usually only seems like bad notation if I am misunderstanding things.
Math would be an entirely more enjoyable subject if it were communicated in more practical terms that can be executed on a CPU.
There are so many interesting objects in math that cannot be executed on a computer. You could define the set of permutations of the naturals, for example, which is an infinitely large set; there's no algorithm you can execute which could produce such a set on your computer. Math would be severely limited if it could only deal with things that were computable on your workstation.
You can have math that is entirely computational -- it's called constructive math -- but the result is a very different math. For example, in constructive math, all functions over the reals are continuous, and not all subsets of finite sets are finite.
The edge case of summing infinite sequences has no practical application in CS.
The number 2 is \Sigma_{n=0}^{\infty}1/2^n. So you're "using" sigma every time you use the number 2, which may be practical in some programs.
The fact that you can't write a program that sums an infinite sequence using an infinite number of computational steps doesn't mean uncomputable objects have no practical application. In fact, the formalism Lamport talked about in his lecture makes common use of them, and you do, too, every time you use floating point arithmetics. When you use floating point numbers, it's very convenient to think of them not as the very complicated objects that they are, but as a real number (an uncomputable object) with some error term; in fact, that's how floating point is thought of in the design of many numerical algorithms. In other words, objects that are directly representable on a computer, are often conveniently thought of as approximations of uncomputable objects. If you can't write what the non-computable object is in a language designed to assist in reasoning about how algorithms work -- which is the subject of Lamport's talk -- you're making life much harder for yourself.
Another problem of thinking of summation as a for-loop is that it makes you think of the definition as an algorithm, which it isn't. For example 4 * 5 = \Sigma_{i=1}^{5}4, but both of them are just different representations of the number 20. In a program it may make a big difference if you're writing 20, 4 * 5, or `for(i in 0..4) sum+=4`. In mathematical notation, all three are the same. It's not like one uses a cheap multiplication operation and the other an expensive for-loop.
Classical math is concerned with relations between "preexisting" objects. The statement 4 + 5 = 9 does not mean that the numbers 4 and 5 are added by some algorithm to construct the number 9, but that the three numbers are related via a ternary relation. The statement 9 - 5 = 4 is an equivalent statement in classical math, expressing the very same relation, but means something radically different in computer programs. I think it's important for computer scientists to understand this difference.
Jean-Yves Girard, the inventor of system F in functional programming discusses this difference in Proofs and Types[1], in the very first section, called "Sense, Denotation and Semantics".
{f ∈ [1..N ⟶ 1..N]| ∀ y ∈ 1..N: ∃ x ∈ 1..N: f(x)=y}
would be the notation i am used to. I believe it's called set comprehension in english.That is basic, I didn't touch math 15 years and still now that.
I got the meaning presented in the article because I've practiced the notation presented, but wouldn'nt have figured it out instantly otherwise.
We have different programming language syntaxes for a reason.
Being a mathematician, programmer and psychologist, I can hardly believe that you can rip math notation apart from math itself. To be fluent with math one needs three "languages" which her mind can use in parallel to think about math problem. Its math notation, English (or any other natural language) and visual mental image. If any of such a mental languages is not available to a person, or if he is unable to translate from one to other, then he would struggle with math.
Yesterday one of my coworkers submitted some code to perform an upsert to code review. His logic for calculating the diff set was extremely complicated, and subtly wrong, filled with comments. To me the idea was incredibly simple, because I only needed to think of the upserts in terms of set notation. So in review, I wrote the set notation implementation of the upsert, and then offered code to implement the idea.
My coworker was taken aback at how simple this set based implementation was, despite it being very basic set mathematics. While this was just an anecdote, I find that a lack of basic mathematical fluency peppers codebases with unnecessary complexity and myriads of edge cases that could easily be tamed with a slight application of mathematics.
This thing doesn't happen in finance. Or generally speaking places that require a hard degree, and in extreme cases test maths aptitudes.
I dunno if things have changed since I last pursued this, but 5 years ago it was absurd.
CS, on the other hand, has a lot more material readily available for self-study. I find the subject itself also lends itself to being more accessible. Furthermore, unlike math, the practitioners of CS related fields seem to be concerned with readable notation.
So, mathematicians: acessibility is key! Math is fascinating, but inaccessible even to a large part of the intelligensia.
All these complaints about mathematical notation seem really uninspired to me. It's like if I went around complaining that programming shouldn't require all this horribly baroque textual input.
You may or may not have a point , but either way it's certainly not one that's helping you at all.
If you find yourself frustrated at a seemingly nasty piece of notation, often this is a (helpful!) signal that you're not fully grokking things. Make use of that confused feeling to dig deeper.
Admittedly, compared to programming there are considerably fewer online resources for hacking together some maths knowledge. However, in book form there absolutely are tons of excellent materials!
Pick a subject, Google around for text recommendations, and then go raid your local university's library. There are even pretty good IRC channels for various math subjects! Try hitting up #math on freenode.
[1] https://www.amazon.com/Mathematical-Notation-Guide-Engineers...
Someday I'd love to see a similar thing that's simply an operator to function index where you can read in code/pseudocode what an operator does on a (bounded for ease of reading) datatype.
About the post, though, it would be way more constructive if the author would propose a way for people to learn what their lacking instead of just complain about it.
He could have instead asked:
"Raise your left hand if you can interpret this formula, and raise your right hand once you've determined that you wouldn't be able to do it without consulting a resource."
After a set timeout he'd have a better sense of where people stood.
That sounds complicated though. Maybe people just prefer simple consensus algorithms, even with imperfect results.
∈ = is an element of
∀ = for all
∃ = there exists
I did a fair bit of set work in college, but it took me about a minute to dig some of that up to read and understand the relationship that's being described. I don't think I've worked with sets using actual mathematical notation in over 10 years. It wouldn't have surprised me if I couldn't read it (although I would've found it somewhat distressing).
The weird part is his audience: active students and researchers within the field of CS. They're the ones that I would've expected to be most likely to understand what it said.
As a programmer, I would read that as if he is defining a set of function objects. And the domain and codomain of the those function objects must be integers in the range 1..N.
Come to think about it... Isn't the size of the set exactly the number of permutations from 1..N? In other words N^N? If so, an audience of computer scientists would probably have understood the following better:
import itertools
list(itertools.product(range(N), repeat = N))I'm a very experienced programmer (>25 years) and I don't know the language you're using in your notation (Python maybe?). The kind of mathematical notation Lamport is using is much more universal (at least after he explains its particular peculiarities). Also, reading your notation, I assume that you're describing a list, while he's describing a set.
>>> from itertools import *
>>> [s for s in product(range(2), repeat=2) if len(set(s))==2]
[(0, 1), (1, 0)]
>>> [s for s in product(range(3), repeat=3) if len(set(s))==3]
[(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)]
>>> len([s for s in product(range(4), repeat=4) if len(set(s))==4])
24
>>> len([s for s in product(range(5), repeat=5) if len(set(s))==5])
120I don't think so. Probably depends on your section of the industry. In mine, C, Java and Matlab are all better known than Python.
> you'd be well-advised to learn it
I did; a few times, actually. I just keep forgetting because I never get an opportunity to use it. Once you've used well over 10 languages, you don't even try to maintain your skills as that would be a waste of time. You just relearn the language next time you need it, especially as popular languages come and go. Standard mathematical notation, however, has been with us, pretty much unchanged, for about 100 years now.
In any event, you can't express in Python nearly everything you can express in standard mathematical notation, unless Python has gained some features that allow it to express uncomputable objects since last time I used it. Does the itertools library support infinite sequences? How about uncountable sets?
https://fliptomato.wordpress.com/2007/03/19/medical-research...
In the name of efficiency it is kind of being exclusionary, which I kind of resent.
I love math but it is not the only way to express complex concepts.
I depend more of the concepts from statistics than higher level mathematics courses.
Is this data nominal, ordinal, interval or ratio? OK, let's work with that.
It is a terribly complex description. Welcome to statistics. Permutation is a basic combinatorial concept that is assumed to not have to be explained.
To quote him, in reference to new mathematics of the post-Sputnik era,
"In regard to this question of words, there is also in the new mathematics books a great deal of talk about the value of precise language - such things as that one must be very careful to distinguish a number from a numeral and, in general, a symbol from the object that it represents. The real problem in speech is not precise language. The problem is clear language. The desire is to have the idea clearly communicated to the other person. It is only necessary to be precise when there is some doubt as to the meaning of a phrase, and then the precision should be put in the place where the doubt exists."
That they probably forgot all of it immediately after the final is probably indicative that they're interested in a career in software engineering not research
If, loosely speaking, T maps you to 'average computer scientist', then the situation is different. And so on.
So depending on the type of T, subset or groups of computer scientists or metrics you are looking at, Lamport's observations hold water.
When I took CompSci 101 15 years ago, basic mathematical notation like this was necessary to pass.
[Emphasis by me]
When I did mine we didn't have a single "programming" course in the degree you were expected to learn the language a corse utilized on your own.
Math and physics were at the undergrad level of their respective BSc. Degrees and the coverage was nearly the same.
As far as notations goes then it was covered in one of the first 3 "101" courses you take, your first program was effectively handwritten in this manner.
Now think of it as a sequence and you get something like this: {(aᵢ) i∈[1..N] | aᵢ∈1..N, ∀i,j : aᵢ ≠ aⱼ}. Probably already easier to understand.
Or leave it off totally. Formal mathematical definitions don't make sense when they are harder to understand than words and when you do not use them actually later on.
In all of them, math plays a major role. But is math notation necessary to understand/communicate math in an ORAL way? I understand this is critical to write a paper in a terse way, but orally?!
Admittedly, most of us can do this in our head quickly (for easy cases), but I find the formal evidence lends itself well to more complex scenarios.
In France, I definitely learned mathematical notation. Actually, I learned ∈, ∀ and ∃ in high school. And I had set theory courses in the first year of my master's degree (I mean first year after high school), among other mathematical courses.
That's what formal notation is like. The advantage of a formal notation is that it is both succinct and fully precise, and can, therefore, be used to perform formal proofs, possibly using a mechanical proof checker. Formal proofs are especially important in computer science, where theorems about programs are not mathematically deep but do have a lot of details that can be easily overlooked when reasoning informally. Lamport's talk was precisely about that: formal reasoning about algorithms. In that context, the ideas must not only need to be communicated so that they are intuitively or roughly understood -- as is good enough for math -- but made absolutely precise.
To make things more difficult, any mathematician opposes vehemently to any change in notation or to use easier notation to pass the same concept.
BTW as an anecdote I recognised the symbols but didn't derive the correct meaning, as you can see elsewhere in this thread.
May be related - Even with 15 years of programming, I tend to forget certain syntaxes while programming - but that doesn't mean I don't know programming
What does the colon : mean?
It used to be that:
| = given that
, = and
but, I have never seen a : used in math.
Edit: clarification
In fact, the notation used by the lecturer is sloppy. Numbers 1..N is not a rigorous domain definition. (Unknown if real or natural.)
What I'm wondering is whether or not there was some other factor going on, because I'm trained as a computer scientist and found nothing particularly objectionable about the formula, other than the f[] application notation. (And as a polyglot programmer, I've long since made my peace with that sort of notation mutation.) And I am by no means well-practiced in that sort of thing; I've been out of school for 14 years now, and only dabble on the side in this sort of thing now. The "forall y there exists an x such that" pattern in the middle is an extremely common recurring pattern, and what surrounds it on either side is also extremely simple.
> engineers
I think it's important to realize that these are two different things. One is a formal research science, the other deals with practical problem-solving and implementations.
Your typical software engineer likely has a CS degree, but CS researchers and software engineers are two separate populations. Sometimes the same person will do both, but usually not at the same time in their life or for the same organization.
edit: for example, you don't even need a computer to learn computer science fundamentals. A notebook or deck of playing cards will do fine.
TBH I personally don't always raise hands to such questions though.
Possibly I'm an extreme outlier, because when I say that I try to keep up with the field a bit, I really do. I really do watch YouTube videos of presentations full of math significantly more complicated than that every so often.
But still, I would also stand by my wondering if there was something else going on here, because it still seems to be grad students in school at the time really should have followed that. When I was in grad school I am quite confident I knew several other students who would have understood that just fine, and I went to "just" Michigan State, not MIT or Berkeley.
In computer programming "exists" it's a matter of checking all the possibilities and find one, therefore is restricted to finite sets (and realistically speaking quite small the ones).
On the other hand in mathematics there is no such restriction. Existence is just an assumption, if there is at least one, then we go further with the assumption, no meter we talk about finite sets, infinite countable sets or infinite uncountable.
I'm working as a computer programmer for quite a long time and I also find this very annoying seeing people around thinking only finite when they have to solve real problems.
is not expert-level material.
Didn't major or minor in mathematics but I took a few papers. Time to the read the article and collect my prize or look ignorant under my real name on the web.
EDIT: I was wrong! Though in my defense I had been given the context from TFA I think I would have got it.
> They don't know math
ok, let's move on to the next thread.