# Thread: Knowing my math

1. ## Knowing my math

I'm kind of ashamed to admit it but I never really had any school, and because of that I never learned any math.
And I'm talking about none, zero, zip, dd if=/dev/null of=/proc/math_skills.

I know enough about simple calculations and tables to get me by with a calculator in the IT world so far, but it's just not enough for C.

I could, of course, just google "Learn basic math" but that's a bit too random, I wouldn't know if it where any good until I start failing when I try to apply it, or if later chapters would make any sense because the writer starts slow and then takes off like a rocket, that's why I'm here now.

Does anyone know of a good book or website he or she can recommend me, something that that can take me from zero to knowing enough to functionally learn C?

[PS.] I know this is not a question about C directly but it does apply to programming C / C++, especially since programming is the reason I am asking this.

2. Contrary to popular opinion there is almost no math involved in most programming (other than the obvious mild "algebra"). What specifically are you having a problem with?

Not that that I'm trying to discourage you. There's a free trig book (pdf) around by guy named Micheal Corral, I noticed googling he also has a free vector calculus book:

mecmath

These seem to get updated and corrected like a few times a year, which is cool. Lots of exercises.

I usually just pound away at wikipedia when I don't understand something.

But IMHO unless there's something specific you need, don't get bogged down and distracted with this. Maybe you are using the wrong programming resources if that is the case. Programming is much more about logic and you do not learn logic from math. Algorithms can be described abstractly using equations but that is just a convenience for people who already understand the notation.

3. Wokzombie, there's no reason to be ashamed! In fact, heck, I wish I worked with more people as eager as you are to learn. It's never too late to learn buddy so put all the shame or whatever it is you feel behind you and start working/studying. In my experience, at least, people that are so passionate about moving forward are actually the ones that get far.

Now, if I may recommend a site that helps it's Math.com - World of Math Online. They have exercises for every part of math you should focus on to improve your math skills : algebra, geometry and calculus.

However, I disagree slightly with MK27. While Programming may certainly not be about math, all the theory of computation that lies behind programming languages is certainly a very solid and easily identifiable part of math. Programming languages are nothing but a method of expressing algorithms, which in essence, belong more to the field of math than of software development.

There are different degrees to which you can develop your skills, but overall it's up to you to determine how much you want to learn. The good news is that there is really no real limit to that, and no school or diploma can really limit what you can know! So good luck buddy! I'm cheering for you!

4. Programming is much more about logic and you do not learn logic from math.
Well, actually you do... logic is part of discrete mathematics, and discrete math is really where programming fits in. Set theory, number theory, combinatorics, graph theory... I can remember at least one point in which I used each of those.

The problem is that I didn't realize I was using math, it's just that I just had spent enough time getting into the mindset of procedural programming that I could hack away and get a result very similar to the "correct" math way.

As far as other maths go, you're going to want basic trig (you got to know your sines and cosines) as well as some statistics and probability, but all that's really necessary is to know what's out there, not necessarily how it works.

i.e., you ought to know that (cos x) and (sin x) correspond to points on a circle, but you don't necessarily need to know that sin 45 = sqrt(2)/2 or that the taylor series for sin x is ((-1)^n)/(2n+1)!
...even if you were going to write your own sin function, you wouldn't use taylor series... but I digress

As for linear algebra, calculus, and geometry? Well, you're honestly not going to need that unless you're into 3D graphics... and even then, there are numerous libraries to get you by with next to no knowledge.

Computers are discrete machines, so discrete math is by far the easiest to work with as well as the most important (in my opinion) branch of mathematics for programming. Wikipedia - Discrete Mathematics

5. Originally Posted by bernt
Well, actually you do... logic is part of discrete mathematics, and discrete math is really where programming fits in. Set theory, number theory, combinatorics, graph theory... I can remember at least one point in which I used each of those.

