Why About Math? - Torang Siregar (International Journal of Applied Research and Sustainable Sciences, 2023)
Some practitioners and educators might claim that mathematics is used simply as a filter–weeding out those students too weak or unprepared to survive – or even just to pare down the hordes of potential computer science majors to a more manageable size. Others might argue it is just another sign that faculty in their ivory towers have no clue what practitioners really do or need. Each of these views surely has its adherents, but we argue here that learning the right kind of mathematics is essential to the understanding and practice of computer science. What is the right kind of mathematics for preparing students for real-world responsibilities? For the central topics in computer science, discrete mathematics is the core need. For applications of computer science, the appropriate mathematics is whatever is needed to model the application domain. Software (and hardware) solutions to most problems (such as banking, on-line commerce, and airline reservations) involve constructing a (mathematical) model of the real (physical) domain and implementing it. Mathematics can be helpful in all stages of development, including design, specification, coding, and verification of the security and correctness of the final implementation. In many cases, particular topics in mathematics are not as important as having a high level of mathematical sophistication. Just as athletes cross-train by running and lifting weights, computer science students improve their ability to abstract away from details and be more creative in their approaches to problems through exposure to challenging mathematics and mathematically-oriented computer science courses. Discrete mathematics includes the following six topics considered core in the ACM / IEEE CS report, Computing Curricula 2001. Let’s start our exploration of the need for discrete mathematics with a simple problem. Vectors are supported in standard libraries of C++ and Java. From a programmer’s point of view, a vector looks very much like an extensible array. That is, while a vector is created with a given initial size, if something is added at an index beyond its extent, the vector automatically grows to be large enough to hold a value at that index. A vector can be implemented in many ways – for example as a linked list, but the most common implementation uses an array to hold the values. With this implementation, if an element is inserted beyond its extent, the data structure creates a new array that is large enough to include that index, copies the elements from the old array to the new array, and then adds the new element at the proper index. This vector implementation is pretty straightforward, but how much should the array be extended each time it runs out of space? To keep things simple, suppose the array is being filled in increasing order, so each time it runs out of space, it only actually needs to be extended by one cell. There are two strategies for increasing the size of the array: always increase its size by the same fixed amount, F , and always increase its size by a fixed percentage, P %. A simple analysis using discrete mathematics (really just arithmetic and geometric series) shows that in a situation in which there are many additions, the average cost for each addition with the first strategy is O(n), where n is the number of additions (that is, the total of n additions costs a constant multiplied by n2); the average cost for each addition with the second strategy is a constant (or, in other words, the total of n additions costs a constant multiplied by n). This is a simple, yet very important, example analyzing two different implementations of a very common data structure, the vector. However, we wouldn’t know how to compare the quite signifi- cant differences in costs without being able to perform a mathematical analysis of the algorithms involved in the implementations. Here we aim to sketch out some other places where mathematics, or the kind of thinking fostered by the study of mathematics, is valuable in computing. Some of the applications involve computa- tions, but more of them rely on the notion of formal specification and mathematical reasoning.