Which programming language is best for Scientists/Modeling Physical World

In summary, the most commonly used programming language among scientists is either C++ or Python. Some undergraduate schools require students to take a programming class in order to graduate. If you want to become a scientist, it is advised that you learn either C++ or Python.
  • #1
ryanj123
24
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
  • #2
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.
 
  • #3
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
 
  • #4
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.
 
  • #5
If I had to pick one of those three classes, ryanj123, I'd pick CS 109.

- Warren
 
  • #6
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.
 
  • #7
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.
 
  • #8
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.
 
  • #9
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.
 

1. What are the top programming languages used by scientists for modeling the physical world?

The top programming languages used by scientists for modeling the physical world are Python, MATLAB, Fortran, C++, and Java. These languages offer a wide range of tools and libraries specifically designed for scientific and numerical computing.

2. What makes Python a popular choice for scientific modeling?

Python's popularity in scientific computing is due to its simplicity, readability, and versatility. It has a large community of users, which means there are a plethora of resources and libraries available for scientific modeling. Additionally, Python is open-source, free, and platform-independent.

3. How does MATLAB differ from other programming languages in terms of scientific modeling?

MATLAB is specifically designed for numerical computing and data analysis. It has a user-friendly interface and a powerful library of built-in functions and toolboxes for various scientific applications. It also has a robust plotting and visualization capability, making it a popular choice for data analysis and visualization.

4. Is it necessary for scientists to learn multiple programming languages for modeling the physical world?

It is not necessary for scientists to learn multiple programming languages for modeling the physical world. However, it can be beneficial to have knowledge of multiple languages to be able to choose the best tool for a specific task. Many scientists often use a combination of languages depending on the requirements of their project.

5. Can non-scientists use programming languages for modeling the physical world?

Yes, non-scientists can certainly use programming languages for modeling the physical world. Many programming languages have user-friendly interfaces and platforms that make it accessible for individuals with no prior programming experience. However, a basic understanding of scientific principles and concepts is necessary to effectively use these languages for modeling the physical world.

Similar threads

  • Programming and Computer Science
Replies
8
Views
867
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
8
Views
3K
Replies
1
Views
793
  • STEM Academic Advising
Replies
26
Views
11K
  • Programming and Computer Science
Replies
14
Views
4K
Replies
8
Views
2K
  • STEM Academic Advising
Replies
4
Views
2K
Back
Top