0 like 0 dislike
0 like 0 dislike
What programming languages are most used for creating advanced math-related software/simulations?

19 Answers

0 like 0 dislike
0 like 0 dislike
If you are talking about simulation as in mathematical physics, fluid mechanics, etc: matlab and fortran + some python nowadays. Statistics: R and python, numerical analysis and linear algebra: matlab. I know people who use sage and mathematica also. I have heard of people talking about lisp and Haskell and how those are more “natural” to mathematicians. Other high level tools such as netlogo and anylogic are written with a mix of lisp, c++, java with python on top, etc but a mathematician working in simulations will only deal with api’s and rarely the underlying codes - at least not directly.
0 like 0 dislike
0 like 0 dislike
Most academic software isn't exactly a large-scale software engineering endeavor; Python is very often good enough for simulation given that numpy (which is what you should be using for most calculations) just calls C and C++ code anyway. Note that I'm biased since Python is my first choice of language for my own research.

As for other languages, I know that R is quite dominant in Statistics. Additionally, at least to my knowledge, a lot of numerical analysis researchers use MATLAB.
0 like 0 dislike
0 like 0 dislike
This is highly relevant to my field of specialty.

I am a fourth-year Ph.D. student, and my specialty is "Numerical simulation of stochastic partial differential equations". I am for the most degree self-taught in programming (except for the first introductory course in programming, which was a mix of C and Matlab) and have dabbled in C, Python, Java, R, Mathematica, and Javascript to varying degrees.

I am by far the most well-versed in Matlab. We design our numerical schemes and experiments, and the advantage of implementation speed by Matlab is difficult to beat (since most often under-the-hood problems are already solved to a satisfying degree), with the latest manuscript experiments soon reaching 3'500 lines of code. Our purpose is to investigate convergence rates and scheme properties, meaning that we are less concerned about commercial or the most efficient implementations.

That being said, I have actively pursued other languages as well to push the limits of what we can do. I'm simply not given the time to put it into practice. I have trashed two graphics cards due to Matlab trying to allocate memory beyond what's allowed. Some experiments take weeks or even months, and that requires me to get creative with how to deal with problems that come with it (such as power outages or forced updates).
0 like 0 dislike
0 like 0 dislike
I can only speak towards applied math. Legacy scientific code is generally in FORTRAN. More recent (30 year old code +) is generally in C++.

C++ has good bindings for GPU and High Performance Computing

There are projects in other languages, but this is just a rule of thumb for large scale scientific computing.
0 like 0 dislike
0 like 0 dislike
From what I’ve seen, the most basic stuff (i.e. ranging from hobby codes to academic research) is Python or MATLAB. But I’m assuming by “advanced” you’re asking about commercial software / stuff that can do jobs for actual engineering design. Here’s some examples and their backend languages:
- OpenFOAM (CFD): C++
- Star-CCM+ (CFD): C++
- MSC Adams (Multi-body Dynamics): C++ and FORTRAN
- NASTRAN (FEA): FORTRAN
0 like 0 dislike
0 like 0 dislike
I work in scientific computing. Our in-House PDE (Navier-Stokes, Elasticity, fluid-structure interactions, multi-physics etc.) solver is written in C++ and python, since it’s somewhat new. Older codes would probably also have FORTRAN here.
Then we have some people developing constrained optimization algorithms for problems using the simulations (like shape optimization). These are mostly written in python but sometimes MATLAB for smaller scale applications.

Because the size of simulations is sometimes quite large, C++ is the way to go as you end up having to solve very large sparse systems of equations. The linear algebra is partly in-house and partly from open source libraries like BLAS. Then you need derivatives for optimization which are computed using automatic differentiation, which is also written in C++.
Also, Julia is a newer language that is promising for similar applications.
0 like 0 dislike
0 like 0 dislike
Most use MATLAB or C++. For some niche things, you might see C. For extremely serious scientific computing stuff where every microsecond matters, you'd use FORTRAN.
0 like 0 dislike
0 like 0 dislike
Curious where Mathematica sits in working mathematicians' view? I really took to it when studying.
0 like 0 dislike
0 like 0 dislike
I am unsure what you mean by advanced.

Most users replied understanding it as "high-performance numerical computing" i.e. resource-efficient number crunching for maximum speed-up/accuracy.

There is also a whole advanced math branch working on symbolic math manipulation. In those areas Mathematica shined and to a lesser degree Matlab.

Our math professor in graduate school was using Mathematica to do/support symbolic transformations on  standard model equations using operators to represent standard model particle contributions. The whole algebra of allowed transformations could be fed into Mathematica to support transition to a conclusion. Also it is possible to comment/text out between transformations, which was later taken up by open-source projects like Jupyter notebooks.

So the now as-is standard for in-line transformations mixed with code blocks and comment sections came from this line of symbolic transformations.

When it comes to simulations eventually you'll fine tune your code to your particular simulation: we had a ~100.000 lines of code base in Fortran for multi-million particle molecular dynamics simulations for parallel computing running on clusters of to 1.000 compute nodes (talking end of 90s).

This is done nowadays by heavily relying on libraries provided by hardware vendors, which lend to C/C++ as basis, sometimes with their own compilers for their hardware (coded in Assembler? Or C++, but just guessing). I just recommend to either have test data and/or resources to try&test 3rd-party components before trusting them.

Otherwise I would rather assume the outcome to be false unless you know the library you take from someone else works on your specific set-up as intended. I know: testing is unpopular - and always was - but it is more time consuming to chase irrational outcomes than making sure your hardware-/ software stack works as intended.
0 like 0 dislike
0 like 0 dislike
I work in an industrial research center, in contact with academia. We do a lot of maths, related to engineering, fluid mechanics, chemistry, electrical engineering, optimization, data science, IA, quantum computing etc. We publish in the relevant reviews and seminars.

We use a lot of C/C++, but also perhaps even more Python. And some R, Fortran for old codes, Julia or Rust for a few new ones.

Python is very usable for intensive computations... as long as you use libraries that have been coded in C/C++. Which nowadays is the case for all mainstream algorithms.

Related questions

0 like 0 dislike
0 like 0 dislike
79 answers
coL_Punisher asked Jun 21
Regretting majoring in math
coL_Punisher asked Jun 21
0 like 0 dislike
0 like 0 dislike
2 answers
a_dalgleish asked Jun 21
Contributing to the right math area, If all areas are equally curious
a_dalgleish asked Jun 21
0 like 0 dislike
0 like 0 dislike
47 answers
countykathleen asked Jun 21
Is it possible to suck at rigor of math but great at intuition?
countykathleen asked Jun 21
0 like 0 dislike
0 like 0 dislike
6 answers
Aiden_Zhane asked Jun 21
I need an idea for a gift fot my math teacher!
Aiden_Zhane asked Jun 21
0 like 0 dislike
0 like 0 dislike
13 answers
angiemartoccio asked Jun 21
Why does math make no sense to me?
angiemartoccio asked Jun 21

29.6k questions

121k answers

0 comments

33.7k users

OhhAskMe is a math solving hub where high school and university students ask and answer loads of math questions, discuss the latest in math, and share their knowledge. It’s 100% free!