Wolfram Blog Team

Q&A with SpinDynamica Creator Malcolm Levitt

April 16, 2014 — Wolfram Blog Team

Professor Malcolm Levitt is Head of Magnetic Resonance at the University of Southampton and a leader in the field of magnetic resonance research. In the early 2000s, he began programming SpinDynamica—a set of Mathematica packages that run spin dynamical calculations—to explore magnetic resonance concepts and develop experiments.

Composite pulse animation

SpinDynamica is an open-source package that Professor Levitt continues to work on as a hobby in his spare time, but the SpinDynamica community also contributes add-ons to bring additional functionality to researchers.

Professor Levitt graciously agreed to answer a few of our questions about his work, Mathematica, and SpinDynamica. He’s hopeful that as word spreads, others will submit add-ons that enhance the core functionality of SpinDynamica.

What is your history in the field of magnetic resonance?

I’ve been researching in magnetic resonance since I was an undergraduate project student in Oxford in the late 1970s. I went on to do a PhD in Oxford, researching in nuclear magnetic resonance (NMR) with Ray Freeman. After that, I went off on a long sequence of postdoctoral positions. I worked with Richard Ernst in Zürich, who later won the Nobel Prize for his work on NMR.

I researched at MIT for about five years, and then became a professor in Stockholm, Sweden, before moving back to the UK in 2001. I now lead a magnetic resonance section at the University of Southampton. Most of my research has involved developing the theory and technology of NMR. It’s an amazingly rich field, since NMR is time-dependent quantum mechanics in action, and allows an instant coupling between a theoretical idea, a numerical simulation, and a real experiment.

There are now many thousands of distinct NMR experiments, involving different sequences of radio frequency pulses and switched magnetic fields, providing information on everything from biomolecular structure to cancer diagnosis to quantum computing. It really is a staggeringly versatile field of research, and I feel very lucky to have stumbled into it and to have made my career in it.

When did you begin working with Mathematica?

I started using Mathematica seriously for magnetic resonance research in the 1990s in Stockholm. During my PhD and in Zürich, I had written a lot of low-level code for controlling an NMR spectrometer, as well as graphical FORTRAN simulations of NMR experiments. Later on, while I was at MIT, I developed a lot of FORTRAN computer code for simulating magnetic resonance experiments, which I tried to make as general as possible. However, I always recognized the limitations and inelegance of the language.

When I first encountered Mathematica I remember a sense of recognition like, “Wow, this is exactly the computer language I would have invented myself if I had known how.” However I do remember at that time Mathematica seemed slow in execution and there would be times of frustration. Nevertheless I stuck with it. Happily, the progress of hardware and continued development of Mathematica made my commitment worthwhile.

What can you tell us about SpinDynamica and how you created it?

I started to use Mathematica seriously for NMR research in Stockholm, partly in combination with a book that I was writing (Spin Dynamics), for which I wanted to generate informative graphics and check the equations. At that time, I did experiment with creating a set of modules for numerical simulations of NMR experiments, as well as generating analytical results, but I did not develop this very far.

Several other numerical simulation packages for NMR came out. Although they were numerically fast for specific classes of problems, I still felt that they were not as general and as elegant as I would like. Furthermore, our group was getting into experiments that required certain types of numerical simulation that were not catered for. So at some point in the early 2000s I set about seriously developing general packages for both symbolic and numerical calculations of magnetic resonance, within the Mathematica environment.

3d trajectories plot

How do you use SpinDynamica in your research?

Mathematica in general, and SpinDynamica in particular, have become completely central to how I develop and test theoretical ideas. So it’s not as if I develop an idea and then test it with SpinDynamica—I actually use SpinDynamica as a tool to develop the idea in the first place. It’s a bit hard to explain, but it works for me. There’s something about Mathematica that seems to match perfectly the way I think and create.

Is there an interesting example or discovery you’ve come across while working with Mathematica and SpinDynamica?

A central topic of research in our group concerns something called long-lived spin states. These are certain quantum states of coupled magnetic nuclei that are very weakly coupled to the environment. They may be used for storing quantum information in nuclear spin systems for long times. (We have demonstrated over 30 minutes, which is an incredibly long time for a quantum effect in a room-temperature liquid.)

In the jargon of magnetic resonance, the equilibration of the nuclear quantum system with the environment is called relaxation. So these special nuclear spin states have very slow relaxation. It is a surprising fact, but true, that although the relaxation theory of NMR has been extensively developed with thousands of research papers since the 1960s and several Nobel prizes along the way, the existence of these states had been overlooked.

It was only when the symmetry properties of the relaxation were examined with Mathematica (using a precursor of SpinDynamica) that the presence of such states was predicted, and then demonstrated experimentally by our group in 2004. Our group is intensively researching the theory of these states and their exploitation in practical NMR experiments and, hopefully, in clinical MRI as well. Amongst other things, we are working with collaborators to develop agents that use long-lived states to detect cancer.

What impact do you think SpinDynamica could have on future magnetic resonance research?

