MECHANICAL ENGINEERS SHOULD LEARN PYTHON
originally posted on Quora in response to the question “Which programming language is most suitable for a mechanical engineer?”
So the other answers here, while good, gloss over some nuance.
As Shreeyash Lalit alludes to, mechanical engineers deal with 4 main classes of computation. Computer Aided Design , Finite Element Analysis, Data Acquisition, and Numerical Analysis. It’s good to be competent with the usual tool in your industry for each of these, but know that their domain is deep and that people have spent whole careers becoming experts in just one.
But let’s look at each a little closer
CAD/FEA
That said, your question asks about programming languages, and neither CAD nor FEA is a programming language. Though most have API’s of some sort—accessible via either visual basic, python, or maybe a home-grown scripting language—you won’t be “programming” at least in the traditional sense.
Data Acquisition
For data acquisition, LabVIEW is the only choice. Strictly speaking it is a programming language, but it’s use is comparatively niche and it’s graphical scheme is unlike all other programming languages that are built with lines of text. I see the value of LabVIEW as inversely proportional to the size and complexity of a program, as well as my desire to reuse code.
Numerical Analysis
I guess this is what your question was about all along and it comes down to two options: MATLAB and Python. Don’t bother learning FORTRAN until you need to (again, unless your industry demands otherwise… most don’t).
So… MATLAB v Python. If you want to be able to put something on your resume that will help you in getting a staff engineering role in a big firm, put MATLAB. Raytheon, for example, is not (currently) going to have institutionalized python, but they have with MATLAB. MATLAB also has great customer service, a bunch of free seminars, and their “toolboxes” of extra functionality (which you pretty much need to do anything cool) pretty comprehensive—and expensive.
All that said, I would still go with Python Why?
There are more resources for learning it
It’s free
Between NumPy and SciPy it has nearly everything as MATLAB’s core package.
Speed has, in my experience,been very comparable.
Many free python modules are as good, if not better, than MATLAB.
A world of people, inside and outside of academia, use Python.
If you’re interested in Robotics, lots of compelling robotics tools (usually written in C++ or C) have python bindings (ROS,OROCOS,OpenCV).
MATLAB is trying to provide compatibility to some of those robotics tools, meaning they are lagging behind python in that sense (it’s tough for a company to keep up with the masses)
Many MOOC’s use python as a programming language of choice, again making it easier to learn.
It’s a general purpose programming language. You can use much of what you learn to build a web application, or almost anything.
Embedded Linux platforms like the BeagleBoard and Raspberry Pi ship with Python, so you can control them right out of the gate in that language… try doing that with MATLAB and it will get expensive.
So I pick Python, and you should too.