For Mathematics and Statistics Awareness Month, we’ve been spotlighting some of our favorite math/stats books – and the brilliant number ninjas who write them.
As we enter the final week of #MathStatMonth, our focus is on software engineer and author Angel Sola Orbaiceta, whose new book, Hardcore Programming for Mechanical Engineers, comes out in June (and is available now for pre-order). Angel earned his university degree in Industrial Engineering, but has worked in the software industry since graduating over a decade ago. He currently serves as Senior Software Engineer at Glovo, a Barcelona-based quick-commerce startup that provides on-demand delivery services via its popular mobile app. Angel is also the creator of InkStructure, a software application for architecture and engineering students that solves 2D structural problems.
In the wonderfully illuminating conversation below, we talk with him about why math is so key to engineering (and everything else), how his IE background gives him an edge in software development (and why all engineers should learn to code), how statistics keep projects on budget, what data analysts have in common with gold miners, and how getting the math wrong when you home-brew beer is – literally – the stuff of nightmares.
1) As most of our readers probably know, mathematics is the foundation for many science and engineering disciplines. Given that you majored in industrial engineering (IE) – with an intensification in mechanics – at university, would you please explain why math is so important to engineering in general?
In the words of the genius Galileo Galilei: “Mathematics is the language in which God has written the universe.” Thanks to math, we can describe physical phenomena, measure events, and make predictions. Most of the principles our engineering designs rely on are given in the form of mathematical equations. Take for instance the well-known Newton’s law of universal gravitation:
This simple and beautiful equation describes the gravitational force that any two bodies with masses “M” and “m” laying anywhere in our universe, a distance of “r” apart, exert on each other. Thanks to this piece of math, engineers have been able to do the calculations necessary to launch satellites to space. How cool is that? Fun fact: we know this formula isn’t exactly right thanks to Einstein’s general relativity ideas; nature is a bit more nuanced than that. But, when the bodies we study aren’t moving at speeds close to the speed of light, the results yielded by Newton’s formula are so incredibly accurate that engineers still use them.
Math is everywhere, behind every technological advancement we know. Even behind the best kept secrets of big companies like Google or Uber. In my current company, Glovo (we’re similar to Uber Eats, DoorDash or Deliveroo), we use math for everything! For instance, to make the optimal assignment of the customers’ orders to the available couriers, such that the time customers have to wait to get their order is minimized and the amount of money couriers make is maximized, we solve a linear optimization problem. There is a lot of math going on behind our algorithm. If we weren’t good at math, couriers would earn little money and customers would get their food cold.
It’s also important to note that Engineering syllabi usually have a very high load of mathematics, some of it a bit abstract for most students. It’s only when you start solving real engineering problems that those abstract mathematical concepts might turn into useful tools. I remember my first year in university, we had this algebra course and I was incredibly lost; I couldn’t understand anything. We learned about linear and affine transformations; I would simply complete the assignments mechanically, without pondering on what those meant. Some years later, I started working on InkStructure (an application I developed to do structural analysis, which includes a CAD-like drawing canvas) and found out that, to zoom in or out the drawing, I needed to apply affine transformations. That was an Eureka! moment for me. As I explain in my book, the first versions of the application had a weird zoom in/out behaviour, and that is because it took me some time to fully grasp the math behind affine transformations. The Youtube channel 3Brown1Blue did a much better job explaining me those concepts in a graphical manner than my university professors (thanks, Grant!).
Follow-up Q: Which math applications do you need to study (and understand) to excel in these fields? Alternatively, is engineering still a good career choice for people who are not good at math – like, could a computer simply solve all the math-related problems you’d encounter?
Math is key in engineering, one of the most powerful tools at our disposal, but you don’t need to be a math genius to become a good engineer. At least, this is how I see it. But I also think it depends on the specific engineering discipline. In the software field, for instance, math might not be strictly necessary; you can get along just with high school math. I know many good software engineers who don’t have a strong math background, yet produce some of the best designed software I’ve seen. But for civil or mechanical engineers, a strong math background is more important. A good understanding of linear algebra, calculus, differential equations and statistics is key for these engineering disciplines. Electrical engineers make extensive use of complex numbers, so complex analysis is necessary for them. And in the case of industrial engineering, linear and non-linear optimization is important as well.
In any case, we have at our disposal very good software that does most of the tedious math for us; and yet, we still need to know about how that math works, so the results of that software don’t appear like some kind of magic and we’re able to correctly interpret them. Hardcore Programming for Mechanical Engineers is precisely about writing such software: software that automates the resolution of engineering problems, which usually involve a lot of math. If we have computers which do billions of operations in a single second, why not hand them the tedious, automatable calculations?
2) You’ve noted that you taught yourself programming while at university in order to solve engineering problems. Post-graduation, you took these skills and went right into the software industry. How do you think your IE training has helped you succeed in software development? And based on your experience, do you see a need for more STEM graduates (who understand basic scientific principles) in software engineering?
What I think is key about the Industrial Engineering program I took is that, on top of the algebra, math and physics foundations, we touched on a lot of disciplines: structural analysis, mechanics, design of machines, electric circuits, electronics, energy production and distribution, microprocessors, manufacturing, statistics and many more. This rich knowledge foundation is invaluable to write software that solves a broad range of problems. Because if you think about it, software is basically a way of automating the solution to a problem through leveraging the power of computing. Knowing how to find an effective solution to a problem in the first place is also a great skill for a Software Engineer to have. Also, project management plays a big role in the study of industrial engineering, and creating software requires big doses of project management.
I think it’s for this exact same reason that we need more STEM graduates to get acquainted with Software Engineering principles, so they write the next generation of scientific and engineering software. Most of us STEM graduates learn coding at university, but writing good software goes beyond mastering “for” loops and “if” statements. When I graduated, I was naive enough to think that, since I knew how to program, I was ready to write good software. It took me some years of industry experience and sleepless nights reading software engineering books to start understanding how real software is produced. I recently
wrote a blog post about two important lessons I’ve learnt in this respect.
I would definitely encourage everyone in the STEM field to learn coding plus some software engineering principles and practices. And hey – engineering students and professionals alike, give a read to read my book, as it has some of the most important lessons I’ve learnt along the way!
3) Your book is about learning to solve engineering problems with Python – from scratch – using math concepts, like linear algebra and geometry. But there’s also a focus on writing clean code, building libraries, and automated unit testing. How do all of these disciplines (math, statistics, programming, etc.) fit together in engineering applications, and why is it important for mechanical engineering students and professionals to learn how to code?
Exactly! And let me start by saying you’ve summarized the intent of the book quite nicely. Computers have become the main and most important tool for us engineers. In the past, that might have been the abacus, a compass, or a pocket calculator. But today, a computer with specialized software installed is the most effective tool we have. Nobody in their right mind would draw the blueprints for a bridge or skyscraper by hand anymore; now we use AutoCAD, and that makes us hundreds of times more productive than the engineers from a century ago who did all this by hand. By the same token, no civil engineer works out the stresses on every structural member of a bridge by hand anymore, either – that would take months of work and can be error-prone. We have great software today that we use instead, capable of doing that type of analysis in a couple minutes and with no calculation errors.
So if computers are the modern engineers' best tool, why not learn to give it instructions directly (that is, learn programming)? In the end, someone needs to design and write those software applications engineers use, right? Who’s better than the engineer that would use it themselves? For me, this is the most important reason why I think all engineers should learn how to code, even if they don’t plan to work for the software industry directly. And if they decide they want to write software of their own, they’ll need to be acquainted with some important Software Engineering topics, such as how to architect their code, distribute it in reusable libraries, and have automated tests to know it remains bug-free as they code. I believe all of this is so important, I wanted to bundle it all in a single book that could become a good reference for engineers who want to write software. I wish someone had done this earlier so I could have learned all this when I was an engineering student. Most books on programming targeted at engineers miss the “code quality” part: they teach you about programming, but miss the software engineering part, which is every bit as important.
4) Now let’s talk about statistics. There’s an old engineering axiom that goes, “You can’t improve what you don’t measure.” Why are statistical concepts so useful in engineering?
Statistics show up in most engineering disciplines, in many different ways. There’s one example that I find very insightful, and it’s about structural analysis. Construction structures in some parts of the world (such as Japan or Taiwan) are designed to withstand strong typhoons and powerful earthquakes. But the probability of having the strongest of the typhoons and the deadliest of the earthquakes happening at the same time is quite low. In fact, we can compute – using statistical models – the most likely combination of those forces of nature, so that the probability of the building collapsing is almost negligible and the usage of construction material is minimized.
These days, one of the best paid jobs in the tech industry is a Data Analyst. These professionals have a strong statistics background and are capable of, among other things, making predictions based on studies done with large amounts of data. I find it really remarkable the fact that there’s so much valuable information hidden in large amounts of data – which, using the right statistical tools, can be brought to the surface and used to make more-educated business decisions. I see this in my current company. Our data analysts are amazing! We have regular sessions with them where they show us their findings, and it’s so incredible to see how the answer to many of our “unanswered questions” were always there, lying right in front of our eyes but hidden behind petabytes of data. It only required the right set of statistics skills to be revealed. It’s as if the answers are gold inside a mine, and statistics are the pick and shovel necessary to extract them.
Follow-up Q: What is the difference between how statistics and statistical principles are used in IE or mechanical engineering versus how they’re used in software engineering?
For industrial engineering, to name one example, statistics are key to designing effective manufacturing processes: Preventive maintenance can be put in place thanks to statistical studies that predict when a given machine might break down or fail, so it can be acted upon before that happens and without the need to halt the entire assembly line. Another example can be risk management for any given engineering project. Any risky conditions that could put the project at stake need to be accounted for, but designing a solution that’s safe in every possible scenario usually increases the cost of a project considerably. So, instead of assuming all of those conditions will be a problem 100% of the time – and to the maximum extent of their risk potential – you can run statistical experiments to determine the most likely level of risk the project should account for. These types of statistical analyses keep the project budget reasonable, while ensuring the engineering solution is as safe as necessary.
In the software field, the usages are not that different from the other cases. Software projects are like any other engineering project – they have risks to manage, and those can be analyzed using statistical models. But besides that, there is a very interesting technique we use often in software that allows us to know whether a change brings value to users or not: A/B tests. In an A/B test we show randomly chosen users a new version of the feature, (what we call “version A”). The rest of the users still see “version B,” which is how the app looks without the proposed change. We then measure if version A performs better with users than version B. If that improvement does indeed have statistical significance, we implement the change for all users. This technique has a special place in my heart because I was part of the team who built the A/B test infrastructure at Glovo.
5) One of your hobbies outside of designing software (and writing a book) is brewing your own beer. Salud! Are there any engineering skill sets, such as the use of math and statistics, that help you in endeavoring to craft the perfect pint?
This is the best question I’ve been asked in a long time! Let me start with an anecdote about how not getting the math right during the brewing process can yield “interesting” results.
Since I’m not a professional brewer, I typically follow other brewers’ beer recipes. I like to brew Imperial IPAs (aka double IPAs), which use a large amount of hops and happen to be my favorite style of beer. Some time ago, I was feeling adventurous and decided that I’d design my own recipe. I’m not sure what exactly went wrong – perhaps I calculated the proportion of hops wrong incorrectly – but that beer gave me weird nightmares every time I drank one before going to sleep (100% of the time, thus making it statistically significant). And not just any kind of nightmares, I’m talking about “how can my brain be so messed up” sort of nightmares. Most people aren’t aware of this, but hops come from a plant belonging to the Cannabinaceae family – a fact that might have something to do with the nightmares part, but who knows? I think this story of me getting the math wrong and brewing a nightmare-factory beverage exemplifies how important math can be, even for simply creating a liquid that’s pleasurable to drink.
Apart from that anecdote, the truth is there actually is math behind the art of brewing; maybe just elementary math, but math nonetheless. For instance, recipes usually refer to quantities as proportions with respect to the amount of water used, so you need to calculate the amount of each ingredient depending on your desired volume of brewed beer. And, to measure the amount of alcohol present in the final product, we rely on the density difference between the wort both before and after the fermentation process – which, when plugged into a mathematical expression, gives us the alcohol percentage by volume. But this is just me being a brewer noob. I’m sure professional brewers could give us many more examples!
You can also do statistical analyses with homebrewed beers. For instance, you could check whether there is any correlation between, say, drinking your newly brewed double IPA and having nightmares. Or, compute the likelihood of your friends being more likely to come over for a barbecue when you brew a certain style of beer… I’ll conclude by noting that I’m quite sure there are some mathematicians who have demonstrated their best theorems after a few beers. So, yes, you could say beer and math go hand-in-hand.