That is hard to predict. There are several simulation packages in the community, many of which require less user intelligence, and which have a much faster execution for specific problems, than SpinDynamica. SpinDynamica is immensely powerful, but it does require that users have a good theoretical understanding in order to use it.

That weakness could be addressed by including additional packages for simulating common experimental situations without major theoretical understanding. The problem is that, at the moment, SpinDynamica remains a hobby project that is developed almost exclusively by me in my spare time. So although it is a superb tool for our particular branch of research, which demands a high theoretical level, there are many aspects that are rather undeveloped, including some important functionality that I have simply never had time to develop.

Nevertheless, I think the core functionality of SpinDynamica is powerful and stable, and I hope that the community will take it and build on it. That is slowly starting to happen. I have taught several graduate-level courses using SpinDynamica to explain the quantum-mechanical concepts of magnetic resonance, so there is take-up by a small but growing group of scientists. I think the impact will become much greater when I find time to write up a proper scientific paper on the architecture and functionality of SpinDynamica. Unfortunately my schedule makes that unlikely to happen soon.

Wolfram Blog Team

Get Hacking with Wolfram Technologies

April 10, 2014 — Wolfram Blog Team

It probably comes as no surprise that Wolfram has been asked to participate in a number of hackathons recently, including the upcoming HackIllinois. There’s a natural fit between our pioneering, agile approach to technology development and the growing hackathon phenomenon, in which coders come together for a short but intensive time—either individually or in teams—to create new and unique software or hardware applications.


Last month while at SXSW 2014, Wolfram helped provide support for Slashathon, the first-ever music-focused hackathon. Hosted by Slash from Guns N’ Roses, the winning hack will be used to help release Slash’s new album. Wolfram provided mentoring for the competition in the form of onsite coding experts and technology access.

Also last month, Wolfram supported both hackBCA and HackPrinceton in New Jersey for high school and college students, respectively. In addition to having Wolfram programming experts available as mentors, Stephen Wolfram attended both of these events, where he spoke about the Wolfram Language and what the Wolfram technology stack is making possible.

Stephen Wolfram gives talk about Wolfram Language

At hackBCA, several projects made use of the Wolfram|Alpha API and the emerging Wolfram Cloud platform. We also saw some neat uses of Wolfram technologies at HackPrinceton. The Wolf Cocoa team developed a solution for making OS X apps by creating Wolfram Language bindings to the Objective-C runtime. Another group, Pokebble, used the Wolfram|Alpha API to enable users to play Pokémon on the wearable Pebble smart watch. And the third place overall software project winner, α-TeX, used the Wolfram Cloud to enable users to embed computed results into LATEX.

Graphic command

This weekend Wolfram is again going where the coders are. Which isn’t far, as HackIllinois—the first-ever student-run hackathon at the University of Illinois at Urbana-Champaign—will be happening right down the road from Wolfram’s headquarters. Over 1,000 college students from across the country will be converging on the UIUC campus to imagine, learn, and launch their latest ideas as mobile apps, web apps, or other software and hardware projects.

As an event sponsor, Wolfram will be on hand to give a tech talk and demo our technologies, and to provide other event support. We’re excited to see what the winning teams can produce in only 36 hours!

Whether for educational purposes or fully commercial applications, we’re glad to see hackathons catching on as a way to develop the next generation of cutting-edge programmers. Maybe we’ll see you or your students at future hackathons. In the meantime, happy coding!

Wolfram Blog Team

A Highly Interactive SXSW

March 31, 2014 — Wolfram Blog Team

If you were one of the 72,000 highly energized people in Austin, Texas, earlier this month for the 2014 SXSW Music, Film, and Interactive Festival, you might have had the opportunity to connect with Stephen Wolfram and the Wolfram team at this year’s event. Known for showcasing cutting-edge technologies and digital creativity, Stephen was invited by the SXSW committee to present a featured talk for the third year in a row.

SXSW logo

If you missed Stephen live in Austin—and even if you didn’t—the “speaker’s cut” of his featured talk, “Injecting Computation Everywhere,” was posted to his Blog last week. In it, Stephen presents his vision of a future where there is no distinction between code and data, and showcases the Wolfram Language through examples and demos using Wolfram Programming Cloud, Data Science Platform, and other upcoming Wolfram technologies.

Response to Stephen’s talk was overwhelmingly positive, as attendees were inspired and impressed by the possibilities of the Wolfram technology stack. Business Insider, Popular Science, and VentureBeat were just a few of the media outlets on hand to cover the event. In other favorable receptions: Immediately following his featured talk, a book signing of Stephen’s award-winning work, A New Kind of Science, was so well attended that the SXSW bookstore ran out of copies!

All this activity paved the way for interesting conversations in the Wolfram booth throughout the event, where attendees of every age and level had the opportunity to see the Wolfram Cloud and Wolfram Language in action, talk to Wolfram experts, and get hands-on experience with our technologies, including the Wolfram Language and Mathematica running on the Raspberry Pi.

SXSW booth

One of the most popular activities in the Wolfram booth at SXSW was “live-coding” with Stephen and other Wolfram team members. Some neat examples of these spontaneous coding demos—from color-mapping countries of the world by GDP and computing stock values over time, to webcam face detection and pop art creation—can be seen and discussed further in the online Wolfram Community.