The problem is that I didn't realize I was using math, it's just that I just had spent enough time getting into the mindset of procedural programming that I could hack away and get a result very similar to the "correct" math way.
Right, my point is: math is an application of logic and not vice versa. The people who invented mathematical notation were applying logic. Math is an expression of logical principles. I guess to be fair some of it may rub off in the process, but you may just as well study science or philosophy or programming or anything which trusts reason as it's foundation.

Originally Posted by claudiu
However, I disagree slightly with MK27. While Programming may certainly not be about math, all the theory of computation that lies behind programming languages is certainly a very solid and easily identifiable part of math.
A fascinating topic but like I said, not required knowledge for most programming.

Programming languages are nothing but a method of expressing algorithms, which in essence, belong more to the field of math than of software development.
There are plenty of algorithms that actually cannot be expressed mathematically, at least not in a reasonable way -- and plenty more that are best expressed in a human* (or programming) language. Again, contrary to popular opinion, "algorithm" IS NOT simply a mathematical concept, although the term may be most commonly used by mathematicians, hence the etymology.

I'm just saying this because Wokzombie may have fallen into the trap of believing that "algorithm == math". Most non-mathematicians would use the word "method". Eg, carpenters have methods, they are "algorithmic" and maybe could be described mathematically, but that does not make it useful or necessary. Math does have a very very broad range of applicability for description, so mathematicians who are also curious people will use it to describe a very very broad range of things. Which if you ain't a curious person you probably would never have taken an interest in math .

If you are interested in it, then go, but it should not be holding you back much from learning C. No doubt, it will help you in many circumstances!

* Like, with words. Pretty sure there are some that CANNOT be expressed using math notation but I won't claim that as irrefutable truth.

6. Originally Posted by MK27
If you are interested in it, then go, but it should not be holding you back much from learning C. No doubt, it will help you in many circumstances!
I think this phrase best sums it up!

7. Thanks for the pick-me-up, claudiu, I needed that =)
I'll take a better look at the link tomorrow since it's pretty late over here, but it looks like what I was looking for.

Originally Posted by MK27
...Wokzombie may have fallen into the trap of believing that "algorithm == math". Most non-mathematicians would use the word "method". Eg, carpenters have methods, they are "algorithmic" and maybe could be described mathematically, but that does not make it useful or necessary.
You are correct, I do not know the terminology. Whatever the right term for it is, my understanding of it is about the same as an 8 year old child.
Although I'm pretty sure I'm not talking about algorithms, I am also dutch so there's a language barrier as well.

Originally Posted by MK27
If you are interested in it, then go, but it should not be holding you back much from learning C. No doubt, it will help you in many circumstances!
In this case you are correct again.
The information I have on C just got to floating-point numbers, where the book gave me a value, the same value with an exponent and how it could/would be written in C.

For example the number 0.0000000000000005 is 0.5 to the power of -15 (correct?) which can be written in C as 0.5E-15. I know a very tiny bit about how calculations like these are made, not even the logic. And until I understand the why and how I will always write numbers like that as 0.0000000000000005 instead of 0.5E-15.

8. Okay. That is indeed math-ish. But you can figure it out -- you just did. Most of the math-ish things involved in programming are like that. You do not have to quit programming to study math first. I think you are "psychologically intimidated".

BUT: perhaps studying some math will help you overcome that. Maybe you will like it.

If not, don't worry. Let me give you an analogy (do they have "analogy" in math?): the only thing you have to know for this one is, "I like music".

Music, even more than programming, can be very easily described in mathematical terms. If you can play a stringed instrument, it is very easy to understand how this is so. However, it is also easy to see how the people who invented, developed, and mastered the stringed instrument did not need formal math to do it, because everything about music which can be described and analyzed with math is intuitively obvious.* "Intuitively obvious" may seem like an abstraction, blah blah blah -- let me get to my point.

The only TWO things I have heard described as "universal language" are music, and math. In fact, there are probably more, but I will spare you the philosophy.

To complete the analogy: make a list of your favourite musicians and consider, how much time did they spend studying math? Programming is A SKILL. Practice it.

