Knowing my math

This is a discussion on Knowing my math within the C Programming forums, part of the General Programming Boards category; I'm kind of ashamed to admit it but I never really had any school, and because of that I never ...

  1. #1
    Registered User Wokzombie's Avatar
    Join Date
    Feb 2010
    Location
    Netherlands
    Posts
    14

    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.
    Last edited by Wokzombie; 03-03-2010 at 05:51 PM.

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    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.
    Last edited by MK27; 03-03-2010 at 06:21 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094

    Thumbs up

    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!
    Last edited by claudiu; 03-03-2010 at 07:04 PM.

  4. #4
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    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. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by bernt View Post
    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.

    Quote Originally Posted by claudiu View Post
    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.
    Last edited by MK27; 03-03-2010 at 07:37 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  6. #6
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by MK27 View Post
    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. #7
    Registered User Wokzombie's Avatar
    Join Date
    Feb 2010
    Location
    Netherlands
    Posts
    14
    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.


    Quote Originally Posted by MK27 View Post
    ...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.

    Quote Originally Posted by MK27 View Post
    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. #8
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    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?).
    Last edited by MK27; 03-03-2010 at 09:52 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  9. #9
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by bernt View Post
    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.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  10. #10
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    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. #11
    Registered User
    Join Date
    Jun 2005
    Posts
    6,618
    Quote Originally Posted by MK27 View Post
    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.

    Quote Originally Posted by cpjust View Post
    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.
    Last edited by grumpy; 03-04-2010 at 12:50 AM.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Sunshine, and read this, this, and this before posting again.

  12. #12
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    Quote Originally Posted by Wokzombie View Post
    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.
    Last edited by nadroj; 03-04-2010 at 01:04 AM.

  13. #13
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    Quote Originally Posted by grumpy View Post
    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. #14
    Registered User
    Join Date
    Dec 2009
    Location
    Colorado
    Posts
    41
    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. #15
    Registered User Wokzombie's Avatar
    Join Date
    Feb 2010
    Location
    Netherlands
    Posts
    14
    Quote Originally Posted by MK27 View Post
    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.


    Quote Originally Posted by waterborne View Post
    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.
    Last edited by Wokzombie; 03-04-2010 at 07:41 PM.

Page 1 of 3 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Doing aweful in math, but decent in CS?
    By psychopath in forum General Discussions
    Replies: 2
    Last Post: 11-04-2009, 09:49 AM
  2. Help with C++ Math
    By aonic in forum C++ Programming
    Replies: 4
    Last Post: 01-29-2005, 04:40 AM
  3. Basic Math Problem. Undefined Math Functions
    By gsoft in forum C Programming
    Replies: 1
    Last Post: 12-28-2004, 03:14 AM
  4. Math Header?
    By Rune Hunter in forum C++ Programming
    Replies: 26
    Last Post: 09-17-2004, 07:39 AM
  5. toughest math course
    By axon in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 10-28-2003, 10:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21