53 Replies - 2907 Views - Last Post: 10 July 2013 - 02:24 PM

Discrete Math and Programming

Posted 07 July 2013 - 11:27 PM

I have read that Computer Science is derived from Discrete Math.I was a Math major in school and took a Discrete Math course. I was thinking about studying my textbook in more depth, because the course only covered half the book. Does this seem like a good time investment to improve my programming?

Replies To: Discrete Math and Programming

Re: Discrete Math and Programming

Posted 07 July 2013 - 11:45 PM

Reading will only take you quarter of the way in programming, it's mostly about experience. Like any language, the best way to learn is to put it to use, so if you want to boost your knowledge of a programming language, the best thing to do is make lots of small programs and a few medium sized projects.

Re: Discrete Math and Programming

Posted 08 July 2013 - 12:30 AM

Flukeshot, on 07 July 2013 - 11:45 PM, said:

Reading will only take you quarter of the way in programming, it's mostly about experience. Like any language, the best way to learn is to put it to use, so if you want to boost your knowledge of a programming language, the best thing to do is make lots of small programs and a few medium sized projects.

I'm not studying a programming language. The Discrete Math book I'm talking about is like any other math book. It has content and then practice problems to solve at the end of each section.

Re: Discrete Math and Programming

Posted 08 July 2013 - 04:30 AM

Flukeshot, on 08 July 2013 - 12:45 AM, said:

Reading will only take you quarter of the way in programming, it's mostly about experience. Like any language, the best way to learn is to put it to use, so if you want to boost your knowledge of a programming language, the best thing to do is make lots of small programs and a few medium sized projects.

Maybe I should try this. I keep going for big project after big project. Got several done but I feel like I still haven't done a lot because I've only got like 5 things to show for years of work.

Re: Discrete Math and Programming

Posted 08 July 2013 - 05:14 AM

No.

There is theory and there is practice. You can study all the theory in the world and still have no ability to practically apply it. You will learn more from trying, and failing, than from passively observing someone else's success.

USC2587, on 08 July 2013 - 02:27 AM, said:

I have read that Computer Science is derived from Discrete Math.

This sounds like something a math major might read. It may even have had some validity: 50 years ago. Today, well, math likes to claim all the sciences, doesn't it? Reality tends to be more messy.

Programming is doing. Reading it not doing. You can read all the books written buy all the best chess players and still suck at chess. The kid who never read any of those books but plays games in the park everyday will kick your ass.

Re: Discrete Math and Programming

Posted 08 July 2013 - 07:21 AM

If you'd said "programming is derived from discrete math" then a lot of the objections above would hold more water. If you say "computer science", that'a little more defensible, though probably still overstating the case. The fundamentals of modern computing do come out of math departments, computer science as a discipline was founded by math guys - particularly Knuth - and is fundamentally mathematical in nature, and much of the thinking in computer science goes back to tools of discrete math. We can see this, for example in algorithm design and analysis and compiler design.

So we can say that there are important areas of CS that take their basis straight from discrete math, true enough. Computer science is a big of a magpie discipline, though. There are areas that are more like engineering lore and wise-men-talking, such as design patterns and "how one should refactor", which I suppose are part of computer science. Some things that come up in a software engineering course come straight out of an MBA program (scheduling and management issues) and other things come out of psychology (UI design, more management tricks). I recognize elements from my linguistics training, and the list goes on and on.
And you also have areas where the discipline has developed its own intellectual infrastructure, which you'll see in arguments about type and scope - I think it would be hard to isolate one or several antecedent disciplines for discussions about lexical versus dynamic scoping, for example.

All that being said, it's still and always true that while theory can be very useful, what makes a programmer is writing lots and lots of programs. If your sink backs up, and you have a choice between two plumbers, do you want the guy who's read every volume ever written on Plumbing Theory, or the guy who's spent twenty years clearing stuck drains?

Re: Discrete Math and Programming

This sounds like something a math major might read. It may even have had some validity: 50 years ago. Today, well, math likes to claim all the sciences, doesn't it? Reality tends to be more messy.