* intuitive here might be like "empirical", a very important reality in learning music (where is the sound?) and learning programming (what happened?).

9. Originally Posted by bernt
As far as other maths go, you're going to want basic trig (you got to know your sines and cosines) as well as some statistics and probability, but all that's really necessary is to know what's out there, not necessarily how it works.

i.e., you ought to know that (cos x) and (sin x) correspond to points on a circle, but you don't necessarily need to know that sin 45 = sqrt(2)/2 or that the taylor series for sin x is ((-1)^n)/(2n+1)!
...even if you were going to write your own sin function, you wouldn't use taylor series... but I digress
Can you give me an example where you've needed to use basic trigonometry while programming (other than doing graphics programming)?
I've been a developer for over 7 years and programming since I was in high school and I've never run into a situation where I've needed to use trigonometry.

10. I am writing a microcontroller (embedded) program to reproduce some instrument sounds using trig functions, including some harmonics at different amplitudes. That would at least require basic function transformation stuff (change frequency and amplitude), and to generate the actual spectrum would require Fourier transform.

Math may not be "required" for basic programming, but many fields of programming sure require more than basic math. Graphics, audio, optimizations, statistics, physical and biological simulations, AI, etc.

11. Originally Posted by MK27
Programming is much more about logic and you do not learn logic from math.
That's not true. Mathematics is formally a language used to represent logic, and perform logical operations.

It's just that a lot of the logic of computer programs can be expressed without mathematical formalism. However, mathematics can be used to characterise anything that software can do.

Originally Posted by cpjust
Can you give me an example where you've needed to use basic trigonometry while programming (other than doing graphics programming)?
I've been a developer for over 7 years and programming since I was in high school and I've never run into a situation where I've needed to use trigonometry.
Just because you've never seen it does not mean it doesn't happen.

Try writing programs that realistically simulate real physical phenomena, and you will use plenty of mathematics.

12. Originally Posted by Wokzombie
For example the number 0.0000000000000005 is 0.5 to the power of -15 (correct?) which can be written in C as 0.5E-15.
The latter part is right, but not the former. 0.5^(-15), or "0.5 to the power of -15" is not the number you've shown (0.000...0005). This long number you've shown is 0.5 x 10^(-15). This is what "scientific notation" is, its basically multiplying some number (in this case 0.5) by a power of 10 (in this case to the power -15). The "0.5E-15" is a way of representing "scientific notation". So "0.5E-15" is a way of writing "0.5 x 10^(-15)".

As for your concerns: once you get into it, math is actually an incredible and very powerful tool. However, and this is in accordance with what others are saying, "programming" doesn't require much math. All of the math I have studied I don't, and I know I probably won't in the near future, apply when "programming". What I have got out of studying math for practical purposes is a way to think more critically and abstractly.

13. Originally Posted by grumpy
However, mathematics can be used to characterise anything that software can do.
Excellent point. The modern concept of computers was based on highly theoretical mathematical research. Thanks to Alan Turing, the "Godfather of (Theoretical) Computer Science", are we able to even be having this conversation (I mean via computers).

14. Since you have no math background or experience I would strongly recommend getting a tutor or taking some classes at a community college. My experience as a mathematician is that non-math people generally have a hard time teaching themselves math or reading math books. If you are serious about this, invest some time and money in it - you will be glad you did.

15. Originally Posted by MK27
I think you are "psychologically intimidated".
Absolutely, I don't know exactly why but math has always scared me.
On more than one occasion I have tried to learn basic math and failed because at the start it all seems logical and I can follow it, then suddenly the writer/teacher speeds up and it's like they are talking ancient hebrew and tell me how logical it all is.

Originally Posted by waterborne
Since you have no math background or experience I would strongly recommend getting a tutor or taking some classes at a community college. My experience as a mathematician is that non-math people generally have a hard time teaching themselves math or reading math books. If you are serious about this, invest some time and money in it - you will be glad you did.
I have thought about this before, but I think you make a good point. The issue is that I was planning on saving up for a course in C.

Popular pages Recent additions