Programming for Physics: Should I Know More Languages?

In summary, it is important to be proficient in programming languages. If you seek additional training for C++, seek it in OOD.
  • #1
ziad1985
245
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
  • #2
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.
 
  • #3
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 ?
 
  • #4
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.
 
  • #5
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.
 
  • #6
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.
 
  • #7
Thank you a lot
 
  • #8
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.
 
  • #9
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.
 

Related to Programming for Physics: Should I Know More Languages?

1. What programming languages should I know for physics?

There are many programming languages used in physics, but the most commonly used are Python, C++, and Fortran. Other languages such as Java, MATLAB, and Mathematica may also be useful depending on the specific field of physics you are working in.

2. Do I need to know more than one language for programming in physics?

It is not necessary to know more than one language for programming in physics, but having a basic understanding of multiple languages can be beneficial. This allows you to choose the best language for a specific task or to collaborate with others who may use a different language.

3. Is it important to have a strong background in computer science for programming in physics?

While having a strong background in computer science can be helpful, it is not a requirement for programming in physics. However, having a basic understanding of programming concepts and logic is important for writing efficient and accurate code.

4. Are there any specialized languages used specifically for physics?

Yes, there are some specialized languages used specifically for physics such as ROOT and GEANT. These languages are designed for high-energy physics and particle physics simulations and data analysis.

5. How can I learn programming languages for physics?

There are many resources available for learning programming languages for physics, including online tutorials, textbooks, and courses. It is also helpful to practice coding and working on projects related to physics to improve your skills.

Similar threads

Replies
6
Views
980
  • STEM Academic Advising
Replies
16
Views
2K
  • STEM Academic Advising
Replies
3
Views
198
  • STEM Academic Advising
2
Replies
50
Views
4K
  • STEM Academic Advising
Replies
11
Views
473
  • STEM Academic Advising
Replies
10
Views
1K
  • STEM Academic Advising
2
Replies
63
Views
5K
  • STEM Academic Advising
Replies
12
Views
1K
  • STEM Academic Advising
Replies
6
Views
100
  • STEM Academic Advising
Replies
2
Views
1K
Back
Top