Julia, MATLAB and Python: A Comparative Syntax Reference for Scientific Computing
Introduction
Modern engineering and scientific computing are increasingly using several programming languages at once. MATLAB remains popular in mathematical modeling, Python in data analysis and automation, and Julia is actively developing as a high—performance language for scientific computing.
Despite the differences in syntax, most of the basic structures in these languages are very similar: arrays, functions, loops, vectorization, graphs, and working with data. Therefore, when switching between systems, it is important to understand, first of all, syntactic correspondences.
This example is a practical comparison of Julia, MATLAB, and Python syntax in the "operation → implementation in language" format. The comparative format allows you not only to learn a new language faster, but also to better understand the general principles of scientific programming. In many cases, only the form of the record differs, while the computational logic itself remains the same.
Comparison of the basic syntax
|
Operation |
Julia |
MATLAB |
Python |
|
Comment |
|
|
|
|
Multi-line comment |
|
|
|
|
Assignment |
|
|
|
|
Dynamic typing |
|
|
|
|
Type verification |
|
|
|
|
An integer |
|
|
|
|
A floating-point number |
|
|
|
|
A complex number |
|
|
|
|
Infinity |
|
|
|
|
NaN |
|
|
|
|
Line |
|
|
|
|
String interpolation |
|
|
|
|
String concatenation |
|
|
|
|
Repeating a line |
|
|
|
|
Creating an array/vector |
|
|
|
|
The matrix |
|
|
|
|
Indexing starts with |
|
|
|
|
Access to the element |
|
|
|
|
The last element |
|
|
|
|
Cross-section of an array |
|
|
|
|
Logical indexing |
|
|
|
|
Size of the array |
|
|
|
|
Length of the array |
|
|
|
|
Creating a null array |
|
|
|
|
Creating a unit matrix |
|
|
|
|
Range |
|
|
|
|
Range step |
|
|
|
|
Element-wise multiplication |
|
|
|
|
Matrix multiplication |
|
|
|
|
Piecemeal degree |
|
|
|
|
Matrix division |
|
|
|
|
Transposition |
|
|
|
|
Concatenating arrays horizontally |
|
|
|
|
Concatenating arrays vertically |
|
|
|
|
The if condition |
|
|
|
|
The ternary operator |
|
|
|
|
The for loop |
|
|
|
|
The while loop |
|
|
|
|
Cycle interruption |
|
|
|
|
Skipping an iteration |
|
|
|
|
Function (briefly) |
|
|
|
|
Function (normal) |
|
|
|
|
Return of the value |
|
|
|
|
Anonymous function |
|
|
|
|
List Generator |
|
|
|
|
Dictionary |
|
|
|
|
Plenty |
|
|
|
|
Checking the accessories |
|
|
|
|
Exception handling |
|
|
|
|
Error generation |
|
|
|
|
Structure/Class |
|
|
|
|
The abstract type |
|
|
|
|
Importing a module |
|
|
|
|
Connecting a file |
|
|
|
|
Documentation of the function |
|
|
|
|
Macros |
|
missing |
missing |
|
Measuring time |
|
|
|
|
Output to the console |
|
|
|
|
Formatted output |
|
|
|
|
Working with the DataFrame |
|
|
|
|
Charts |
|
|
|
|
A random number |
|
|
|
|
Sorting |
|
|
|
|
Map function |
|
|
|
|
Filtering |
|
|
|
|
Equality check |
|
|
|
|
Identity verification |
|
|
|
|
Missing value |
|
|
|
|
Nothing / null |
|
|
|
Conclusion
Julia, MATLAB, and Python do not compete so much as complement each other in modern engineering and scientific tasks. Despite the differences in philosophy and syntax details, most computational constructs between them have direct analogues.
The comparative format helps to learn new tools faster, transfer algorithms between ecosystems, and better understand the general principles of scientific programming. This is especially important in the Engee multi-language environment, where different languages can be used within the same project.