Which programming language is best for Scientists/Modeling Physical World

by ryanj123
Tags: computer language, computer programming, modeling, scientific computing
ryanj123 is offline
Aug25-09, 06:47 PM
P: 24
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>....
Phys.Org News Partner Science news on Phys.org
NASA's space station Robonaut finally getting legs
Free the seed: OSSI nurtures growing plants without patent barriers
Going nuts? Turkey looks to pistachios to heat new eco-city
jeff1evesque is offline
Aug25-09, 07:04 PM
P: 312
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 thats my opinion.
chroot is offline
Aug25-09, 07:05 PM
Sci Advisor
PF Gold
chroot's Avatar
P: 10,424
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

ryanj123 is offline
Aug25-09, 07:36 PM
P: 24

Which programming language is best for Scientists/Modeling Physical World

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.
chroot is offline
Aug25-09, 08:02 PM
Sci Advisor
PF Gold
chroot's Avatar
P: 10,424
If I had to pick one of those three classes, ryanj123, I'd pick CS 109.

- Warren
cswave is offline
Aug25-09, 08:04 PM
P: 11
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.
John Creighto
John Creighto is offline
Aug26-09, 01:43 AM
P: 813
Quote Quote by cswave View Post
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.
minger is offline
Aug26-09, 10:06 AM
Sci Advisor
P: 1,498
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.
CFDFEAGURU is offline
Aug26-09, 05:18 PM
P: 723
Minger, well put. I spend days reading horribly written FORTRAN 77 code and converting it into a C++ program.
Darryl is offline
Sep28-09, 08:40 AM
P: 101
Math and chemistry, and science in general I have found LabVIEW to be great for alot 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.
Llewlyn is offline
Oct3-09, 04:40 AM
P: 68
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:


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".

turbo is offline
Oct3-09, 04:51 AM
PF Gold
turbo's Avatar
P: 7,367
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.

Register to reply

Related Discussions
Which programming language do you use? Academic Guidance 20
Programming for Scientists Programming & Computer Science 2
physical modeling General Engineering 4
Which programming language is the best ? Programming & Computer Science 15
c programming language Programming & Computer Science 1