And in a unique mashup, Rolling Stone captured the moment when computational genius met musical genius at Slashathon, the first-ever music-focused hackathon. The event was hosted by Slash from Guns N’ Roses, and Wolfram provided mentoring for the competition in the form of onsite coding experts and technology access.

If we missed you at SXSW 2014, perhaps we’ll see you in Austin next year. In the meantime, consider joining us for our European Wolfram Technology Conference in Germany in May. You can also look for Wolfram in Boston in May at Bio-IT World, or in Indianapolis in June at the ASEE Annual Conference. Bookmark our events page for updates on future trade shows and conferences where you can connect with Wolfram!

Posted in: Wolfram News

Stephen Wolfram

Injecting Computation Everywhere–A SXSW Update

March 25, 2014 — Stephen Wolfram

Two weeks ago I spoke at SXSW Interactive in Austin, TX. Here’s a slightly edited transcript (it’s the “speaker’s cut”, including some demos I had to abandon during the talk):

Well, I’ve got a lot planned for this hour.

Basically, I want to tell you a story that’s been unfolding for me for about the last 40 years, and that’s just coming to fruition in a really exciting way. And by just coming to fruition, I mean pretty much today. Because I’m planning to show you today a whole lot of technology that’s the result of that 40-year story—that I’ve never shown before, and that I think is going to be pretty important.

I always like to do live demos. But today I’m going to be pretty extreme. Showing you a lot of stuff that’s very very fresh. And I hope at least a decent fraction of it is going to work.

OK, here’s the big theme: taking computation seriously. Really understanding the idea of computation. And then building technology that lets one inject it everywhere—and then seeing what that means.


Wolfram Blog Team

Bridging Architecture and Engineering with Mathematica

March 4, 2014 — Wolfram Blog Team

As an instructor at the School of Architecture Paris-Malaquais, Maurizio Brocato chooses to use Mathematica because he finds alternative solutions “less complete.” Only Mathematica incorporates the requisite image, logic, and mathematics functionality into one platform.

Brocato teaches his doctoral students the importance of understanding formal and fundamental viewpoints, and his goal is to prepare them to collaborate across disciplines with others in the field of engineering.


Posted in: Mathematica News

Stephen Wolfram

Starting to Demo the Wolfram Language

February 24, 2014 — Stephen Wolfram

We’re getting closer to the first official release of the Wolfram Language—so I am starting to demo it more publicly.

Here’s a short video demo I just made. It’s amazing to me how much of this is based on things I hadn’t even thought of just a few months ago. Knowledge-based programming is going to be much bigger than I imagined…


Posted in: Wolfram Language

Wolfram Blog Team

Searching Genomes with Mathematica and HadoopLink

February 21, 2014 — Wolfram Blog Team

Editorial note: This post was written by Paul-Jean Letourneau as a follow-up to his post Mathematica Gets Big Data with HadoopLink.

In my previous blog post I described how to write MapReduce algorithms in Mathematica using the HadoopLink package. Now let’s go a little deeper and write a more serious MapReduce algorithm.

I’ve blogged in the past about some of the cool genomics features in Wolfram|Alpha. You can even search the human genome for DNA sequences you’re interested in. Biologists often need to search for the locations of DNA fragments they find in the lab, in order to know what animal the fragment belongs to, or what chromosome it’s from. Let’s use HadoopLink to build a genome search engine!


Vitaliy Kaurov

Spellbound Valentines: DIY Art from 3D-Printed Sound

February 12, 2014 — Vitaliy Kaurov, Technical Communication & Strategy

An original gift can make people feel much warmer, especially in the icy weather affecting so many places this winter—including our headquarters. Valentine’s Day is a good excuse to get a little creative in the art of gift making. And for me, “getting creative” long ago became synonymous with programing in the Wolfram Language. It is that medium that compels me to treat programming as art, where one can improvise, easily pulling magical rabbits out of a hat.

So what shall we make? I think the best gift is a DIY one—especially if it says a lot without even making a sound. Below you see a 3D-printed silver earring in the shape of a sound wave recorded while a person is saying “I love you.”

I love you


Crystal Fantry

Registration Is Open for Mathematica Summer Camp 2014

February 10, 2014 — Crystal Fantry, Manager, Education Content

We are happy to announce the Mathematica Summer Camp 2014! This camp, for advanced high school students entering grades 11 or 12, will be held at Bentley University in Waltham, Massachusetts July 6–18. If you are ready for two weeks of coding fun, apply now on our website. Students who attend the camp have a unique opportunity to work one-on-one with Wolfram mentors in order to build their very own project in Mathematica.


Wolfram Blog Team

Improving Financial Analysis with Mathematica

February 3, 2014 — Wolfram Blog Team

When it comes to risk analysis, Mathematica is fast and reliable. That’s why Thomas Roux and Rémy Fellous decided to use Mathematica in lieu of technologies like Java and JVBA for conducting risk assessments at BRED Banque Populaire.


Posted in: Finance