Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am not the best in maths, not very horrid either, but lower than the average, I've always been thinking to improve my maths, but schools and books didn't do the job because I get bored too fast. The only thing I don't get bored with is coding and gaming, so I thought what if coding a program that solves mathematical problems will help me understand maths better, most of these problems are limits (calculus), functions, Differential calculus, and some other subjects (I already said am not that good) similar to the previous noted.

My question is: Am I able to achieve a better knowledge in maths if I do some specific program coding, and if possible, is physics possible that way too? Or am I wrong and Maths should be learned before programming to help improve my coding?

P.S : C++ is the preferred language.

share|improve this question
4  
It worked the other way around for me. I learned computer programming to help me do work in graduate level statistics classes better. I found I liked programming better than stats and changed my career direction. – jfrankcarr Jan 25 '12 at 17:33

8 Answers

up vote 8 down vote accepted

You will only learn math or physics from programming if you actually use the programming to solve math and physics problems, although functional languages like Haskell have concepts in them that are very "mathy". I would suggest going to a web site like Kahn Academy or Project Euler. Solve the problems on there using code, and you'll improve both your coding skills and math skills at the same time.

share|improve this answer
2  
+1 for both resources. I do have to say, though, I hated calculus the first time through. Never did that well at it, either. Since learning Lisp, it just makes sense. Kinda fun, too. – Jason Lewis Jan 25 '12 at 23:11
1  
If you want to give Haskell a try, you can read "The Haskell road to Logic, Maths and Programming": the book teaches Haskell, to do mathematics, and introduces all the mathematical concepts along the way. However, it focuses on mathematical logic, number theory, and some elementary algebra. Calculus is only mentionned at the very end, if you managed to go through everything else. – Vincent Zoonekynd Jan 26 '12 at 1:23
I'd also suggest specialised CAS languages, like Mathematica (expensive!), Maxima or Axiom (free). Once you get the idea of term rewriting, rules and strategies, the whole of the mathematics would start to make sense. – SK-logic Jan 26 '12 at 8:57

Obviously you should learn maths through programming. If you attempt to simulate physical objects you will need to learn all sorts of physics and maths, and you will enjoy it.

share|improve this answer

Have a look at matlab. Its a lanague designed for doing mathematical functions in code.

share|improve this answer

The SICP book has a very nice section on math. But I would suggest that you try to take linear algebra, discrete mathematics, and The Calculus at a minimum, if you learn only from writing programs your education is likely to be very deep, but not very broad.

share|improve this answer

I think they go hand in hand. A solid grounding in mathematical techniques will open up options in programming you wouldn't have otherwise, meanwhile programming can open up interesting avenues of mathematical study.

I've recently started using wxMaxima, a nice graphical front-end to the excellent open source Maxima Computer Algebra System (aka a CAS, like the commercial Maple or Mathematica systems).

It won't teach you anything about maths on it's own, but it will certainly make playing around with maths more interesting and fun, that in itself could encourage you to learn more.

share|improve this answer

This is my take...

Programming Will Help Test Your KNOWLEDGE

When I was in high school and middle school, I would program my calculators to do the monotonous math for me. Some people claimed it was cheating, but I always argued that I wouldn't be able to write the programs if I didn't truly understand the math.

For instance, let's say you wanted to create a small program to compute the C value, given A and B, within the Pythagorean theorem. How do we do it? Well, we know that:

A^2 + B^2 = C^2

So to solve for C, we have:

C = SQRT(A^2 + B^2)

Therefore, the program might be something like (assuming proper headers, this is a bare bones example):

cout << "Enter value for A: " 
cin << valA;
cout << "Enter value for B: "
cin << valB;

float valC = sqrt(pow(valA, 2) + pow(valB, 2))
cout << "C = " << valC << "\n";

HOWEVER...

Where and How Do You Acquire Said Knowledge?

In the previous example, we needed to know how to solve for C within the equation A^2 + B^2 = C^2. If we didn't know to square root both sides to find C, how could we solve the problem?

IMO, it boils down to: programming will not TEACH you math absolutely, but it WILL IMPROVE the skills you acquire.

share|improve this answer
yes, I got your point and I agree with it,based on your answer, I will learn maths when I solve problems in programming, however I won't be able to solve them without knowledge thus I would have to search for solution and that is what will teach me maths... – SAFAD Jan 25 '12 at 20:16

If you're interested in working in AI, data processing, physics simulation or graphics then you need maths. Conversely, if you're not, then I reckon you don't. It's a case of use it or lose it, why learn French if you don't want to live in France? There are plenty of problem domains that just require conditional logic.

Having said that, there's a natural incline in programming towards mathematics , and it's going to do you nothing but good to gain some understanding of it.

share|improve this answer

You don't need much math for "programming".

You need math for "computer science".

If you plan to use pre-existing library solutions for everything, then you probably don't care how they work. But if you plan to make your own algorithms and data structures, you will need to know math, as CS is heavily math based.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.