I posted a few posts tonight that use Julia as a language to accomplish some orbital mechanical tasks. I decided to take a step back and provide a brief overview of what Julia actually is.

Their website is https://julialang.org/ and the language has been climbing the charts. It is a language that specializes in mathematics and statistics. It provides high performance throughput and specializations in data science, machine learning, parallel computing and scientific domains.

The problem it was built for

Julia exists to answer what the authors called the two-language problem. You prototype in something pleasant like Python or MATLAB, discover the hot loop is a hundred times too slow, and rewrite that part in C or Fortran. Now the project is two codebases, the fast one is the one nobody wants to touch, and every change has to be made twice.

Julia’s answer is to be a dynamic language you can write like a scripting language that still compiles to native code. Nothing is interpreted in the usual sense: the first time a function is called with a particular combination of argument types, the compiler specializes it for those exact types and hands it to LLVM. That’s why there’s a pause on first call, the famous time-to-first-plot, and why the second call is fast.

Multiple dispatch

The organizing idea is multiple dispatch. A function isn’t owned by a class; it’s a name with many methods, and which one runs depends on the types of all the arguments. Define propagate(orbit, dt) for a Keplerian element set and again for a state vector, and the right one is selected at compile time with no branching at runtime.

The practical effect is that packages compose in ways they normally don’t. Somebody writes an ODE solver that only knows about arithmetic; somebody else writes a number type carrying measurement uncertainty; a third person passes one into the other and gets error propagation through the integrator for free, with neither author having planned for it. That happens routinely in Julia and it is rare elsewhere.

The cost is that performance depends on the compiler being able to infer concrete types. Write something the inference can’t pin down and it boxes the value and falls back to a dynamic lookup, and you get Python speed out of Julia code with no warning. @code_warntype is the tool for finding it, and learning to read its output is most of learning to write fast Julia.

The ecosystem

Version 1.0 landed in 2018, which is when the language stopped breaking under people. The creators won the Wilkinson Prize for Numerical Software in 2019, and the scientific computing crowd, including economists and physicists whose work you have heard of, have moved real projects onto it. For my purposes the relevant packages are DifferentialEquations.jl, which is as good a solver suite as exists in any language, and SatelliteToolbox.jl, which already implements a fair amount of what I was porting by hand.

In summation, Julia is just another programming language. If a developer knows one language, they know them all.