For physics purposes, is it necessary to learn fortron or C++ if one knows mathematica well enough?
Mathematica will be much more useful for physics for everything except large purely number-crunching calculations where it is a little slow.
"For physics purposes" I'm not sure you even need anything other than mathematica (matlab, scilab, etc.). But if you are intent on learning another language, make it C/C++, Java, or C# (in that order of recommendation). those are just way better languages and are used much more often than is Fortran, even in science. C# is a good language but I'm mad at Microsoft for repeatedly redefining the wheel for the sole purpose of locking in customers to Microsoft-only systems (although C# and mono (.NET on Linux) sure gave Microsoft the double-whammy).
Fortran is used extensively in physics. It is partially due to legacy codes handed down. However, Fortran has an excellent set of libs and the speed of high volume number crunching is much better than C/C++.
If you are going into physics, learn a proper programming language. Mathematica is very nice for smaller projects, but it is not that pervasive and if you are working on a small subset of a project, it is likely that it will not be done in Mathematica. It really doesn't matter which language you learn, just learn it well and you can apply all that you learned to whatever new language is required. All that usually changes is syntax.
patently false. almost everything is still in fortran.
don't make that an or and exclusive or. learn fortran, c++, and mathematica
A search of a reputable job site (indeed.com) for the terms "C++" and "PhD" return 21 times as many hits as a search for the terms "fortran" and "PhD". Likewise a search for "java" and "PhD" even returns ten times as many. I searched several other sites in the same way, including science-only job sites, and got the same results. If it were only a few times more, one might argue that there was some skewing of the search counts because of how science jobs are typically advertised. But a 21-fold difference makes the statement "almost everything is still in fortran" less feasible.
What do you mean by "for physics purposes?" If you're an undergraduate and you're talking about coursework, Mathematica is all you need. If you're doing research at the graduate level (or even the undergrad level in many cases), you need to know a programming language. Heck, C++ programming consumes upwards of 90% of my day most days of the week. Typically, you'll learn a language as part of an undergrad physics curriculum. Otherwise, when you get into graduate research somebody will teach it to you. Personally I don't think you need to worry about taking extra programming classes, learning on the side, or anything else. After all, if you can solve the Schrodinger equation with periodic boundary conditions (or insert other fancy physics problem here), you can probably learn a language in a couple of weeks whenever it becomes necessary. Just my opinion.
You are making a lot of assumptions about the quality of search engines used on those sites. Most of them return boolean OR for the searches. So all you are really saying is there are more jobs in JAVA than in Fortran advertised there. In addition, searching indeed or monster is not where most physicists find their jobs. Try the AIP/APS career services pages.
I am speaking from experience as a physics researcher. Fortran is still used extensively. C++ is also used a lot. Learning C++ or Fortran as an undergrad is not going to stop you from using the other later. Fortran is still used for most hardcore number crunching jobs since it is superior to C/C++ in speed. Learning JAVA is not going to be as useful in a research environment currently as it is not a widely used language in physics (in my experience). But as I said before, just learn a programming language. Once you understand one well, learning another language is fairly simple. I studied C++ as an undergrad extensively and now work almost exclusively with Fortran.
Most of the top 50 physics departments in the US have a Mathematica site license, but if you ever leave physics to go into astronomy or engineering they will often use matlab instead. FORTRAN and mathematica serve different purposes, however, so you may eventually learn them both, but wait until some employer asks you to use FORTRAN before learning it.
At the risk of going off topic, I am a third year student physics and mathematics, and all I ever used is Mathematica. I would like to learn the basics of C++. Could anyone tell me a good book/set of lecture notes/website?
Why is advice in this forum always backwards. Fortran is still present but is in the process of being phased out at least in particle physics - Geant4 is C++, Pythia is going C++(With the release of PYTHIA 8.100, this new C++ version series takes over from the older Fortran 77-based PYTHIA 6.4). Fortran would have been an excellent idea 10 years ago.
That's been my impression too, that Fortran is still pretty common due to a lot of stuff having been written in it 10/20/30 years ago, but recently more and more new programs are written in more modern languages like C++. Maybe it depends somewhat on which branch of physics you're working in.
Python with NumPy/SciPy is also a good choice for small to medium-scale jobs, since it's easy to program, but it can't match the number-crunching speed of Fortran, C, or C++. Although, for people who want to learn programming for the first time, Python is a great language to start with.
My money is on C++. I learned Fortran way back when (Fortran II on a 1620) and it was my first language, but except for legacy code (MCNP, CINDER and the like) everything these days is in C/C++. Don't even bother with Pascal.
While you're at it, get a good grounding in automata theory and microprocessor design. Not everything that has to be done can be done without getting right down onto the silicon, and I have seen some very weird architectures.
If you want steady employment learn how to handle real-time systems then get involved with software verification and validation of high-reliability software. I'm in the nuclear industry and there is a real call for this sort of thing in reactor safety systems.
This website: http://www.learncpp.com/ is a really good introduction to C++. I used it to learn C++, though I had the advantage of already being familiar with object-oriented programming. It will probably be more difficult if you aren't familiar with objects.
I would wholeheartedly recommend learning to program using C++ and OOP.
Even if it executes a little slower than equivalent Fortran code, I believe it would ultimately be for the best to leave Fortran in the past.
We use a lot of legacy code in Fortran, and we develop our proprietary simulations in Fortran. Those who discount it, do so from lack of experience.
We also have a proprietary computational engine which solves very large problems. It's written in C++, but it uses modules written in Fortran and C++. From our developers, "There are large bodies of the ******* libraries (e.g., math library, element library, etc.) written in Fortran and ******* has made it easy to call Fortran from the C++ classes. These libraries also provide a Fortran binding so that they can be called directly from other Fortran subroutines. There is a huge body of well-used Fortran legacy applications that simply cannot be set aside and re-written in C++. In fact, it is difficult to achieve the performance levels in C++ that can be achieved in Fortran since the Fortran language is inherently designed for computations with multi-dimensional arrays."
Another thing. If you're planning to go into any sort of high energy or nuclear physics, it might be a good idea to learn ROOT rather than regular C++. ROOT is basically C++ but with a bunch of classes for working with large volumes of data, like histogramming routines and stuff. It's based entirely on C, so I imagine it wouldn't be too different from learning C++. Here's their website:
One really important difference between C++ and most all the other languages discussed here: C++ is a low-level language. By that I mean its really easy to accidentally misuse variable space such that your program runs fine for a long time until it suddenly crashes and burns because of certain peculiar circumstances. The majority of bugs in C++ would have been avoided by simply using a high-level language like Java. Those high-level languages automatically make sure you can't access (or try to access) RAM locations that you obviously didn't want to access, and they also make sure you free RAM locations that you are done using, among other things. BOY does that make programs less buggy. I was an avid C++ developer for decades (still am, really) and do think its a cool language, but when I finally picked up Java I found myself letting out a huge sigh of relief after using it for a while. I hadn't realized how painful and tedious it was constantly having to keep track of misused pointers and other things a programmer shouldn't have to worry about.
As per my prev post i strongly recommend Java over C++. But if C++ it is, then I strongly recommend learning C before C++. There was a C compiler put out decades ago called "Power C" which came with a thick white paperback book. That book still blows away everything else I've read. If you can find one on ebay that would be cool. If not, C is a very simple language and can be learned in a short time with internet tutorials. Then only after you are comfortable with C should you tackle C++.
are you intentionally obstinate just you can post advice? no one in physics uses java and no one cares about the finer points c++ therefore requiring knowledge c. do you even know what kind of programming is done by physicists/scientists? you're giving advice as if the OP was someone looking to start programming.
how about c++ physics phd?
how about physics c++ library?
click packages and look how many are fortran packages and how many are c++ packages.
While it's true that knowing Fortran in order to work with legacy code might still be a desirable trait, I think there should be a strong move away from Fortran towards more modern languages, especially in the scientific community. As I said, I have a variety of good reasons that I won't get into unless questioned, but...
Good for the OP, wanting to learn a programming language. So many people just ignore it, opting for the math packages and scripting environments.
Separate names with a comma.