31 points · by dollarz · 17y ago · 48 comments
I want to learn programming, but the problem is some ppl are saying "we've to be very good in maths in order understand anything about programming and moreover, you are too young".
Is that true? I'm not that much good in maths, I know only school-level maths.
Could anyone please give me links/books to learn maths (something like learn maths for entering into programming) ? Hope you guys will understand my problem.
Sadly, HS programs in most countries do a poor job of covering topics in discrete math, despite the fact that it is not really harder than say calculus.
When I said "need", I meant that discrete math is more applicable to programming than the other type(continous type, meaning calculus et al) of math.
You can get by with minimal knowledge in some subsets of discrete math, but some areas such as knowing simple predicate logic can be quite handy.
It's kind of like the difference between learning Spanish because your high school teacher told you too verses stumbling into some of Pablo Neruda's poetry and realizing that it'd be more powerful in its native form.
Solving hard maths problems will grow the habbits needed to investigate problems when googling doesn't cut it. Infact anything that forces you to concentrate and be analytical would be good, so if you fancy studying biology then you will pick up some useful skills there.
Besides programmers tend to be better when they have interests and expertise beyond the field of computing.
You can get by with arithmetic if all you want to be is a Code Monkey / Web Developer / Java programmer. Just learn to use the tools that are given to you. But if you want to create the tools that other people use, if you want to write new code, then mathematics is going to help.
Seriously, until you know which area of computing you want to work in having the maths will offer you more options. Just remember that most of the fields of professional programming did not exist until a few years ago. When you graduate who knows what technology will be available, organic computers, optical computers, quantum computers? So learn the maths to the best of your ability and keep your options open.
That's nonsense!!! I started programming at age 8. I know people who started at age 4.
You DO need to know math if you want to develop software for avionics systems, robotics, or cryptography (among many others). If your interests are none of the above, all you need to learn how to program is time, passion, and dedication. It takes time and effort, not maths. OK, some basic concepts of logic are helpful, but not strictly required. Last but not least: read PG's essays on programming.
This is purely personal experience, but I find people who started programming early have a better "sixth sense" at getting algorithms, data structures, and design right. It's like solving crosswords, you read a description and the word/concept comes to you. Like the reverse of looking up a word in the dictionary, but with a fuzzier input! :)
I've seen late life, college usually, programmers have hour-long meetings to get to something others get in seconds.
Many, perhaps most, competitors in programming contests are 15-25. Most started programming very, very early.
So I'd say. Learn math. But maybe learn building a simple 3d game on the iPhone (maybe after Hello World though...).
You don't need any in-depth knowledge that e.g. a university math student would gradually attain. On the other hand being rather good at, for example, high school math will help you understand basic concepts such as complexity (why 1000x operations is better than x^2 operations...)
Logic and logical thinking is also valuable but it can exist without much math per se. It also helps a lot to know set theory because you can think of many things in programming as sets.
On the other hand being smarter is more important than knowing math, because if you're smart you will usually pick up enough of any basic math that you need. Also, there are lots of people who like to, for some reason or another, explain and model their ideas and algorithms mostly "in math" whereas doing it "in English" would also be possible and much more comprehensible, thus removing an artificial barrier to understanding something.
However, most important of all is practising and hacking as much as you can because that's what eventually makes you smart, with regard to programming too.
But as soon as you want to start on 2d (or 3d) graphics you'll need more math.
My tip is, learn programming first, and then use it as a vehicle to make learning math more fun. Build a simple vector graphics engine!
For programming, what you need to read about are Logic and Discrete Mathematics. And yes, they absolutely will help you be a good programmer.
If you are motivated to do some self learning, here is a link to a course offered at UMD on Discrete structures: http://www.cs.umd.edu/class/fall2006/cmsc250/note.html
Check out the "Notes" (lecture slides), homework, quizzes, exams (all of which have the solutions posted).
Also, check out the syllabus and you can find the readings in the textbook: Discrete Mathematics with Applications by Susanna Epp. (Google Shopping: http://tinyurl.com/d99nb9)
The math I have ever used in programming has been minimal/low level stuff. So yes you need to be ok at maths: but only to a basic level.
At the moment I am doing a lot of work with hash algorithms and that is fairly heavy math: but still doable with some research.
I've always said that a good ability to write english (or whatever your native language is) is more important. If you are a good writer chances are you will be a good program writer too (note: not necessairily a good programmer).
A strong writing ability will let you write solid looking, readable, fluid code (which is often one of the most important things) whilst a basic mathematical grounding and some "out of the box thinking" (focus on the latter) will give you the ideas for the code to write ;D
Your never too young.
Rest of programing skills lies in pattern recognition skill. Its like learning new natural language.
I would recommend You to learn esperanto (many good programmers known to me are pros in eo), latin some greek (my professors from univ told me so, i know little of them).
As previous speakers pointed out, logic is essential. I would say that logic is a base line of all success. Cooker like programmer use the tool - brain.
And good luck!
I would recommend to just go take a python book and start playing around with pygame... Whenever you have a problem that you don't know how to do (be it 3d or whatever), ask the question on irc (after first doing a bit of research before of course) and make sure you understand the answers given to you. You can also go and ask your math teacher when it's clearly a math problem (that's what I did when I was in High School)
By creating actual applications (start small or you will never finish) and trying to fix problems when they arise, you will learn and have more confidence in yourself.
In a few years, once you have a few games, apps under your belt, it's a great time to start learning computer science more formally and read SICP or learn algorithmics because you will have a frame of reference from your previous programing that will help you really understand the materials...
So basically the best advice is just start programing.
In terms of books/links, I'd suggest: just study your textbook. For now, try to really understand the "school maths" you are currently being taught, and do as much actual programming as you can. There will be plenty of time for more advanced mathematics in a few years.
You will never be a good programmer unless you are very, very good at certain kinds of math. You can start programming if you have a fair grasp of arithmetic and know that a symbol can stand in for a number. That is, in many countries, covered in pre-algebra.
Much of the math that generally gives people trouble is not needed in the day to day lives of most professional programmers. You can also proceed quite a ways into learning foundational programming concepts (syntax, input/output, etc) before you start hitting things that will be impossible to understand without more rigorous math or formal logic.
To answer your question more precisely, I'll ask you a question: do you code in any high level language (Python, Ruby, Perl, PHP)? If so, chances are you're using 'associative arrays', 'dictionaries' or 'hashes'. How do they work under the cover? What is special and unique about them (A: hash tables and hashing functions).
Now, can you use the concept that's used by the hash-table primitives in your language, to sort an array of size N in a time proportion to N? What are you giving up to gain that speed advantage, how can you offset that by giving up slight speed advantage?
Now if someone is studying the same mathematical topics without having already programmed they won't have the same appreciation and attentiveness. To them "hash function" don't immediately click with programming techniques right away. Essentially my advice is start coding anyway, so the relevant topics in maths will "just click".
This is also a very different kind of math: it's largely discrete and even the continuous portions of it are elegant. This isn't sitting for hours and doing symbol manipulation or number crunching. You don't need to know what continuous and discrete mean: just pick up a discrete mathematics textbook and see how far you can work through it.
Attempt calculus, if only thing, just because the first elegant example SICP provides deals with a tiny function to compute a derivative of another function at a point.
http://funcall.blogspot.com/2009/03/not-lisp-again.html
If you decide to pursue computer science in college (which isn't strictly required if you want to program), this book may be of help:
http://en.wikipedia.org/wiki/Concrete_Mathematics
Addendum: for certain applications of programming you do need certain mathematical knowledge that goes beyond abstract concepts and notation; but even with those topics, don't let "not being good at math" deter you from trying.
So, no, you don't have to be very good at math. It can help, and is needed in certain fields, but I don't think it's needed to be a math whiz. If anything, it can help your math.
Along the way you will learn lots of useful math, but that isn't the point -- other than the math you encounter in your CS classes, there is no specific mathematical knowledge required for programming. However, you need to do a lot of proofs and understand the power of mathematics, and you need to have the mathematical background to tackle whatever your specific interests turn out to be. (For instance, if you become interested in data mining, you will need to have enough mathematical maturity to study statistics by yourself, starting with any requisite calculus and linear algebra you happen to lack.)
Some people will correctly point out that you don't have to know jack about mathematics to be a good programmer. While this is true of many programmers, you sound like an especially smart kid, and you will not reach your potential without studying high-level math.
You are fourteen years old. You probably haven't had much good math instruction yet. One of my favorite authors on school mathematics wrote, "The proper thing for a parent to say is, 'I did badly at mathematics, but I had a very bad teacher. I wish I had had a good one.'" W. W. Sawyer, Vision in Elementary Mathematics (1964), page 5. You can find a good teacher by finding good books about mathematics, even if you have never had a good teacher. Many working programmers haven't either, which is why some of them don't see the need for much math background to become a good programmer.
You are young enough to learn a lot of math and to learn a lot of programming. Learning both hand-in-hand will make you a better programmer. One good book that combines both subjects is Approaching Precalculus Mathematics Discretely by Philip G. Lewis
http://www.amazon.com/Approaching-Precalculus-Mathematics-Di...
http://mitpress.mit.edu/catalog/item/default.asp?tid=9168...
which alas appears to be out of print, but may be available as a used book or from a library. It teaches key concepts of school mathematics while also teaching functional programming with the Logo dialect of Lisp.
A great place to hang out online to learn math and programming is the Art of Problem Solving Forum, especially its subforum on computer science,
http://www.artofproblemsolving.com/Forum/index.php?f=331
which is moderated by a brilliant young man I know who is not a lot older than you are.
There are the very odd time when I suddenly realize I need something from my school maths education (which was before 1978), and then I have to search out that stuff (e.g. geometry and trigonometry) and finally find a use for it.
I know I would be a better programmer if I understood maths better, but then I believe almost everyone would be improved by a better understanding of maths. I'm sure that studying programming will actually make some areas of maths more relevant for you.
It all depends on the kind of programming you want to do - in some areas I guess not being a mathalete might be a great hindrance.
I'm pretty sure it will be frowned upon to mention any particular language here, but Hypertalk really doesn't feel much like programming. Maybe it's because my speech patterns have actually started to resemble Hypertalk. Hypertalk lives on in http://www.runrev.com/ . (I have no connection with them other than as a user of their software.)
I wish I was in your place. I'd take every opportunity to learn maths, but I wouldn't let my maths ability/disability get in the way of my enjoyment of programming. It's a fantastic buzz, and I never grow tired of it (well, sometimes I do get a little frustrated).
I'm not sure how many people have listed any books for you, but this is the maths book I used when I followed a 1 year course in computing: http://www.amazon.com/Schaums-Outline-Discrete-Mathematics-O...
Long answer: I started programming when I was 13. I used to barely pass my maths exams. In 11th grade, we got to some basic Combinatorics, Complex Numbers, Coordinate Geometry and Advanced Algebra. Strangely enough, I got better at maths because I found these topics were relevant to programming and CompSci.
In grade 12 we got to Calculus. I couldn't figure out how it was relevant to what I was doing in my free time, and I limped along once more.
Don't worry. After you start programming, you'll come to like maths, if not love it. I have Discrete Maths in my next semester at college (the course is actually called Fundamentals of Computer Science) and I can't wait for this semester to end. I had calculus last semester, and I think I might fail (the results are not out yet).
There are certain things you won't be good at, though. Like math. It will be hard to use programming to do math if you don't understand what you're trying to do. So certain things will be hard.
The trick is, the longer you program, the better you'll be able to "intuit" math. By learning programming, you develop the skills to become good at math, as long as you try hard at programming. If you want to become a 9-5 Java programmer, you probably will never have any chance at improving your math skills.
Programming isn't that hard. Not at all. I started learning younger than you.
I'm an interactive designer, and certainly not a good mathematician (not to mention truly awful at mental arithmetic), but the maths I use mostly - trigonometry, vectors, matrices, some basic calculus - I mostly picked up while I was working on things.
There are things I wish I knew a bit more about no doubt, but considering I left school at 16 with a C in maths, I think I've managed pretty well so far!
I'm currently trying to learn a new-to-me language (clojure) and I'm finding working my way through project euler (http://projecteuler.net/) to be very helpful. It might also help you with math ;)
You'll have to learn math /eventually/, but you don't need it yet. You can afford to focus on pure programming, and wait five years on the math.
And it's never too young to learn programming. I know some people would consider 14 years old a late start.
While I fully agree with the above, and I am a good programmer, good at proving theorems, I am terrible at algebra, I can barely do my taxes.
And maybe start with a language like Python. In my opinion its simple and lacks syntactic cruft.
That said, there are more important things to programming than math. The very first of these is practice, as with anything.
[1]http://www.amazon.com/Introduction-Mathematical-Reasoning-Pe...
Mathematics will give you a language to reason about your problems, and once you have the foundations you can start using algorithmic cookbook-type solutions you find in texts for your own problems. A good grounding in Analysis, Logic, and some basic formal methods (you can ask me to explain what these are) will make you a better communicator with yourself.
Along with mathematics you should probably venture more into systems programming. There are programmers who make software for other people, and there are programmers who make software for other programmers. At the risk of sounding snobby, you can probably guess who is having more fun :-) Master your environment. Whatever computer and Operating System you use, tinker with it to no end and figure out everything about it. Systems programmers make Operating systems and compilers, linkers and loaders, debuggers and disassemblers, packet sniffers, and hardware drivers and programming languages.
Don't forget to have fun. Most people you see here are doing software for the money/independence. Nothing wrong with that. But you don't have any bills to worry about, so you can afford to actually become a HACKER (in its cool "dark shades and gelled hair" badass sense) you can start to make stuff your friends at school will go crazy over.
In addition to maths and systems programming you will also need a COMMUNITY. A bunch of hackers who you can chat with online and show your stuff to. There will be experienced members and there will be beginners, however, your community should foster free participation and mutual respect (don't go to forums where people use sexist and racist language and don't hangout with people who call you "n00b" or some such derogatory terms. Bullies are the least capable hackers, usually.)
Challenge yourself. Read books even if you can understand only the first chapter. That's usually a good sign that you will be able to understand the second chapter, if you read the first carefully and did the appropriate research. Browse wikipedia. Lookup difficult English words; not everything has to be technology related, I learned the ABCs of English at the same time I learned programming.
You will become good at what you love, so if you love hacker culture, you will become a better hacker.
Plan your weekends to have fun. Grab an assembly language text and sit by your computer to type in the examples. You might need to get an older computer and install MS DOS to read most of the cheap books; Windows assembly programming is not fun or easy, but Linux's IS (http://asm.sourceforge.net/) Nowadays, Windows is becoming a more difficult hacking platform, all the cool accessible systems programming level stuff are being done on Unix.
Discover Unix. It's a beautiful thing. It's OK to be a hacking snob, if you talk to your friends about what you can do on Unix and brag about it, you will set a standard for what's cool. You will be the trend-setter that your friends copy and if enough of them are interested in hacking you will all compete for brag rights and all will become better for it in the long term. Make something and show it to your friends, either at school or online. That will motivate you more than anything.
I know this is too long, but I had to say it. When I was your age and slightly younger, I was a child-militiaman. I carried a rifle and sat up all night for guard shift. I dug a well with my own hands. I collected wood all day and burned it in a whole to make charcoal for cooking. None of that matters now though, by the time I was 18 I was a Unix hacker; that changed my entire youth, I don't even remember being in a war-zone as a child anymore, all I remember is making my PC speaker scream with a buggy assembly language routine and waking up the whole family at 4AM :-)
1+2+...+n = n(n+1)/2
The proof has two parts, first is it true for small values of n, and second does truth for a large value follow from truth for all small values.
Well, 1+2+3 = 6 and 3x(3+1)/2 = 6, so small n is looking good.
What about general n? Can we get the formula for n from the formula for earlier n, perhaps n-1?
Suppose we already knew 1+2+...+(n-1) = (n-1)((n-1)+1)/2 = n(n-1)/2.
Adding n to n(n-1)/2 does indeed produce n(n+1)/2 so gives us the second part and completes the proof.
The standard example in programming is writing a fast sorting routine. Given data x1,x2,...,xn pick one item, perhaps x1, as the pivot and work through the data accumulating two lists, big and little, of data larger than and smaller than the pivot. Join the sorted versions of big and little with the pivot in between.
The algorithm works because it works for small n as special cases and works for larger n by breaking the big case into smaller subcases.
A list with only one item is inherently sorted and a list with exactly two items is easily sorted by swapping them if needed.
A list with n items gets broken into a pivot and two lists big and little. Both lists are less than n long. Even in the lopsided case that one is empty the other is only n-1 long because we have taken out the pivot. So the sorting routine is going to work because it works for smaller cases, by just the same logic that underlies mathematical induction.
School mathematics has a misleading focus on computation. University mathematics is focused on proof.
In programming we tend to keep the proofs in our heads and not write them down. The reason for this is that computers need a great deal of handholding and babysitting. A computer program is mostly made of details that spell things out for the computer in detail. These details are typically mathematically shallow. Provided we have not made any small slips with the details the program will work and obviously so.
On the other hand, interesting programs have tricky bits that are not mathematically shallow. How do you write those? You need to think like a mathematician writing a proof. You need to find bases cases and inductive steps.
Mathematics and programming are different but mutually illuminating. There is a very close connection between a mathematic proof and the explanation of why a tricky computer program works. Learning how to create mathematical proofs will help you with writing tricky programs and vice-versa.
The most important example is calculus. Many mathematics students struggle with calculus. It is a useful exercise (perhaps for 16 to 18 year olds) to write your own computer programs for numerical differentiation and for symbolic differentiation and to get the two to agree as closely as rounding error permits. Much that is obscure about calculus then becomes clear.
The overlap of mathematics and programming is very clear in formalisms such as ACL2 http://www.cs.utexas.edu/users/moore/acl2/ which use a computer programming language as a logic in which mathematical theorems are stated and proven. The ACL2 book is excellent, but alas, it assumes a university level grasp of meta-mathematics. I fear that the book the poster seeks has yet to be written. Perhaps some-one on HN will take up the challenge?