I'm not sure that's a fair claim. Calculus was developed to deal with Physics problems. It makes sense that a class on differential equations will prepare one for physics. Certainly it's not a perfect substitute, but I found my diff eqs work to be better preparation for physics concepts than my physics classes. Mathematics also evolved to help solve economics problems. Really, the attitude in economics is if you want to do graduate level work (ie., actually be an economist for a living), go get a math degree. Sure Chemistry uses a lot of math, but I wouldn't say that math claims Chemistry.

Regarding CS, I think jon.kiparsky pretty much hit the nail on the head. The origins of CS are rooted in math, and really to a large extent EE. If one studies Theory of Computation, the circuitry crosses over with Linear Algebra, Boolean Algebras, and EE. Linguistics plays a huge role, as Jon pointed out. AI is all Graph Theory, Statistics, and Game Theory. Software Engineering is probably the only major field in CS not dominated by math at some level.

The important thing to remember about a Discrete Math textbook is that it is designed to survey Discrete Mathematics. Being well rounded is great, but you'll be missing out on a fair amount of depth. As you go along, the graph problems will really help a ton. Implement things like Dijkstra's algorithm, Prim's and Kruskal's MST algorithms, Ford-Fulkerson, etc. Write a program to bit-sieve primes, compute partitions, etc. I'm a big fan of math and theory, but make sure you use the theory to generate better solutions rather than just taking the BFI approach.

Re: Discrete Math and Programming

Not quite. Calculus was developed. It happens to be eminently applicable to physics problems and Newton offered good examples of this.

Interestingly, the other calc guy, Leibniz, defined the modern binary number system. Oddly, he did not develop it to deal with computers.

Will a deep understanding of mathematics help you understand aspects computer science? Absolutely! Is the study of mathematics the most efficient route if your goal is to improve programming skills? No.

Re: Discrete Math and Programming

Studying math as well as many other subjects can help you be a better programmer since the more you know the more you can write (literature or code) about. Steve Jobs credited liberal arts people with much of the important parts of the original Macintosh user interface design. Techies at the time for instance, couldn't even see a use for proportionally spaced fonts. Now they're almost everywhere.

Re: Discrete Math and Programming

Posted 08 July 2013 - 08:31 AM

That's interesting. I always thought that Newton developed Calculus as a tool to work on his Physics problems. Interestingly enough, a lot of the physics applications came later when the limit and definition of continuity were introduced, and Analysis became a more defined field (no pun intended).

Quote

Interestingly, the other calc guy, Leibniz, defined the modern binary number system. Oddly, he did not develop it to deal with computers.

I read about that! It reminds me of Number Theory to a certain extent, which was largely thought of as useless until the development of public-key cryptography.

Quote

Is the study of mathematics the most efficient route if your goal is to improve programming skills? No.

Re: Discrete Math and Programming

Not quite. Calculus was developed. It happens to be eminently applicable to physics problems and Newton offered good examples of this.

If you really want to get pedantic, Mac's statement is not false. Newton invented calculus to model problems in physics. Leibniz invented calculus, but not to model problems in physics. Since one of the inventions of calculus was for modeling physics, it's true that "calculus was developed to deal with physics problems".

Re: Discrete Math and Programming

Posted 08 July 2013 - 08:43 AM

CTphpnwb, on 08 July 2013 - 10:29 AM, said:

Steve Jobs credited liberal arts people with much of the important parts of the original Macintosh user interface design. Techies at the time for instance, couldn't even see a use for proportionally spaced fonts. Now they're almost everywhere.

DEK released TeX in 1978, and a complete revision appeared in 1982. The Macintosh was released in 1984.

Re: Discrete Math and Programming

Posted 08 July 2013 - 09:02 AM

jon.kiparsky, on 08 July 2013 - 11:43 AM, said:

CTphpnwb, on 08 July 2013 - 10:29 AM, said:

Steve Jobs credited liberal arts people with much of the important parts of the original Macintosh user interface design. Techies at the time for instance, couldn't even see a use for proportionally spaced fonts. Now they're almost everywhere.

DEK released TeX in 1978, and a complete revision appeared in 1982. The Macintosh was released in 1984.

I wasn't saying that proportional fonts didn't exist. I was saying they didn't exist in the computers of the day and that most (nearly all) computer people couldn't see the need for them. The point being that if all you focus on is writing code then your vision will be too narrow to be useful to you or your employer.