MATLAB vs. Python in industry at Operations Research SE contains the following statement:

I am a beginning PhD student in math, and I would like to focus on optimization. I am learning programming for the first time [...]

How common is this situation?

When I got my degrees in mathematics, computer programming courses were compulsory, and many math courses assumed that we already knew how to program. For example, in graph theory, we wrote programs to solve shortest-path problems; in optimization, we wrote programs to solve linear programming problems; in statistics we used APL.

That was as an undergrad student, 45 years ago, using multi-million dollar computers. So I don't understand how people today, when computers are so ubiquitous, can make it to PhD level mathematics without ever being exposed to programming.

What happened?

  • 46
    "There are more bachelor's programs in heaven and earth, Horatio, than are dreamt of in your philosophy..." Commented Sep 5, 2020 at 2:29
  • 3
    I am not sure how your question relates to the citing quote. Maybe this is a misunderstanding. “Linear programming” is a usual name for the mathematical field of linear optimization and has a priori nothing to do with computer programming. Actually it predates it (in its modern form). Commented Sep 5, 2020 at 2:51
  • 2
    @StephanSturm, right, ditto for "dynamic programming". But if we couldn't implement the algorithms as working computer programs, it was a good indication that we didn't really understand the underlying mathematical principles. Commented Sep 5, 2020 at 3:46
  • 1
    Likewise, the college-algebra text I taught from as a TA in the 90's had BASIC programming exercises in each section. That clearly went away, I've seen lots of algebra-level texts since then and never seen programming exercises since that time. My best math-major students in the last few years hate programming, and I can't understand it. Commented Sep 5, 2020 at 14:20
  • 1
    There was zero mandatory programming in my undergraduate maths degree 35 years ago at Cambridge University. (Which at the time didn’t even have a computer science degree that you could sign up for — you had to start some other subject and then switch to computer science after your first year.)
    – Mike Scott
    Commented Sep 6, 2020 at 6:47

8 Answers 8


Being able to do simple computer programming was much more important for engineers and scientists 45 years ago than it is now.

Doing statistics and other analysis on non-trivial amounts of data used to require programming. Spreadsheets, data visualization programs, and similar tools have become ubiquitous along with computers, greatly reducing the need for custom programming.

  • 22
    45 years ago, it wasn't possible to use a computer without having a programming frame of mind. Every use case for a computer required some programming on the user's part. Computer literacy included some basic programming. Commented Sep 5, 2020 at 4:45
  • 3
    AIUI, most spreadsheet packages' in-cell formula languages are Turing-complete, so one could argue that undertaking mathematical tasks with a spreadsheet is programming. Commented Sep 5, 2020 at 14:33
  • 1
    @DanielHatton While one can effectively program in a spreadsheet, there are many calculations that are much simpler and easier to write, well within the reach of non-programmers who are comfortable with mathematical notation. Commented Sep 5, 2020 at 18:30
  • 10
    @DanielHatton if being Turing complete was a good criterion for what’s considered programming, you’d have to also say the same about PowerPoint and Minesweeper, among others.
    – Dan Romik
    Commented Sep 5, 2020 at 20:08
  • 2
    @TobyBartels well I don’t know about you, but my programming pipeline consists of PowerPoint code whose output is fed into a combination of custom Minesweeper and Game of Life machinery I’ve created, with some Excel macros for postprocessing. I do agree the Excel part is the easy part, but where’s the fun in doing only easy things?
    – Dan Romik
    Commented Sep 7, 2020 at 17:16

It's probably fairly common.

For the United States, a good source of data on undergraduate math programs is the American Mathematical Society's Statistical Abstract of Undergraduate Programs in the Mathematical Sciences in the United States. In their most recent report, dated 2015, you can find in Table SP.18 (page 67) some data on curricular requirements in four-year math degree programs. You can see there, for instance, that among PhD-granting universities, 26% didn't require any computer science courses for any of their undegraduate mathematics majors. A further 19% required it for some of their majors but not all. There are separate figures for masters-granting universities and undergraduate colleges which are not dramatically different.

The numbers may have changed in the past five years, but I suspect not by a lot; changes in curriculum requirements usually involve a lot of bureaucracy and happen slowly.

So I suppose that the people who set curriculum at those institutions simply don't share your opinion of the importance of programming coursework, or feel that students can make their own decisions whether to take it as an elective.

(Whether or not those institutions are acting wisely is certainly a reasonable topic for debate, but this site is not the place for debates.)

  • 5
    Not requiring taking a Computer Science course is very different from having a degree program without any programming requirements. All the degree programs I am familiar with in math/physics include programming requirements but do not require the students to take CS classes. Commented Sep 5, 2020 at 16:00
  • 2
    @user2705196: How are those requirement implemented? Exams, projects in other courses, etc? For US undergraduate programs, the most common way to implement requirements is to require specific courses, and computer programming courses are generally listed under "computer science" (even though I agree that in a strict sense this is inaccurate). Commented Sep 5, 2020 at 16:03
  • @user2705196: As counterpoint, I will say that my own undergraduate degree, and the programs at the institution where I currently work, both have programming requirements that consist of requiring students to take one or more specific classes, which are designated as CS XXX. Students who already have adequate skills may be able to earn credit for those classes by completing a special project or exam, but this is an exception. Commented Sep 5, 2020 at 16:08
  • 3
    I think it might be a US vs rest of the world case. As one of the other answer states, this might depend on local customs and culture. I can definitely see CS requirements to be one way of doing it. But an "intro to programming" class can certainly be taught by the math dept as part of the math program. And yes, another way is that various classes (such as nl-dynamics, linear algebra etc) simply use computational tools that the students have pick up as part of those courses. This way strikes me as a pedagogically very useful way of doing things. Commented Sep 5, 2020 at 16:16
  • 2
    FWIW my department (math & stats, in Canada) teaches a required first-year "intro to mathematical/scientific programming" course (in Python); students can also fulfill the requirement by taking corresponding courses in the physics or CS departments. We used to have a looser requirement following @user2705196's description above: they had to have taken one or more of the courses that had a programming component (usually MATLAB or R).
    – Ben Bolker
    Commented Sep 5, 2020 at 18:19

