Julia and Python: a dynamic duo for scientific computing
Authors: Bezanson, Jeff, MIT; Karpinski, Stefan, MIT
Julia is a recent addition to the collection of tools a scientist has available for tackling computational problems. It combines the simple programming model of a dynamic language like Python with the performance of a compiled language, while exposing expressive high-level features such as a sophisticated type system, dynamic multiple dispatch, Lisp-style macros and metaprogramming.
Julia can natively make zero-overhead calls to C and Fortran libraries without wrappers or data copying. Moreover, Julia can now call Python as well , with automatic bidirectional type conversion, bidirectional callbacks, and copy-free sharing of lists, dictionaries, and NumPy arrays. This is as simple as:
julia> using PyCall julia> @pyimport scipy.optimize as so julia> so.newton(x->cos(x)-x, 1) 0.7390851332151607
Conversely, Python code can dynamically load the Julia runtime library and execute arbitrary Julia code. We have exploited this possibility to run Julia within the IPython environment :
In : %load_ext juliamagic In : jfib = %julia fib(n) = n < 2 ? n : fib(n-1) + fib(n-2) Out: <PyCall.jlwrap fib> In : jfib(20) Out: 6765
In this talk weâ€™ll give an introduction to the Julia language and demonstrate how you can use Julia where it makes sense for you, while continuing to use your favorite scientific libraries and existing Python and C code.