Which programming language is best for Scientists/Modeling Physical World

Click For Summary

Discussion Overview

The discussion revolves around the best programming languages for scientists and those modeling the physical world, with a focus on their utility in various scientific fields such as physics, chemistry, and engineering. Participants explore different languages, their applications, and the relevance of each in academic and research settings.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • Some participants suggest that Python is becoming the most common language for scientific computation, particularly due to its packages like SciPy, while others note that FORTRAN remains in use, especially in legacy systems.
  • There is a recommendation for C or C++ as foundational languages, with some arguing that learning these can facilitate the acquisition of other languages.
  • Participants mention MATLAB as a useful tool for engineers, particularly for less computationally intensive applications.
  • Some express that FORTRAN is still dominant in numerical applications and computational fluids, while others argue it is becoming obsolete compared to newer languages.
  • LabVIEW is highlighted by one participant as beneficial for simulation and instrumentation, emphasizing its user support and library availability.
  • There is a discussion about the relevance of BASIC, with mixed opinions on its current usage in scientific contexts.
  • One participant emphasizes the importance of understanding procedural programming, suggesting that C is a good starting point for scientific programming.

Areas of Agreement / Disagreement

Participants express a variety of opinions on the best programming language, with no clear consensus. Some advocate for Python, while others prefer C, C++, or MATLAB. The discussion reflects differing views on the relevance of FORTRAN and BASIC, indicating a lack of agreement on a single best choice.

Contextual Notes

Participants reference specific courses and programming requirements at their institutions, indicating that educational context may influence language choice. There are also mentions of the historical significance of certain languages, which may affect current perceptions of their utility.

Who May Find This Useful

This discussion may be useful for students and professionals in scientific fields looking to choose a programming language for their studies or research, as well as educators considering curriculum design in computer science for science majors.

ryanj123
Messages
24
Reaction score
0
Hello There,

I'm a senior at the University of Illinois Chicago, studying mathematics and chemistry; I'm at the point where I need to become familiar with a computer programming language that will not only be useful down the road but help with the admission process into graduate school.

Which language is most commonly used among scientists (physicists, astronomers, chemists, mathematicians etc.), or does everyone use a variation?

Could someone recommend a base language then whatever else I could add in addition so I'm learning the most "cutting edge" or demanded language within the scientific community.

This question seems rather hard to get a direct answer to, so I would appreciate anyone that would come forward and put all judgements aside and give me solid advice; since I seem to be given little consideration not knowing much about this... <sigh>...
 