Reading the other answer I think that this is very much dependent on the country.

In Germany this would be rather rare. At least all TUs (technical university, e.g. TU München, TU Berlin,...) have mandatory programming courses very early in their math curricula. Holds for regular math degrees. There are even more applied programs (under different names e.g. "Technomathematik") with even more programming courses. All math programs I know of have some programming courses in their curricula.

Apart from that: Using computers to do math is incredibly helpful for all kinds of mathematics! Especially for research in mathematics (not restricted to "applied math"). Doing a sanity check on a newly derived inequality, obtaining and testing conjectures, doing number crunching to get optimized constants, or using computer algebra to do tedious calculations are just some examples...

  • About your last paragraph, that would really depend on the field. In my research, I used GAP a few times to find some examples in finite groups, but in hindsight, it would probably not have taken that much work to work out similar examples by hand. I don't recall ever testing a conjecture using computer algebra.
    – tomasz
    Commented Sep 6, 2020 at 22:40
  • Yeah, all kinds is too strong. It is an active research area in and around higher category theory to develop ways in which to talk to computers about the subject at all, for instance via homotopy type theory. Commented Sep 6, 2020 at 22:44

I did some checking via Google of requirements at some prestigious universities. As far as I can tell, Princeton, Harvard, Yale, and Columbia all do not require programming classes as part of the major. These departments all take a very theoretical approach to the field, and I suspect most departments are more practically minded.

  • 1
    Regarding the last clause, I think you would be surprised. I have never seen any evidence, in exposure quite a number of American undergraduate math programs, of any interest in anything practical at all. The practically minded can sometimes take applied math degrees, but more often will simply major in computer science or engineering. Commented Sep 6, 2020 at 22:48

Math undergraduate programs are generally horribly behind when it comes to usefull skills. Had I graduated with a BS degree and only followed the guidelines given by academics I would have been mostly void of any practical ability.

  • 3
    If by useful skill you mean: in-depth of knowledge in logical puzzle type problems, computational complexity of algorithms that no one has used in the last 50 years (and are practically irrelevant anyways), and a whole bunch of unrelated trendy buzzwords such as Kubernetes, AWS and Flask, then yes.
    – Fraïssé
    Commented Sep 6, 2020 at 0:00
  • Look up the starting salaries for people with degrees in CS vs Mathematics and make your own judgement. Commented Sep 6, 2020 at 0:24
  • 1
    Having been in industry, I completely agree with the answer. Partly the reason is the argumentaion "The goal of university is not to prepare for industry", to which a partly agree.
    – user111388
    Commented Sep 6, 2020 at 16:42

My bachelor's degree (1966) is in physics, and one of the requirements was to learn some Fortran programming. I promptly forgot all I had learned about Fortran because I never had any use for it. I have, on rare occasions, used Mathematica, Maple, Gap, but most of the computations I need can be done in Excel.

Nevertheless, I think it would be good to teach programming, especially to the weaker math students --- the ones who argue when you tell them (in more polite terms) that their "proofs" make no sense. They're much less likely to argue when a compiler tells them "syntax error", and they're more likely to (eventually) learn how to express their thoughts accurately.

  • The students who don't learn anything from their abstract algebra course except how to multiply permutations and decompose them into cycles also don't learn anything from their programming course. Commented Sep 5, 2020 at 19:37
  • I totally agree with your observation that people who are (yet) incompetent in proving just need a compiler to force them to accept the fact that they are incompetent, and thereby opening the door to truly learning what is 100% precision (and hence rigour).
    – user21820
    Commented Sep 6, 2020 at 13:32
  • 1
    @AlexanderWoo: Then their programming courses are lousy.
    – user21820
    Commented Sep 6, 2020 at 13:32
  • 1
    @AlexanderWoo: I don't believe your statement. Do you have a source for that?
    – user111388
    Commented Sep 6, 2020 at 16:39

While it is occasionally helpful to know some programming in mathematics, it is not really mandatory.

I did my M.Sc. in mathematics and could not make use of my "hobby" in the field. I helped a post-grad student of my advisor (at least she claimed my calculations were helpful) with a basic GAP algorithm, but that's all.

One should accept the fact that computers lack abstraction that is necessary for mathematics. At least for now. Neither ATPs (automated theorem provers) nor algebraic computation platforms -Maple, GAP, etc- are close to being useful except on occasion.

I should probably note that I am talking about abstract algebra here. Some other fields do enjoy great utility and it makes me jealous.

That being said, I find it quite odd that in 2020 there are people (as in any single breathing, living person) who doesn't know how to program at all. Except those living in a third world country like me. Wait...

It feels like they are proud of their ignorance. May Turing bless them.


I think it is common to study mathematics without having done any computer programming. I base my opinion on the fact that when we were in school, most of us did not learn about history by writing programs.

So, if history classes are fine without computer programming and mathematics classes are fine without computer programming then it is reasonable to conclude that mathematics classes should be fine without computer programming.

Mathematics is the study of patterns. It is also about abstract concepts, and not reality. I think that computer programming is mostly about patterns. So studying mathematics should help with understanding how to program computers.

So I think that studying mathematics without computer programming is OK. However, it would have been better if you had done some computer programming first.

The main reason to learn computer programming or mathematics is not so much for the practical applications, which are usually small. The main reason is that they help you think better.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .