ANN: Clojuratica -- A seamless interface to Mathematica for fast numerics and more

Skip to first unread message

Garth Sheldon-Coulson

Jul 27, 2009, 9:24:52 AM7/27/09
Dear Clojurians,

I would like to announce Clojuratica, a high-performance, seamless Clojure interface to Wolfram Mathematica.

Mathematica will be familiar to many on this list already. It is probably the world's most powerful integrated software package for numerics, symbolic mathematics, optimization, statistics, and visualization. It is built around a robust, Lisp-like functional programming language. If you are unfamiliar with Mathematica or haven't encountered the most recent version, I encourage you to learn more about it.

The union of Clojure and Mathematica will be useful and potentially transformational for anyone who works in scientific computing, parallelized simulation, finance, or other areas where Clojure's strengths in concurrency and parallelism are complemented by Mathematica's array of numerical routines and visualization tools.

I wrote Clojuratica for my own research involving CPU-intensive simulation and Bayesian inference. I strongly believe that Clojure and Mathematica could outshine the existing crop of scientific computation packages, including NumPy, MATLAB, and R. Clojure's own Incanter is a terrific piece of software, but it will be some time until it can match Mathematica feature-for-feature.

The following is a list of Clojuratica's core capabilities, copied from the new Clojuratica web site. On the web site you will also find a Clojuratica tutorial and Clojuratica Google group.

The features:
  • Clojuratica enables the seamless translation of native data structures between Clojure and Mathematica, including high-precision numbers, matrices, N-dimensional arrays, and arbitrary Java objects.
  • Clojuratica makes it easy to evaluate Mathematica expressions from Clojure. Now Clojure programs can take advantage of Mathematica's enormous range of numerical and symbolic algorithms and its fast matrix algebra routines.
  • Clojuratica offers an elegant syntax that integrates closely with Clojure.
  • Clojuratica builds a bridge between Clojure's state-of-the-art concurrency features and Mathematica's existing parallel-computing capabilities. It adds a high-performance, non-blocking concurrency queue that mediates communication between Clojure and Mathematica. Now it is easy to run a simulation in Clojure with 10,000 independent threads, each asynchronously evaluating processor-intensive expressions in Mathematica. The computations will be farmed out adaptively to however many Mathematica kernels are available on any number of processor cores — either locally or across a cluster, grid, or network. The result is the "Clojurization" of Mathematica's existing parallel-computing capabilities.
I encourage you to look at the Clojuratica web site, tutorial, and Google group. I hope you find Clojuratica's syntax easy and intuitive.

If you think you may find Clojuratica useful, please let me know. The level of interest will dictate whether I write more complete documentation and add new features.

I would also be very glad to hear comments, constructive pieces of criticism, and kudos on the design and implementation. Feature suggestions and bug reports are welcome. Please use the Google group. This is beta software with all the usual caveats.

Best regards,
Garth Sheldon-Coulson

P.S. For those interested in implementation details: The heart of Clojuratica is a Clojure-written Java class called CExpr that implements ISeq and wraps the homoiconic Mathematica expression object (similar to the Lisp s-expression). Implementing CExpr was a breeze thanks to the sequence library, and everything else followed quickly from there. Implementing the concurrency queue was also easy thanks to STM. Clojure strikes again.

Jan Rychter

Jul 27, 2009, 9:43:56 AM7/27/09
Garth Sheldon-Coulson <> writes:
> I would like to announce *Clojuratica <>,* a

> high-performance, seamless Clojure interface to Wolfram
> Mathematica<>.

Wow! This is exactly what I needed. I've been looking for interfaces to
Mathematica back when I was still using Common Lisp. Recently I do most
of my coding in Clojure and I'd eventually cook up something similar to
what you did, only with much less functionality. I've even been looking
at documentation for J/Link recently.

Thank you, this interface will be very useful.


Reply all
Reply to author
0 new messages