Once day, I talked to my Prof. about Computational Physics and he showed me his work. I'm quite surprised that why Prof. use C++ for computation because C++ quite complicated. I heard he talked about memory talk about pointer. Why didn't he use Python or Java that more easier? no need to manage memory no need to busy with pointer.


closed as off-topic by Kostya, Dilaton, user10851, Emilio Pisanty, David Z Aug 11 '13 at 16:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be about engineering, which is the application of scientific knowledge to construct a solution to solve a specific problem. As such, it is off topic for this site, which deals with the science, whether theoretical or experimental, of how the natural world works. For more information, see this meta post." – Kostya, Dilaton
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ The reason is probably historical. $\endgroup$ – Bernhard Aug 11 '13 at 10:38
  • 2
    $\begingroup$ Related: scicomp.stackexchange.com/questions/304/c-vs-fortran-for-hpc $\endgroup$ – Bernhard Aug 11 '13 at 10:39
  • 1
    $\begingroup$ This is not a question about Physics. Programming is engineering, which is off-topic here. $\endgroup$ – Deer Hunter Aug 11 '13 at 10:44
  • 3
    $\begingroup$ This question appears to be off-topic because it is about programming languages, not physics concepts. $\endgroup$ – user10851 Aug 11 '13 at 12:31
  • $\begingroup$ In my experience, people mostly use Fortran, Matlab and Python for this. C++ is not really that popular (maybe there has been a slight increase recently, if you count CUDA as C++). $\endgroup$ – fjarri Aug 11 '13 at 12:32

I can't really know why your professor used C++, but there are several reasons why you would:

  • Performance: Scientific computations might require top-notch performance. C++ allows for very low level control over the hardware and has many possibilities for micro-optimization while still providing high-level abstraction. Of course, this is also the reason that C++ is quite complicated.
  • Historical reasons: C++ has been the de facto general programming language for quite a while. Your prof's code might need to be compatible with other projects. Plus, I think there are more libraries for C/C++ than for any other language, your professor might have to make use of such a library. It is also possible that C++ is the standard language for this kind of thing in your professor's university or field, simply because it used to be the best choice.
  • Maybe your professor only knows C++...
  • $\begingroup$ @Dimensio1n0: latter=second or last, in english? $\endgroup$ – kalkanistovinko Sep 8 '14 at 20:03
  • $\begingroup$ @kalkanistovinko Latter is often used in reference to the second of two things, i.e. "this" or "that", where "that" is the latter. It also can mean: "situated or occurring nearer to the end of something than to the beginning". Here it seems to be referring to "Maybe your professor only knows C++...". $\endgroup$ – UserNotDefined Jun 27 '16 at 23:44
  • $\begingroup$ Re "maybe your professor only knows..." - I know a very accomplished academic that insists on using IDL. He has a ton of libraries in IDL, and sees no reason to change it up to Matlab, Python, or any other language. It is a tool that works for him. Don't underestimate the power of "existing libraries". $\endgroup$ – Floris Jul 29 '16 at 2:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.