Contribute Media
A thank you to everyone who makes this possible: Read More

Julia and Python: a dynamic duo for scientific computing; SciPy 2013 Presentation

Summary

Authors: Bezanson, Jeff, MIT; Karpinski, Stefan, MIT

Track: General

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 [3], 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 [4]:

In [1]: %load_ext juliamagic In [2]: jfib = %julia fib(n) = n < 2 ? n : fib(n-1) + fib(n-2) Out[2]: <PyCall.jlwrap fib> In [3]: jfib(20) Out[3]: 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.

Details

Improve this page