Programming for Physics: Should I Know More Languages?

Click For Summary

Discussion Overview

The discussion revolves around the importance of programming languages for physics students, particularly in the context of pursuing advanced degrees. Participants explore whether it is more beneficial to know multiple programming languages or to achieve proficiency in a select few, considering the relevance of programming skills in computational physics and experimental work.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant suggests that proficiency in programming is essential, especially for computational physicists and experimentalists who need to model experiments.
  • Another participant questions the necessity of being an expert in multiple languages, proposing that problem-solving skills are more critical than language proficiency.
  • Some participants express the view that knowing one programming language can facilitate learning others, likening it to understanding different accents of the same language.
  • A participant mentions the importance of understanding object-oriented design when learning C++ and suggests focusing on C or Fortran for better productivity.
  • There is a discussion about the relevance of languages like Fortran, C, and C++ in scientific programming, with some advocating for their continued use due to their capabilities in parallel computing.
  • One participant shares their experience of converting programs from Qbasic to Matlab, emphasizing the ease of translation between languages once foundational skills are established.

Areas of Agreement / Disagreement

Participants express a mix of opinions regarding the necessity of knowing multiple programming languages versus achieving proficiency in a few. While some emphasize the importance of programming skills in general, others debate the specific languages that should be prioritized, indicating that the discussion remains unresolved.

Contextual Notes

Participants mention various programming paradigms and the potential challenges of learning different languages, highlighting the differences in syntax and application. There are also references to specific programming practices and tools like MPI, which may require additional learning and understanding.

Who May Find This Useful

This discussion may be useful for physics students considering their programming skills and language choices as they advance in their studies, as well as for researchers looking to enhance their computational capabilities.

ziad1985
Messages
244
Reaction score
0
I'm thinking of continuing my education in physics(I'm half way through my master, then getting my Ph.D).
My question should I know more programming language or be an 'expert' in a chosen few?And how important would it be?
I know average c/c++(don't study it anymore), and average Matlab(learning it right now).
Programming was never a problem to me, I like it and very good at it, my problem is practice, so pretty much I can handle anything thrown at me.
Any recommendations?
 
Physics news on Phys.org
One should certainly be somewhat proficient at programming and use of computer programs/languages. These days, there are many commerical programs, so one really only needs to understand the input/output and how to use special functions/features. On the other hand, some programs may be deficient in some models, so it is beneficial to be able to develop the model and program it oneself.

Programming (or writing code) is absolutely necessary for a computational physicist and experimentalist, if the latter wishes to be able to model an experiment.

The ability to do a simulation (numerical model) is a great skill to have.
 
So what I understand from you, that it's not that important to know a lot or be an expert as long I have certain abilities in general..
But I have a question, putting on my application to grad schools, that I'm an average programmer in what I stated above, should be enough ?
 
I don't really think its what language you know, if you have problem solving skills is what's important. You can solve a problem with pencil and paper.

if you can design a good method on implementing the program, then programming itself should be trivial, its just syntax.
 
That What I was thinking, I believe I have that skill.
Sometime ago my prof gave me a series of programs in Qbasic and asked me to transform them into Matlab, it took me more time to type them in MATLAB then it took me to read about Qbasic syntax and to understand the code itself.
Came to think of that, I feel if you know one language the rest is easy, it's just translation, like different accents of English.
 
Exactly, going from a procedural language to a concurrent language is a little different though but you won't have to worry about that as a physics major.
 
Thank you a lot
 
ziad1985 said:
I'm thinking of continuing my education in physics(I'm half way through my master, then getting my Ph.D). My question should I know more programming language or be an 'expert' in a chosen few? And how important would it be? I know average c/c++(don't study it anymore), and average Matlab (learning it right now). Programming was never a problem to me, I like it and very good at it, my problem is practice, so pretty much I can handle anything thrown at me. Any recommendations?
I personally believe it is important for any scientist to be proficient in at least one programming language. For that which any researcher wishes to write an advanced program, it would be difficult to convey to a general programmer all that is required in terms of the science and the mathematics involved. The downside is that no scientist is likely to create his or her program using good software engineering practices, making it difficult for others to work with the product.

C and Fortran are the two mainstays of the procedural or imperative paradigm, while far more work would be required in any C++ effort, it being of the object-oriented paradigm.

Depending on the complexity of the work, you may also wish to consider writing any Fortran, C or C++ program with parallel computing in mind. For example, look at Message Passing Interface (MPI) and how Fortran, C or C++ can interface with it for implementation on a multi-processor system or supercomputer. Good luck.
 
I was thinking of learning Fortran, I know it's old, but I see it's still widely used..
The reason I asked this, because I was thinking of taking some more C++ training, to be more proficient..
 
  • #10
ziad1985 said:
I was thinking of learning Fortran, I know it's old, but I see it's still widely used..
The reason I asked this, because I was thinking of taking some more C++ training, to be more proficient..
To be proficient in C++, you need to understand object-oriented design (OOD). If you seek additional training for C++, seek it in OOD.

My personal favorite object-oriented programming language is Smalltalk, but there you program and execute your program within an environment that may not be portable. Smalltalk is easy in which to program, and the programs are readable and understandable by even non-programmers. To my knowledge, however, it does not lend itself to parallelism.

Fortran, C or C++, however, is compiled into an executable that can be run on almost any computer, and is therefore more portable.

For a non-programming professional, my recommendation is to concentrate your efforts in C. You can quickly go through a book on good programming practices in C and be far more productive with less effort than you would in C++.

Fortran remains a good language, but I suggest you make a choice between C or Fortran. Many similar programming constructs are different in the two, and why confuse yourself and waste valuable time tracking down bugs when that time could be devoted to your research.

The differences between C and Fortran that can trap unwary programmers are many, too many to enumerate here. Each language has its own learning curve. Since you started with C, stay with C, until such time at least that there is a compelling need to work with Fortran or some other language.
 
  • #11
Ok I understand what you are saying.
It will be C then.(I'll try to look at (MPI) in c)
 
  • #12
ziad1985 said:
Ok I understand what you are saying. It will be C then.(I'll try to look at (MPI) in c)
There are numerous MPI manuals downloadable from the WWW. For example, http://docs.sun.com/app/docs/doc/805-1556?a=load
 
Last edited by a moderator:
  • #13
It doesn't look easy at all, but the manual seem to provide a good level of help, and I think I'll check my library and my university library if I can find anything more advanced on C and on MPI.
Thank you very much for your help.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K