+ 2

Is discrete math useful for programming?

14th Mar 2018, 7:24 PM
Yusuf
Yusuf - avatar
4 Answers
+ 7
The last part of this Quora answer says it well: [Quora.com Share URL] http://qr.ae/TU11vp ------------------------ "*Why is it important for computer science?* In the world of computers, all the information is stored in bits, units of information that can take the value of either 0 or 1. It’s not like in nature, where something can take all the values in between 0 and 1 as well. Instead, everything is binary. Since the bits are the building blocks of everything that happens in computer software, everything becomes discrete. For instance, the hard drive on the laptop I’m using right now can store 1 845 074 329 600 bits of information. Not 1 845 074 329 599.99, but exactly that number. You can’t have half a bit. The study of algorithms is also firmly in the discrete world. An algorithm is a step-by-step list of instructions to the computer and it’s what makes computer programs possible. When determining how much time an algorithm needs to run, you count the number of operations it needs to perform. Notice the word count. Again, discrete mathematics. Discrete mathematics is the very foundation of computer science. Don’t believe anyone who tells you differently."
16th Mar 2018, 8:49 PM
David Carroll
David Carroll - avatar
+ 6
@Yusef... Absolutely! Programming is much more akin to discrete math than any other math, like differential or integral calculus or anything dealing with all real numbers. Fundamentally, discrete math studies the concepts of counting, mathematical structures, logic, recursion, computational modeling, graph theory, and algorithms to name a few. Proofs, a core concept in discrete math (well, all math for that matter) involve deductive reasoning, simplifying, identifying patterns, mathematical notation, working within constraints and conditions. That is not to say a formal course in discrete math is required or needed to be an excellent programmer. However, many of the concepts reviewed in discrete math are applied directly with many concepts in programming. Examples of Discrete Math in Practice: - Pure Functions: discrete and consistent outcomes based on discrete inputs. - Defining Relationships: Cardinality between entities (objects / tables / etc) such as one-to-one, one-to-many, many-to-many are core in application and database design. - Refining code with optimized looping constructs and conditional blocks based on simplified, yet effective logic. Real World Applications: - Crytography - Compression Algorithms - Google search for page ranking algorithms. - Social network connections and degrees of separation. - GPS calculating positions based on distances between relative objects. - Algorithms used in chess for assessing optimal moves based on evaluating outcomes to the nth degree. - Vector graphics and 3D modeling. - Compilers (parsing unique identifier) - Mapping algorithms (path-finding)
16th Mar 2018, 8:47 PM
David Carroll
David Carroll - avatar
+ 1
No, I still haven’t yet figure out how proving an integer is a rational number help me in coding. Does modus tollens help you understand why your complier is complaining about null pointers?
14th Mar 2018, 10:17 PM
Code Monkey