1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Learning math through programming?

  1. Dec 28, 2013 #1
    In short, I'm looking to switch careers but I need to learn math from the ground up. I like the idea of physics or engineering (Specifically something related to product design). Problem is, I have a really crappy math background and need to fill in that gap in knowledge, among other things, before going back to school. I dropped out of highschool in the 10th grade so I don't really know much beyond basic algebra. However I do really enjoy programming and I know java, c++, python and some web scripting languages.

    Since I really enjoy programming I'm wondering if it's possible to learn math through programming? Don't get me wrong, I know I'll still have to go through math textbooks and solve each and every problem in them but I'm just curious if you can build some foundational knowledge through programming. http://projecteuler.net/ comes to mind but it doesn't provide a solid or systematic framework for learning math nor is its goal to. "The Haskel road to Logic, Maths and Programming" looks like an intriguing textbook skirting the idea of where I'm getting at.

    I'm also curious if the problem solving skills you learn through programming/CS transfer over to math? I've read of a couple of cases where people who'd learned LISP breezed through previously difficult calculus courses.

    ETA: Let me reformulate my question. HOW can I learn math through programming? What environments, IDEs, languages can I use so as to make my ride through math as enjoyable and engaging as possible? I plan on going through algebra I&II books, basic geometry (Harlod Jacobes, Geometry Revisited), and then onto a precalculus book (Like Serge Lang's Basic Mathematics, or the Principles of Mathematics by Oakley). But maybe it would be more fun to review certain things I learned by creating their own functions, or simulating certain physics in a program.
    Last edited: Dec 28, 2013
  2. jcsd
  3. Dec 28, 2013 #2
    Yes, I certainly think this is a good idea. I'm absolutely convinced that you can learn a lot of math through programming. And I'm sure knowing programming is very beneficial to learning mathematics.

    However, I don't know any books specifically made for people in your situation. Perhaps a good idea is to take books like basic mathematics of Lang and invent your own programs. For example, one of the first exercises in the book is to prove that

    [tex](a+b) + (c+d) = a+ (b+(c+d))[/tex]

    using only the associative law. It shouldn't be too difficult to generalize this and write a program that solves the general problem. Likewise, you could build programs to solve polynomial equations and so on.

    It is well-known that you can build up a lot of math using only sets. So a thing I did once is to build a lot of mathematics using only the concept of set and some related operations. In the end, I could handle rational numbers fine, but the program was extremely slow so I never continued it. However, projects like these are very interesting to do when learning mathematics.

    A book that has very good and mathematical exercises is the following: http://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs
  4. Dec 28, 2013 #3

    Vanadium 50

    User Avatar
    Staff Emeritus
    Science Advisor
    Education Advisor
    2017 Award

    I disagree. I don't think this is really any more practical than learning European History through programming. I think this will leave you with huge gaps in your knowledge.
  5. Dec 28, 2013 #4


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    Incredibly bad idea. At least with the traditional approach to learning, you get exposed to concepts and ideas in a somewhat ordered manner, building on your previous knowledge and experience. Who knows how long it would take you to become bored with programming and drop that for some other activity?
  6. Dec 28, 2013 #5


    User Avatar
    Science Advisor
    Homework Helper

    That's a bit like saying that there are cases where people who'd studied Latin and Classical Greek breezed through a course in conversational Spanish.

    THe sort of math that R130a1 is talking about has negligible practical use for engineering or physics.

    IMO what will get from "learning math through programming" are some "pop-sci" ideas about a few areas of math like number theory, dynamical systems (e.g. chaos and fractals), graph theory, etc. Interesting though that might be, it's not the math you need for physics or engineering - at least, not until you get to grad school level physics.

    My advice: get some good high-school-level textbooks, and do the hard yards working through them. When you want to take a break from that, by all means do some computing if that floats your boat.

    As for the MIT book, draw your own conclusions from the fact that they stopped using it as a text for their course, nearly 10 years ago. In any case, the course was intended to teach the basics of computer science, not the basics of engineering math. That's not to say it's a bad book - just an irrelevant one IMO.
  7. Dec 28, 2013 #6


    User Avatar
    Gold Member

    +1 on that
  8. Dec 28, 2013 #7
    I guess the consensus is in and it ain't good. I'm still hoping though that there is an engaging way to use Matlab, or programming to at least reinforce what I've learned through textbooks. Anyways, back to my goal. I'd like to first be able to tackle a rigorous Calculus book like Courant's and then eventually a calculus based physics book like Alonso and Finn's. My academic end goal is to do some sort of mechanical engineering grad program which involves design but I'd like to see where my interest in physics takes me first (I know, I know, engineering and physics involve different skillsets).

    I'm willing to linger in precalculus stuff for a while in order to truly get a good grasp of the fundamentals. Here are the books I'll be using:

    Algebra I
    Elementary Algebra, Jacobs
    Algebra, Gelfand
    Elements of Algebra, Euler

    Geometry 2nd Ed, Jacobs
    Euclid's Works
    Geometry Revisted

    Trigonoemtry, Gelfand

    Algebra II, Geomery II & Other Precalculus Stuff
    Principles of Mathematics by Oakley (This seems like the most rigorous precalc book out there, goes over basic deductive logic and proof techniques and has a ton of exercises)
    Precalculus, Cynthia Young
    Precalculus, Sullivan

    Problem Solving
    How to Solve it, Polya
    How to Prove it, Vellman
    USSR Math Olympiads

    I'll also probably read a whole bunch of non-math or algebra/trig dependent physics intro books like "Thinking Physics" or "Basic Physics: A Self-Teaching Guide", some project based books and a whole batch of books dealing with electronics and circuits.
  9. Dec 28, 2013 #8
  10. Dec 28, 2013 #9


    User Avatar
    Education Advisor
    Gold Member

    After a few minutes I was thinking to myself... if he says maths one more time I was going to throw the computer. Spice it up a little bit, throw in “mathematics" a couple more times.

    I also disagree personally with a lot of his ideas. He sounds like he's advocating using math without properly understanding even the small bits that are required to be understood now.
  11. Dec 28, 2013 #10
    He's advocating the opposite of this. He wants a more conceptual understanding, by delegating most menial tasks to the computer. The point is that instead of doing mindless computations for hours, you can just make a program to do those things for you. I don't believe that people who succesfully program a computer to solve problems are worse off than people who solve it by hand.

    I'm certainly not against drill exercises, because they teach valuable things like pattern recognition. So they should certainly still be done. But the total lack of computers and programming in education right now (at least for me) is also not good. We need a careful balance between the two. And I do certainly think that programming can be extremely beneficial to a mathematics education.
  12. Dec 28, 2013 #11


    User Avatar
    Education Advisor
    Gold Member

    How do you make a program to do it for you without having a good understanding of the mechanics? You cant.

    Sure, CS can be really useful to a math or physics major. I’ve gone through some programming courses and it seems useful to me. He is advocating shifting mathematical pedagogy to being able to set up math problems for a computer to solve, and looking at the consequences. That isn't math, it's modeling without any understanding of how the model works.
  13. Dec 28, 2013 #12
    Exactly. So you'll need to learn the mechanics in order to solve the programming question. It seems to me that programming is way better to learn the mechanics than just following the same outline over and over again. Cause face it, most students today just memorize the steps and don't understand anything.

    Modeling and problem solving are a huge part of math. That's what programming teaches. Being able to compute tedious integrals is also part of math, but it's sad that most of the focus nowadays is on that part of mathematics. Face it, if you ever get a difficult integral (after passing calculus courses), most of us will just go to wolfram alpha and let them solve it for you. But in a calculus course, how many times do you get to use a computer? Almost never (at least with me). I notice a discrepancy there.
  14. Dec 28, 2013 #13


    User Avatar

    "We don't want students to be third-rate computers, we want them to be first-rate problem solvers." That's the essence of Conrad Wolfram's talk. You can argue all you want about how to do that, but it's incontrovertible that the way we're currently teaching K-12 isn't working at all for the large majority of students.

    His assertion that 80% of students' time is spent learning to or practicing calculating is about right. I'd argue for about 10-20%, and most of that spent doing estimation.

    But I doubt that any of this really helps the OP. On that note I have to agree with most here that using programming to learn math doesn't work very well. Where it's useful is in learning mathematical thinking: setting up a mathematical model of what you want to understand and then coding it to yield visible results is good training for doing math.
  15. Dec 28, 2013 #14


    User Avatar
    Education Advisor
    Gold Member

    Why complicate the process with also learning computer programming simultaneously, do students really need to learn about how cast objects using <complex> for complex quadratic solutions, or how to set up do loops or input validation to do such things?

    I would argue that computer programming teaches you how to program with a certain style and concepts like virtual functions, file I/O, classes, structures, pointers... Not problem solving. Computer science classes come closer, but they're still no substitute. Wolfram alpha is just a tool, you don't learn the concepts of either programming or math using it. If you already understand the math mechanics behind what you're doing, then thats fine. How would you argue learning math by punching problems into wolfram though? Who validates its logic, or who writes the next generation of wolfram code that way?

    I agree with the rebuttals at the end of the video more so.
    Last edited: Dec 28, 2013
  16. Dec 28, 2013 #15
    Sigh. As I expected, people start making a caricature of my position. I don't argue learning math by punching problems into wolfram. Computations by hand are still a very important thing and should still have an important place in education. All I'm saying is that programming is very beneficial to mathematics and should get way more attention than it gets now.

    I also don't think you should necessarily learn C++ for this. A simple language like python should be good enough. The focus is on problem solving, not programming, so things like pointers wouldn't even be talked about.

    Input validation is still important in mathematics. So many times during tutoring I noticed that people just memorized the steps, and when I ask something conceptual like "what kind of object is ##x##", they just couldn't answer. It is my (naive) hope that this would change by learning them how to solve problems and not just how to follow simple steps.

    Structures and object-oriented programming can be very helpful to teach abstraction in a concrete way.

    So please, try to understand my position first before attacking it by making it into a caricature. Thank you.

    Also, very nice reading is this: http://mysite.science.uottawa.ca/mnewman/LockhartsLament.pdf It doesn't touch on programming but it touches on a lot of things wrong with modern math education.
  17. Dec 28, 2013 #16


    User Avatar
    Education Advisor
    Gold Member

    Input validation for programming goes far beyond your example, you also need to check if a user enters a character were there should have been number and latches your program into faulted state. Or the buffer stream contains garbage, and ect.

    Im not making a caricature out of your argument, I’m basing your argument in the context of the video and what it's selling. If you’re only suggesting that students should continue to learn math without computer aides or calculators and also learn programming and modeling in high school than I agree. However, it appears to me in the context that you're advocating Conrad's position of decreasing the ability of students to preform calculations since computers do it faster. I completely disagree.

    There are some algorithms and mathematical problem solving techniques you cant do without the use of pointers/dynamic arrays/ect. The scope of what you limit yourself to by using simple python techniques is exceptionally shallow.

    So again if you're advocating learning programming and modeling in conjunction with calculations by hand in a proper math class, I agree.
  18. Dec 29, 2013 #17
    I have to admit that at one point in time in my school I did consider this idea, learning math through programming. But then I realized I need to learn whole new programming concepts together, including syntax, good practices, etc and it's just not too practical for students like me who have to face with tests and assignments every week.

    I don't know if being experienced in programmer would help, but for me, learning mathematics using pencil/pen and scratch paper is what works best and I would suggest the OP to do the same, especially on learning the basics.
  19. Dec 29, 2013 #18
    You know that's how the English say it, right?
  20. Dec 30, 2013 #19


    User Avatar
    Homework Helper
    Gold Member

    I'm in two minds about the general Wolfram issue. Maybe it is not that much an improvement if uninspired uninsightful traditional teaching by teachers with a weak grasp of trad math is replaced by uninspired uninsightful newfangled teaching by teachers with a weak grasp of computer-using problem-solving?

    With decent school teachers was trad so bad? Mine could have been better, or so I thought fresh out of Uni; looking back from a much greater distance now I tend to think they were not at all that bad either; their lessons I am often conscious of when I do a help job here.

    But for the OP there is surely room for one individual to take (or risk) an innovative path?
    Last edited: Dec 30, 2013
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook