Programming in Physics

Programing is a skill that I have advocated in my post here.  It is a useful tool in life and is used everyday by physicists researching all sorts of fields.  Biophysicists (physicists who use their skills to study biology, many conduct studies of radiation on biological systems which is important for medical work) can develop software to help map neurons in the brain. High energy particle physics can program tools to help look at how particles interact in a detector.  Even the Large Hadron Collider has their own software to simulate and help monitor the inner workings of the collider.  There are countless programs used by physicists, from simulations to  interfacing with electronic equipment,  all of which need to be made from scratch or heavily modified to fit the particular research need of the physicists.

So what programing language do they use?

Well for the longest time they mainly used fortran (the language that use to use punch cards), and many programs still use fortran.  It works well with mathematics (one of the biggest requirements) and wasn’t too difficult to use.

Currently a lot of code is written in a C language (like plain old C or C++) because it has a lot of functionality and many people know the language.  There are also math specific programming languages like MatLab (costs money) or Octave (free and open source) that are suppose to be intercompatible.  But recently there has been more and more use of python.  There are a wide variety of science and math functions that allow physicists to program their equations and python is quite easy to use.  I personally prefer python when I have to program (Octave is fine too) because of the ability to program math, the ease of use, and the increasing prominence in physics.

Now Matlab/Octave and python are used throughout science and math for the same reasons they are used in physics.  And even if you are not a scientist but love to program, if you have some decent math skills (like algebra and some calculus) you can probably find yourself easily employed by a scientist or research group.  Even science adjacent fields that use a lot of math (such as manufacturing of high tech equipment) will require those skills.  A good way to get into science if you don’t have a PhD.

If you are still at university in physics you are probably not required to take a programing class.  But this is starting to change and it is recommended that you do take a programming class before you graduate.  The school where I took my undergraduate physics classes are starting to require students to take a math based programming classes that now uses python (I took the class as a math elective and we used Microsoft Excel, Mathematica, and Matlab, but I already had taken a few years of programming classes for my undergraduate degree in computing) and the lab courses and thermodynamics course has a heavy programming component.

Are you in science? Do you program? What programming language(s) do you use?  Comment on Patreon or Twitter!

Liked it? Take a second to support Traveling Scienceman on Patreon!
Become a patron at Patreon!