Teaching myself a little computer science over the summer

<p>I’m pretty partial to C++ myself. It’s a bit more of a pain than Java/Python, but it’s much more functional for math.
It’s harder than Java/Python to get into though. Those two are pretty simple languages.</p>

<p>How is C++ more functional for math? (just curious)</p>

<p>sumzup, I believe writing a mathematical expression in C++ is easier and more akin to what you would enter into a graphing calculator, and that entering mathematical expressions into Java is obtuse.</p>

<p>While I wouldn’t use Java for math programming, I’ve heard that Python is what you’d use, with libraries like numpy and scipy</p>

<p>Python math is pretty heavily rooted in the C’s anyways, mostly simplified versions of C code.
Would be a bit easier, but I’m pretty inclined to believe that C++ would be more reliable and more useful overall.</p>

<p>There is a possibility for a C++ program works incorrectly on a different CPU platform.</p>

<p>How should I go about teaching myself c++</p>

<p>Sent from my DROIDX using CC</p>

<p><a href=“404 Page Not Found”>404 Page Not Found; - Tutorial
[The</a> Dev-C++ Resource Site](<a href=“http://www.bloodshed.net/dev/devcpp.html]The”>http://www.bloodshed.net/dev/devcpp.html) - Decent compiler
Isn’t the worst place to start.</p>

<p>For beginners, I have heard good things about
Programming - Principles and Practice Using C++ by Bjarne Stroustrup.</p>

<p>From what I’ve heard, the book doesn’t try to teach you C++. It teaches you to program through C++.</p>

<p>It is about $45 and 1200 pages, but I think having an actual book is better than going through web tutorials of dubious quality.</p>

<p>You could do with a different book if you aren’t a beginner, though.</p>

<p>Even though I’ve been programming primarily in C++ for the last 6 years (the entirety of my relatively short career so far), I agree with terenc that C++ probably isn’t the best language to start with. In fact, I think C++ is one of the worst languages for beginners because they just aren’t equipped to understand the intricacies of the language yet. But if you insist on starting with C++, I know a lot of people who recommend “C++ Primer Plus”. </p>

<p>I think it’s a much better idea to use some free, online resources to teach yourself programming. Take a look at Stanford’s channel on youtube. There, you can find lectures from their “Programming Methodology” class, and you can also find assignments and solutions on the course webpage. The class, btw, is taught in Java.</p>

<p>Out of every language I’ve worked with, C++ has been the easiest to construct a mathematical model in for whatever use I need.
If you’re interested in anything other than math though, C++ is a harder point to start at than Python or Java. Those two are very good for making apps that can be appreciated at a lower level of code mastery, unlike C++ which is most useful when you have a solid coding foundation.</p>

<p>NeoDymium, I’m curious as to what exactly you mean when you talk about constructing a “mathematical model” in C++. I worked in scientific engineering for several years and I can assure you that no scientists or mathematicians I worked with were expert C++ programmers – they all worked almost exclusively in Matlab. C/C++ is the language of real time implementations, but certainly not the language of mathematical modeling or algorithm prototyping. I agree with terenc that Python (with the help of numpy/scipy and matplotlib) is much more akin to Matlab.</p>

<p>I’m primarily a C++ programmer by trade, so I understand the value of learning C++, but I still believe that it’s not a good language for beginning programmers. How is a novice supposed to understand how polymorphism is implemented in C++ without having a solid foundation in C programming? How are they supposed to understand how compile-time generics works? How are they supposed to understand what’s wrong when the compiler complains about the order of initialization of static class members or any number of weird C++ errors?</p>

<p>If anything, pure functional programing languages (like Haskell) are the most “mathematical” of programming languages, since they deal with math-like “expressions” rather than sequences of instructions. In math, and in a functional programming language, the following lines make no sense:</p>

<p>x = 1;
x = 2;</p>

<p>… since x can’t equal both 1 and 2. Yet, in an imperative language like C++, the lines make perfect sense since you’re just assigning different values (first 1, then 2) to a certain memory address.</p>

<p>It goes without saying that a scripting language such as MATLAB is far superior to any programming language in terms of use for a specific purpose. I use it more for simple yet tedious calculations which C++ really works excellent for, in which MATLAB/anything similar would really be a bit of a waste. Keep in mind I don’t really use it for a career (I’m not a CS), so it’s never really anything too complex.</p>

<p>Matlab is written in C anyways, which is quite structurally similar to C++. It’s no surprise that you would use a derivative scripting language instead of a programming language for a specialized task. You pretty much do that with everything because excessive code is tedious as hell.</p>

<p>Indeed, C++ errors are wonderful. But at least the syntax doesn’t make me cringe like Java (writing cout makes me less annoyed than writing out System.out.println() for a simple output).</p>

<p>Matlab is implemented in C++. And they actually support classes now.</p>

<p>Performing trivial math in C++ seems stupid to me. Why use C++ when you can use Matlab or R? C++ doesn’t even have standard functions for simple things like standard deviation or L2 norm. I guess you can write those functions yourself in C++, but what’s the point? And what about if you need to do something more complicated? Are you really going to write your matrix solver?</p>

<p>The main advantage of C++ over MATLAB for what it does is the speed. I wouldn’t trust MATLAB with a few million iterations of 150 lines of source code. It would take ages.
That’s what I like using C++ for: simple yet ridiculously tedious calculations.</p>

<p>That’s why C++ is used for real-time implementations. But mathematical modeling and algorithm prototyping is not done in C++.</p>

<p>Of course, sometimes, Matlab models need to be sped up … that’s why there are MEX interfaces for Nvidia CUDA functions and things like that… but that’s another story.</p>

<p>It’s always possible to do it in Matlab effetively. The point is, in this case it’s not really worth the effort. Mostly a matter of short code vs. long code, the latter better scripted. Especially when said code uses higher level math.</p>

<p>Sorry, but I think you are just spouting opinions that have no basis in actual experience.</p>

<p>It’s very possible, since you definitely have more experience than I do. That or you’re thinking of something different than I am entirely.
No real point in continuing this discussion regardless.</p>