Why Scientific Computing Is So Great With Julia | by Emmett Boudreau | Towards Data Science

Over the past ten years, the scientific computing craze has escalated further and further, and with that so have the great options available to programmers for mathematical computation and data manipulation. One of the languages that might not be as popular as other languages in the field, like Python and R, is an open-source, multi-paradigm, and incredibly dynamic language called Julia.
Julia is a language that was created to be not only used in general-purpose applications, but also be very geared towards scientific computing and computational analysis. While this in and of itself means that Julia might be better for those applications than languages that are not built to do these operations, there are also a lot of really neat attributes that the language holds that make it great for scientific computing aside from just being built to do it.
As you might have expected, the first major benefit to using the Julia language for science and statistics is speed. The language’s speed is reliable, consistent, and most importantly; reproducible. Julia code is not only nearly as quick as the C programming language, but it is also incredibly quick to write. A huge advantage to writing Julia code over C code, or even C++ code for that matter is that with Julia, you can use methods as templates. In C++, for example, we could take any class and sub-type it — a Honda Civic is a sedan, which is a car, which is a vehicle. In Julia, we could apply this same “ templating” strategy to methods using polymorphic dispatch.
All of this comes together to make a language that can be used scientifically in the same applications as C, but be written with the speed and ease of something more akin to Python, Nimrod, or JavaScript. This is of course incredibly powerful for regular, general-purpose applications, but it is further exemplified in applications like machine-learning, data-analysis, and scientific calculation.
Another great thing that Julia has support for is syntactical expressions. These allow you to attribute formulas to identifiers and create easy and traditionally scientific ways of performing arithmetic with parameters. Of course, there are a lot of places where this comes into play — and dispatch in itself is a syntactical expression. As an example, however, we could do f(x) where f(x) is equal to the factorial of x:
f(x) = factorial(x)
Although this isn’t the only example of this in Julia, we could take it another step further with something like sigma:
∑(x) = sum(x)
Or of course we could add arithmetic into our expressions:
μ(x) = sum(x) / length(x)
Last year, I wrote an article where I predicted that Julia could be a great replacement for Scala. One of my big arguments against using Scala is the lack of floating point accuracy, which is a problem that will be inherited in any Java-descendant programming language. Julia can handle big-data operations, like Scala, while retaining the floating point accuracy to the exact decimal using different types such as BigInt and BigFloat. These measurements could be incredibly important scientifically, depending on what you are working on; a fraction of a decimal could mean the difference between a valid hypothesis and accepting the null.
One of Julia’s biggest weaknesses is its young age. It is hard to break out as the programming language of the future when your programming language is so new. However, despite its relatively young age, Julia does have a lot of great packages for scientific use that are already available. Some of these packages might not even have counter-parts in other languages.
Do you want to do machine-learning with neural networks? Do you want to do bioinformatics, astrology, quantum computing, optimization, or statistical plotting? Julia has packages available to perform all of these operations. While they might not be as mature as some packages in other languages, they are constantly being improved, and you could always commit code yourself to further the project.
With many scientific languages, the objective goal is usually to be dynamically-typed and functional. However, Julia takes generics to a whole new level and allows for the language to be both traditionally functional with immutable data, structs, and constant types, and be object-oriented with functions that edit data contained within constructed types all at the same time.
Julia is not only dynamically-typed, but the language itself is incredibly dynamic in nature — it can do nearly anything you want it to do, just by establishing how you want your data stored and manipulated using multiple dispatch AS a paradigm.
There are a lot of great reasons that a scientific programmer might want to try the Julia programming language out. Julia is not only fast to compile, but also super fast to write and develop. This is a huge advantage for all programmers working with the language, but might be even more vital for scientific programmers who need to constantly adapt their functions to work with new data and change the way that they are working with certain types in their work.
Furthermore, Julia is an incredibly dynamic language with polymorphic dispatch and syntactical expressions that allow one to manipulate the language to write like scientific formulas. Of course, this is a great thing for not only scientific programmers, but also any programmer who intends to perform multiple operations with several different types using the same methodology. Julia is also rather accurate with computational analysis compared to a lot of its competitors, which puts it ahead of languages that have issues calculating high-floating point values.
Lastly, although Julia’s ecosystem is young, and a lot of packages aren’t fully mature yet, the sheer level at which packages are being developed at this current point in time is astonishing. There are so many different packages available for so many different scientific applications, and this is only going to get better overtime.
For scientific programming, Julia is really shaping up to be a fantastic language for use in the future.