1. 18

Context: my partner runs a student organization at our university for math majors, and they’re putting on a workshop for math majors who are interested in computer science.

I’m trying to think of cool demos or follow-along things they can do during the workshop, and then we’d like to provide them with a good resource to continue with after the workshop ends.

Most of the students are probably interested for things like quantitative finance, so I think it would make sense to base things in python, as that’s what they’d most likely use in such areas. But I don’t want to just hand them a generic “learn to code with this easy tutorial”; especially since these are math students, I’d want to give them something meatier and more rigorous.


    1. 9

      How about constraint solvers? When I was still in physics, seeing Minizinc in action would have blown my mind.

      1. 1

        I’ll add examples of them on the classic, planning problems like employee or exam scheduling. Maybe on some newer ones such as the right type and number of VM’s for optimal costs for a given application. Practical stuff vs just stuff that sounds cool.

    2. 8

      Symbolic computing with a Lisp, and specifically this section from SICP on symbolic differentiation

      1. 2

        +1 this. I remember reading this before I even understood calculus, and I was blown away.

    3. 6

      Maybe something with Dijkstra’s Algorithm? It’s pretty simple, and graph-theory lends itself to pretty visualisations. Maybe even an interactive demo, where the user can set up some kind of obstacle course and watch the algorithm determine the straightest line through it.

    4. 6

      I’ve always found talking about the Traveling Salesman problem (or some other NP-hard problem) to get people’s interest. It’s such a simple sounding problem and yet, we can prove it is really difficult. At the same time, explaining that there are techniques to get pretty close to optimal in a reasonable amount of time is also nice because it resonates: we all have ways of dealing with things that generally work, but there’s always some case that messes things up.

    5. 5

      Not sure how impressed university math students would be by it, but I absolutely loved Logo as a kid. Simple enough to grasp in a fairly short period of time, but powerful enough to make what 10-year old me thought were pretty neat drawings. Given the math background I’m sure they’d be able to make way cooler things than I could.

    6. 4

      I just did something like this last week, except instead of math majors, I had ~20 high school students from grades 8 through 12 for about 2.5 hours. I used Python and basically had them work up to building a super basic spell checker. I handed them this worksheet at the beginning of class and worked through it all the way up to the spell checker. I then handed them the same worksheet with solutions at the end of class. I kept things super basic and mostly had them copying code that I wrote on the whiteboard, which was in and of itself quite a trial!

      Your target audience and time allotment are quite different, so I don’t mean to suggest that you use my approach. But I think the most important piece of advice I can give you is that 1 hour is not a lot of time, and it will fly by very quickly, especially if you’re trying to get folks who have never written code before to write code.

      In any case, by the end of the class, a good fraction of the students had figured out some of the most basic skills necessary for programming that many of us probably take for granted. Even just getting them to figure out the flow of switching back and forth between their editor and a terminal, making sure they save the file, typing the right syntax, debugging the output when it wasn’t right, and so on.

      1. 2

        Thank you for this - I look forward to trying out your worksheet on my unsuspecting relatives :)

    7. 4

      I’ve always found myself overly interested in the busy beaver function: simple formulation, but it outpaces any computable function, no matter how many factorials and exponents you throw in!

      Scott Aaronson has a great write-up: https://www.scottaaronson.com/writings/bignumbers.html

      1. 2

        I totally agree. Having a M.S. in math, the things that would interest me the most about CS would be things like the halting problem, busy beaver function, etc. For example, another Scott Aaronson link (https://www.scottaaronson.com/busybeaver.pdf) gives explicit descriptions of small Turing machines that cannot be proven to halt using ZFC (the axioms underlying most of modern mathematics), or proving they halt is equivalent in difficulty to proving Goldbach’s conjecture or the Riemann hypothesis.

    8. 3

      If they’re math students, how about some formal methods, maybe modelling some real life processes formally? (Things like TLA+ or other; I’m not an expert; see maybe the recent overview. Maybe could apply in finance?) If chosing some particular language, maybe Haskell or Idris would be more interesting and impressive to them? Oh, and OCaml seems used at Jane Street, so it could be sold as related to some finance. OTOH, if talking applications, maybe some pattern recognition? Either basic SVM/eigenvalues, or some “modern” ML/statistics? (Though I’m not sure if this fits CompSci as commonly understood.)

      1. 5

        A more lighthearted approach would be The Incredible Proof Machine. The linked article contains more links of interactive theorem provers aka “the worlds geekiest computer game”.

        Theorem provers like Isabelle are something math majors could actually use in their studies. For example, here is a proof of the transendence of π machine checked.

    9. 3

      Have you thought about showing some of the math behind (for example) support vector machines?

      I think that math majors might be more interested in the theory behind computer science rather than the actual coding (otherwise they would have been computer engineers).

      Something like SVM could leverage their knowledge of linear algebra and real analysis and show them that they can apply their knowledge to solve real world problems.

      I am unsure if presenting more specialize topics (functional programming, formal methods, or computer proofs with coq) would be beneficial given the time frame. The first workshop is for the math students to feel like they have a place in CS, maybe in later ones they can dive into more specific parts of CS.

      Finally, I am also unsure if I would introduce any CS algorithms. Math is a proof based discipline that teaches one to build up arguments from accepted assumptions. CS is more interested in how to solve problems and develops algorithm to solve these problems fast or efficiently. The “proof” is usually in correct output. Math majors might appreciate the cleverness of some algorithms, but might not be able to see themselves doing that work.

      P.S.: I have a BS in math with a minor in CS.

      1. 0

        A lot of mathematics students see machine learning and, especially if they’ve done statistics, view it as pretty basic stuff. And really, a lot of it is pretty basic linear algebra and optimisation.

    10. 3

      Prolog is a good language to start with, especially for students that already know math/logic. Showing them its constraint solving capabilities is a pretty nifty exercise. You could set up a graph of commodities with various exchange rates and ask Prolog to find an arbitrage opportunity.

    11. 2

      Teach them to program a graphing calculator.

    12. 2

      All the suggestions already posted are quite interesting for sure, I have however another suggestion that works with more than math student. Show them how easy it is to interact with the systems they use already. Open a console in the browser and change the color of “live” websites, write a little python script that automatically extends their library books, etc. Give them a bit of taste of actual power that they can relate to, and they might just come back for more on their own.

      1. 0

        That’s neither computer science related nor mathematics related.

    13. 2

      “Fly, you fools!”

      1. 3

        easy; python -c "import antigravity"

        1. 1

          Insert obligatory flying python XKCD here

    14. 1

      Use ML/AI on a bunch of math papers to generate original research.

      1. 1

        Upvoted since that should be a legitimate goal of deep learning. An easier, short-term goal would be training one to replicate proofs to spot errors. Math papers are supposedly full of errors these days. Over time, it might become somethimg math students are required to run like a spell checker.

    15. 1

      There was a lobste.rs post about using printed cards to introduce elementary school kids to the notions of programming, so depending on the focus area of the students (math is big), I might start there.

    16. 1

      A python script live plotting stock market trend lines and flashing prices and scrolling tickers.

      1. 1

        Do you have a preferred source of live stock data?

    17. 1

      In that situation I’d probably would like to something that combines the technical, theoretical and practical aspects of computer science, there are probably better topics but a short intro about computer vision (facial recognition etc) with a demo, will not only easy to remember but also combines a lot of sub-disciplines.

    18. 1

      Not specific to math majors, but I’ve wanted to do a blitzkrieg talk from gates to operating systems/programming languages for non-technical people. I’m still not sure if that is a reasonable idea or if I am in too deep.

    19. 1

      Something like Project Euler is a relatively fun starting point for people who are really into math. There are some fun algorithmic challenges that are in there that are mathematically interesting, and it has the added benefit of being something that they can start on without any coding knowledge, and build towards.

      I definitely recommend Python as that seems to have one of the lowest barriers to understanding for people.

    20. 1

      One idea is to spend about half an hour giving a quick overview of computer systems (it’s baffling how many CS students have no idea about machine code) and taxonomy of programming languages. So, the origins and thoughts behind a diverse set of big programming languages and their philosophy. Please also mention that programming microcontrollers is also a thing, and that you can make some cool stuff with this.

      Then, you can spend the last half hour on something more concrete. Since these are math students, maybe a path or raytracer would be cool. Alternatively, creating a simple .wav file is not too hard (or use a library to play sound directly). Maybe you can make a simple synthesizer playing some tune?