Looking for more podcasts? Tune in to the Salesforce Developer podcast to hear short and insightful stories for developers, from developers.
100. Math for Programmers
Hosted by Hailey Walls, with guest Paul Orland.
Programmers are often expected to not only know complicated math equations, but to cherish them dearly; in reality, nothing could be further from the truth. Although mathematics forms the basis for a lot of software, most people are still put off by it. Paul Orland, a mathematician turned programmer, found this so perplexing that he wrote a book breaking down math concepts for programmers. He'll share his reasons for doing so, as well as why he believes maths is essential to every job.
Hailey Walls is a Customer Solutions Architect with Heroku, and she's engaged in a conversation with Paul Orland, the founder of Tachyus and author of Math for Programmers. Paul took graduate level math classes, and even ended up with a Master's degree in Physics, but even he admits that he comes down with his own kind of math anxiety. Now, he works as a programmer, building predictive models, but he encounters many engineers who don't have a basic understanding of fundamental math concepts, like calculus or linear algebra. Seeking to rectify this, he wrote a book called Math for Programmers, which methodically explains mathematical concepts using real-world examples. He hopes to be able to teach math to many more people.
Paul emphasizes that, although thinking of mathematics can be intimidating, it's not different than working on any other skill. If you decide to go weight lifting, you start with a 10 pound weight, then a 15 pound one, and on and on. Similarly, with math, if you train on problems that are simpler, future problems will build upon the techniques you've honed. The appeal for gaining math skills is almost analogous to that of programming: there is always a right and final answer. Just as a compiler determines how a program works and whether a syntax is valid, taking in input and producing output, so too is math deterministic. Fundamentally, better mental acuity with math can help teach you how to consider the behaviors of complicated systems.
For people interested in studying math more closely, Paul advises students to not be discouraged by problems which appear hard. It can be best to pick a problem that you are naturally interested in, which will lead to a general willingness to try and solve it. Similarly, he'll also take a math concept and turn it into a program, which has helped him reason about flow and patterns much more clearly in the past.
Links from this episode
Hailey: My name is Hailey Walls. I am a Customer Solutions Architect with Heroku, and I'm here today with Paul Orland, the founder of Tachyus and the author of Math for Programmers. And we're going to talk about math. Do you want to tell us a little bit more about yourself and your book and maybe what brought you to write that?
Paul: I've always been a math nerd my whole life. I remember when I was five-years-old or something and we would go out to breakfast every weekend and on the restaurant napkin, my dad would always give me a math problem to work on while we waited for our food. So yeah, ever since I was little. Around that time, I was also interested in what's the biggest number you can count to. I learned about things like a google and a googolplex. So ever since I was little, it fascinated me. And I since then tried to learn more about math and turned into something that I studied in college. I majored in math and then went on to work in software and mathematical parts of software and then start my own company.
Paul: And basically, what we've done at my company is we've used math and physics and machine learning to build predictive models in the energy industry. We can predict what oil fields will do in the future. What kinds of fluid will come out of the ground and how much volume and flow rate will come out. And there's a lot of math behind that too. So I guess then my career as a software engineer, an entrepreneur, working on mathematical problems in software, I found this interesting problem, which is that there's a lot of really smart technical software engineers out there, but some of them don't know calculus or linear algebra or the basic things that you need to know to plug into some types of modern software teams. And I decided to, after spending time training my team, I decided to try and package what I had taught them and shared with them and put it in a book that would be available to a lot more people and hopefully teach math to a lot more people.
Hailey: That's awesome. I think that one of the things I really like and appreciate about your book is I came around to math in the way that you're describing your audience, where I didn't do much of it growing up and I certainly didn't do any in college. But found myself looking at problems later on that that was a useful skill to have and an interesting topic and grew into being an amateur math enthusiast, which is how I live these days and find lots of excuses to use it in my job and use it in my work. And yeah, I just get really excited about the kinds of problems like you're working on with your company, the predictive models you can use or different optimizations you can make. I think it's all super fascinating.
Hailey: I think one of the other things you do a good job of pointing out in the book is that it can grow beyond that problem solving into its own joy. And you can learn to just appreciate it for what it is and get a richer understanding of math beyond just whatever problem you might be solving. Although you have a lot of good examples of neat problems you can work on to introduce yourself to those topics and give yourself something practical to work through.
Paul: Well, this is something I've thought about a lot. Why do I like math? Or what's interesting to me because that's, I mean that's a big question in education. If you want to teach something to someone, first you should try and motivate it and tell them why they want to learn it. I do that a little bit in chapter one of my book. But at some point, when I was in school, math was a fun competition. And it was, there's this problem, and you're competing against yourself and you're competing against your classmates. There's a right answer. There's maybe it's a proof that gets you to the answer and it's a test of your mettle to get it done.
Paul: And then I think a little bit beyond that when I didn't care so much about contests or exams or grades, started thinking about math as this abstract game that we play and it puts you in touch with, in some sense, arguably what are the deep quantitative secrets of the universe? These platonic ideas that somehow exist that people discovered and don't invent. I think a lot of mathematicians would say that math is discovered not invented. So that's been interesting to me.
Paul: And then since then, I've really made an effort since I've been a software developer and then out of school, I've made an effort to deliberately practice math and get better at it by doing problems. And then I found that there's a whole other way to enjoy math, which is thinking about it, it's almost an intellectual version of bodybuilding where you have this, you have challenges and they seem difficult or impossible. So the first time that some people go to the gym and they try and pick up a 10 pound weight and then do a couple of reps and they get sore, and then you look at someone who's next door who's bench pressing 300 pounds. And you'd think, "How could this person possibly do it?"
Paul: But you do the 10 pounds a couple of times, and you do the 15 pounds, then you build up and eventually you can do the 300 pounds. And math is a very similar, intellectual version of that, where you train on problems and you can really feel yourself gaining mental skills or developing a mental tool belt. And I found that that's really satisfying as well. So this is all to say that I think there's a lot of ways that you can love math or get into it. And I hope everybody who picks up my book finds at least one of those ways to latch on to.
Hailey: So we have some examples of programming topics that relate to math, starting with some of the more abstract examples that you start with in the book with vectors and graphics.
Paul: Yeah, definitely. Well, I think it's been really interesting to me in my programming career to try and take what I learned. I guess I can say a little bit more about how I got into software. I was a math major in college and I decided that my freshman or sophomore year. And my parents parents said to me, they expressed a little bit of concern. "Why are you going into math?" What kind of, I think my dad said, "What kind of J-O-B are you going to get with a math degree?" And I think the answer is with a math degree, you can do anything, but there's only one job called mathematician, but then there's all sorts of different jobs that use math to some extent.
Paul: And I ended up stumbling into software at the end of my undergrad career because it's like you're flexing the same intellectual muscles as when you do math, when you're writing a program. You have to think, I mean you're essentially writing a proof when you write a program. You have to prove the existence of this thing that you want to work, and you have to work in a formal language that's your programming language. It's unforgiving the same way that mathematical proofs are. It's either correct or it's not.
Paul: Something else I've gotten into is there are ways to get closer to the original, the first thing that I was talking about, where you think about programming as a mathematical exercise, and it's not just philosophically they're similar, you can actually reason about programs using mathematical methods. So you can think of a a program as taking some data in, doing some computation, and putting some data out. And if it's deterministic, meaning it gives you the same outputs for every time you pass in the same input, then really what you have is a mathematical function. And that's one of the simplest mathematical building blocks you can work with.
Paul: So in functional programming, you take that view to the extreme. And you say everything that I have it's all functions sending inputs to outputs deterministically, and you compose them together by sending the outputs of one function to the inputs of the next function. And then you get basically every tool from set theory and function theory, and then there's another branch of math called category theory, which looks at all the various generalizations of that. So I've had a lot of fun learning about that, and there've been valuable ways to apply that to design and architecture, not just numerical computations.
Hailey: For me, the way that I ended up connecting the math and the programming was a little bit different in that I had been doing programming to get myself through college for biology. So I had the programming skills for the practical reasons, but had all these interests in these different modeling problems. So population modeling or genetics, these different categories there, and realized at some point that all of the things we were being told to do in Excel for class, or with these other sorts of tools, I could figure out how to do it easier and better in Python. And so started teaching myself some of those mathematical concepts in Python and figuring out how to use that to accomplish my goals for these different kinds of problems.
Paul: Yeah. I would love to see more math learners exposed to that stuff because my experience was when I was in first grade out, I remember this calculator that I got. It was a talking calculator. So it had all the numbers, it had plus, minus, times, divide, equals, maybe it had a memory button, but that was about it. It would say anything you typed back to you. So that was my first calculator. And my favorite thing to do with that was I typed in two times two, and then I just hit equals, and every time you hit equals it would multiply by two, and then eventually I could get it to say, "Error, error, error, error, over and over again." So that was my first calculator of any kind that I got. And then I gradually, as you go through school, you get calculators with more buttons on them.
Paul: And in middle school, I got a scientific calculator and was mystified by what's the sine button, cosine, exponential. I didn't know what any of those things meant, but it was intriguing that there were these new buttons. And then I got to high school and I got a calculator that had probably, I don't know, 50 buttons on it. And it was a graphing calculator and you could make graphs on it and you could do multiple step equations on it. And each of the 50 buttons actually had two or three different modes. So there might as well have been 100 or 150 buttons on there. And then you could actually write some computer programs on it as well. So it was like, you keep getting these calculators that are extensions, that let you do more and more, and you need to know more and more to use them, but they give you an extra tool to help your thinking.
Paul: And I graduated high school and started working on a pure math major in college and never used a calculator again after that. So it was interesting to me how you use technology up to a point in math, and then it falls by the wayside. And I think the next calculator I really used was a high-level programming language. And I've used Python, I've used... My favorite programming language is F# that I use that at my company. These are really the most powerful kinds of calculators you can have because they come with libraries. And if there's not the library that does what you want already, you can download a new library or write your own library. So they're like calculators and you can add buttons to them.
Paul: And I talk about this a little bit in chapter one of my book, but I really feel strongly about this, that everybody should be using extensible calculators. Calculators that don't have a fixed number of buttons essentially. If people learned Python in elementary school or middle school, then they could take Python with them their whole life. And it doesn't actually have to be Python. I think another underrated programming environment is Excel. And Excel is a calculator that a ton of professionals use probably more than any physical desktop calculator. There are a ton of jobs that use Excel and have Excel as a prerequisite. And I would say, why not incorporate Excel or spreadsheets more generally in math education?
Hailey: I like your point about getting people in front of these more extensible calculators, the programmatic kind earlier, because it also has this benefit of giving you a lot of feedback. And especially if you're using something like Notebooks or some of these other tools that can make the inputs and outputs more visible and more interactive for you. I personally find that super helpful.
Paul: And Notebooks, I should mention, a year or a year and a half ago or something, I stumbled across Jupyter Notebooks. My wife is actually an astronomer and she does a lot of data analysis with space telescopes, the Hubble space telescope is one that probably most people know about. And she, for almost all of her scientific work, uses Jupyter Notebooks. And I saw her using them and I thought, wow, this isn't just a great work environment, this is also a good teaching tool because you can put something really reproducible here and it shows you every single step.
Paul: And it's not like a program where if you opened up, I don't know, if you opened up the source code for say Microsoft Windows or something, and you looked at the first line of the first file. It wouldn't really tell you how Windows works. It's not organized in that way. Most code is not organized in a sequential order, but in a Jupyter Notebook, it really shows you not just the code that works, but a thought process. So I love that about Notebooks and I continue to try and use them more and use them to share ideas more.
Hailey: So one thing that I can certainly relate to, and I think a lot of people struggle with, is the sense that maybe they're not good at math or that math is going to be too hard. It's not a thing that they do. That was certainly a thing that I had to get past a little bit in myself. And so if you were able to give some advice to anybody who's listening to this and thinking that they want to tackle a math problem and start to apply these things creatively themselves, but are still hung up on that kind of math anxiety, what advice would you have for them?
Paul: I'll start by saying, I was a star math student in high school. I accelerated and took college classes while I was in high school. Then I went to a top university for math and got the intensive math degree and took graduate level classes. Since then, I've gotten a Master's degree in physics. And since then, I've still taken a couple of classes on the side. The last class I took was, I guess it must be... I took algebra one in high school, I took algebra two in high school. I took probably two years of algebra in college. And I have now taken a year going on maybe two years of algebra in grad school. And I had math anxiety. I feel like I get problems that I don't know how to do and I've wondered if I'm cut out for it.
Paul: And if I look back, if I sat in high school and I think I'm in ninth grade math, and I guess, what would this be? This would be like 18th or 19th grade level math. I would never be cut out for that. I could never do it. So sometimes I have to catch myself even now having gotten this far with my own math anxiety. This is a problem. I don't know how to prove it.
Paul: I think the advice I would give to people is that know that whoever seems like they're a million levels beyond you or 10 grade levels beyond you, or however you want to think about it, they have their own problems that are hard for them. And they've put in some work and they've gotten to a certain level of comfort with things. And some things are easy to them, but some things are also hard. And it's not about you, it's about whatever you are willing to put in and how many problems you're willing to work through. And I don't think there's anyone who's more cut out or less cut out for math. I think it's just you do care about the problems and you work through them.
Hailey: Do you have other recommendations for people who are looking to get started in math? Your book's a great place to start, I think, but any other areas that you could recommend for diving into math skills, different tools or resources for people?
Paul: Well, I would say definitely check out my book. I guess I'm on this podcast to some extent to promote my book. So please buy my book. If you like it, buy three more copies for all of your friends or something like that. I think for a particular type of math learner, diving into Math for Programmers is a great thing. If you know Python, then this is a great hands-on way to not just read a stale book, but you can actually, every single page almost has some code that you can type in and you can actually see it working. You don't have to just believe that the statement is true. So yeah, my book I think is great for that.
Paul: For me, particularly learning by doing is the most important way to learn something. So I don't really have the attention span to read a math book. Even describing how far I've made it in math. I can't for some reason I can't pay attention to a math lecture that's more than 20 minutes long. I'll zone out or get lost. Same thing with reading. I can read five or 10 pages in a sitting, but then I have to take a break, especially if I have a really dense math book. So what works for me is picking a problem that I'm really interested in and letting it either I work it out on paper for a long time, or I let it incubate and I end up solving or cracking problems that I thought were impossible after I just let them percolate like that. Another thing I like to do is, and this is probably obvious from my book, but I like to take something that's a math concept that I know, or I'm just learning and turn it into some code.
Paul: So if I can compute something, write a program to compute something, I really know I've mastered it. There's no way to argue with a working computer program. Versus if you read something, you may say, "Oh, did I get this? Did I not get it?" Making it work in a program or working in a calculation or solving an exercise correctly, these are all ways to really have a hands-on experience and also convince yourself that you know what you're doing.
Paul: Having said that I learn best by doing, not everybody learns best by doing. I see people in graduate level math classes and I see people who sit next to me and just digest the whole lecture and seem like they get it in one go, and you may be one of those people. And that's totally fine. Just, I would say, be thoughtful about what works for you and don't get too stressed out if you see someone else who's able to learn in a different way that doesn't work for you because that's not the goal. The goal is not to learn in some specific way or at some specific speed, it's to really master and then enjoy the material and be able to apply it.
Hailey: I really liked the point about seeing other people, maybe being able to take in the whole lecture while you yourself get about five or 10 pages through, and then you need to relax and let that percolate through your mind. This is definitely how my experience tends to play out. And I think it's easy to, if you're not already in that math mindset, then that's the thing that you're practicing. It's the thing that you're studying. It can be easy to look at other people and think that they're all just sitting there figuring out the entire lecture all at once and think that you're not living up to that standard because your learning style is a little bit different.
Paul: Coming back to the sports metaphors because I'm not a real sports fan or anything, but I think about what I've done some type of exercise, maybe I've been swimming a lot. And then someone takes me on a hike and I've been swimming an hour a day, but someone takes me on a hike up a mountain, and I get winded after the first mile. And I'm like, I'm doing cardio every single day, but this slightly different move or exercise or physical activity is still difficult. And I think it's the same for math or programming or any intellectual discipline. You really focus on one type of problem or a couple types of problems. Then if you see one that's outside your wheelhouse, it may be difficult and it may be discouraging, but you can't let it get to you just because for someone else who's been hiking up mountains, going for a swim might be very difficult. So never judge yourself compared to others and always remember that you're in the same kind of process, but on a different path as everyone else.
Hailey: That was fantastic. Thanks for that, Paul. Your book is available on the Manning website and I think we have a code for 40% off for that book. So from the Manning website, you can look for Math for Programmers and use the code podish19 and get a discount on Paul's book and get started learning some math and having some fun with it.
Paul: I don't know if my contact info is available, but if you've made it to this point in the podcast, you can feel free to email me. My email is my last name, Orland, P-M as in Paul, Matthew at gmail.com. So I'm happy to talk math with almost anyone who's curious enough to start the conversation. So drop me a line and tell me what you're interested in.
Hailey: Thanks so much, Paul. I really appreciate you coming on the podcast. It was great talking to you.
Paul: Thanks for having me.
A podcast brought to you by the developer advocate team at Heroku, exploring code, technology, tools, tips, and the life of the developer.
More episodes from Code[ish]
Jim Jagielski and Alyssa Arvin
Jim Jagielski is the newest member of Salesforce’s Open Source Program Office, but he’s no newbie to open source. In this episode, he talks with Alyssa Arvin, Senior Program Manager for Open Source about his early explorations into open... →
Lisa Marshall and Greg Nokes
This episode of Codeish includes Greg Nokes, distinguished technical architect with Salesforce Heroku, and Lisa Marshall, Senior Vice President of TMP Innovation & Learning at Salesforce. Lisa manages a team within technology and product... →
Innocent Bindura and Greg Nokes
How do you know an application is performing well beyond the absence of crash reports? Innocent Bindura, a senior developer at Raygun, shares the company's tools and utilities, discusses the importance of monitoring P99 latency, and talks... →