Technology news on Phys.org
It depends which direction you want to go. Programming is kind of difficult (I am personally horrible at it), but to get the general idea would be good. C, C+ (I've heard is much like C but with much more libraries among other small differences), or javascript (this is used a lot on the net- games, and webpages are many times coded in javascript) could do the job if you study it extensively. Some schools (students of engineering/mathematics) require students to take a programming class. Usually they are C or javascript (business majors sometimes take visual basic). If you decide to go the engineering route, most engineers-scientists use matlab. But I've heard from many people, that if you learn the fundamentals real well, you can pick up other languages faster than learning from scratch. So it all boils down to which you want to choose. I would say either learn C or javascript, but that's my opinion.
 
Python is rapidly becoming the most common language used for scientific computation, particularly with packages like SciPy, though FORTRAN still refuses to die. Platforms like Mathematica and MATLAB are extremely useful. Python is the only language that I have listed that is truly general-purpose, though, so I'd start there.

- Warren
 
I appreciate the advice you both have given. I am now looking through the undergraduate catalog and for engineers their required computer science course is one of the following two (depending on the major):

CS 108 FORTRAN Programming for Engineers
3 Hours. Program design using FORTRAN: data types and operators; control structures; subprograms, file I/O; common storage. Engineering applications: matrix representations and operations; equation solutions Prerequisite: Credit or concurrent registration in Math 180.

CS 109 C/C ++ Programming for Engineers with MatLab
3 Hours. Program design using C/C++: Data types and operators, control structures, functions, file I/O, arrays and structures. Engineering applications: Matrices, equation solution, MatLab. Programming assignments. Extensive computer use required. Prerequisite: Credit or concurrent registration in Math 180.

In the mathematics department we're given the option at this course:

Mathematical Computer Science 260 Introduction to Computer Science
4 hours. Introduction to computers, the C language, data types, statements and expressions, selection and repetition, functions and parameters, input/output, arrays, strings and string library functions, pointers, structures. Prerequisite(s): Credit or concurrent registration in MATH 180

I also looked and saw this course above incorporates Python (found the course website online)... so maybe that is a good start? Although C/C++ is used along with MatLab by the engineers or Fortran. Hmmm.
 
If I had to pick one of those three classes, ryanj123, I'd pick CS 109.

- Warren
 
FORTRAN was once the programming language of scientists. Now, its popularity slipping in favor of newer languages such as C++ and MATLAB. Sometimes Microsoft Excel can even be used for calculating scientific data and plotting charts.

A good thing to keep in mind is that if you learn one programming language, there is a chance you should be able to quickly pick up another one. Most programming languages are usually not very different from each other from a functional standpoint, even though they may have different syn taxes. Often, they contain many of the same built in data structures. These things being said, C++ is used in such a wide variety of settings, in not just science, but also engineering and business, and several other programming languages (C#,JavaScript) draw from the syntax of C++. If you want to learn a programming language a wide variety of people easily recognize and appreciate, C++ would be the best to learn for that purpose.

You may also find it helpful to learn BASIC. In high school I worked on a physics-related research project with a professor who wrote all of the code for parachute sensors in BASIC. Some embedded sensor chips have a built in version of BASIC, and for this reason it might help to be familiar with BASIC if your research projects involve sensor devices.
 
cswave said:
You may also find it helpful to learn BASIC. In high school I worked on a physics-related research project with a professor who wrote all of the code for parachute sensors in BASIC. Some embedded sensor chips have a built in version of BASIC, and for this reason it might help to be familiar with BASIC if your research projects involve sensor devices.

Basic? I don't here about many people using that language these days...well, with the exception of visual basic and visual basic.net which is typically used for office (e.g. Excel) or web applications.
 
In the numerical world, FORTRAN and C++ are dominant. For that matter, in the field of computational fluids, FORTRAN is still king. Every piece of legacy code that I've looked at has been in poorly written, hard to read FORTRAN77.

For less computer intensive applications (i.e. your not taking derivative on 1m grid points 10,000 times), MATLAB is very easy to use.

My former adviser (who uses fortran of course) has always said something along the lines of: C++ is used everywhere, from math to applications, to everything. So, getting a standards changed to something useful for 'us' is impossible. However, fortran knows their user base: numerical analysists. As such, when the standards come out every 1/2 dozen or so years, we get great strides.

For your purposes though, I'd agree with chroot, go with the 109.
 
Minger, well put. I spend days reading horribly written FORTRAN 77 code and converting it into a C++ program.
 
  • #10
Math and chemistry, and science in general I have found LabVIEW to be great for a lot of simulation and instrumentation and control.

There is great support for users, and a vast let of addons and libraries as well.

Plus, and most important, it's fun.
 
  • #11
uuh plenty of different answers, i state the mine.
Different computer language are classified by their abstraction level and coding style. Refering to programming the most common and used style is "procedural" programming that works also as "base" for other styles. The two main language used are Fortran and C: absolute start with C. Even if fortran is still used, it was born in ~50 and is really obsolete, you may take a look here:

http://www.fortranstatement.com/cgi-bin/petition.pl

Inasmuch, UNIX interface are C based and GCC compiler offers better performance. C is absolute the most used programming language in the world, is born for scientific calculus and it works at "medium" level: it will help to understand how your computer works without being stuck as with Assembly. Remember also it'll be very easy for u to switch between language with same "coding style": with a strong C knowledge u'll read easly Fortran code (u won't be able to write so easly of course).
Next to procedural programming there is Object Programming, originally born for developing big applications when a little bit more of abstraction is required. C++ is actually the leader (all video games are written in C++). In my opinion the success of C++ in science is due to ROOT, an analysis tool for particle's physics that offers a front end in C++. So really choose this if u are interested in particle physics or if u have to deal with ROOT.

There are other language that are not "compiled" or that are not born for strong performance. Their advantages are a really simple way to code difficult thing, with a really strong abstraction level. They are really useful for analysing data or as "glue" for calling other applications. Two most important are Perl and Python, probably the latter is the best choice actually. It implements plenty of coding style from procedural to functional. NumPY and SciPY provides library for doing heavy code simulation but I'm not impress by the performance. In my opinion the future of simulations is a python code that initialize the sim and that call a C code(or similar) for doing heavy calculations. I found this wrapping technique fundamental and u will find described in "Python scripting for computational science - 2008 Langtangen".

Ll.
 
  • #12
I can't vouch for the usability of some more modern languages, but Fortran is a good tool. Even back in the 70s when I was doing a heat and mass balance on the entire water system (raw, filtered, warm, discharge, etc) system of a new pulp mill, that language (implemented in SAS) was capable of handling massive inputs with lots of measurements over lots of variables and yielding intelligible outputs for analysis (you still have to craft the routine to make sure you don't get garbage-out, of course.)

I'd love to have been handed that project with my present-day, 5-year-old PC as opposed to having to send code to Chester, PA over and over, hoping that it would have been run, and the print-outs delivered in time. Fortran screams.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
Replies
2
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 26 ·
Replies
26
Views
13K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K