HomeNews and blogs hub

Computational Mathematics with Jupyter

Bookmark this page Bookmarked

Computational Mathematics with Jupyter

Author(s)

Raniere Silva

Posted on 2 February 2017

Estimated read time: 5 min
Sections in this article
Share on blog/article:
Twitter LinkedIn

Computational Mathematics with Jupyter

Posted by s.aragon on 2 February 2017 - 2:08pm

 

ICMStalksBy Raniere Silva, Software Sustainability Institute, Hans Fangohr, University of Southampton.

From the 16th to the 20th January, the International Centre for Mathematical Sciences  hosted the Computational Mathematics with Jupyter Workshop organised jointly by the OpenDreamKit and CoDiMa projects where GAP, Singular, SageMath, Jupyter users and developers met for experience sharing talks and coding hackathons.

The workshop kickstarted with Mike Croucher asking the provocative question "is your research software correct?" Mike covered the reproducibility crises that, in his own words, can be partially solved with:

  • Automation (aka learn to program)

  • Writing code in a (very) high-level language

  • Getting some training

  • Using version control

  • Getting a code buddy (Maybe an RSE!)

  • Sharing your code and data openly

  • Using literate computing technologies

  • Writing tests

Mike's talk was complemented by Raniere Silva's talk listing some of the software that can be used and Olexandr Konovalov's talk about GAP Docker containers.

Thomas Kluyver lectured an Introduction to Jupyter that was complemented by talks from Vidar T. Fauske, Hans Fangohr, Jeroen Demeyer, and Sylvain Corlay.

Vidar T. Fauske demonstrated nbdime, a Git diffing and merging tool for Jupyter notebooks. Why do we need this special tool? Because although the Jupyter notebook file format is plain text, it stores a lot of metadata and images as Base64 strings which makes hard to diff and merge the notebook. Nbdime can show the diff of two notebook in a web browser. If the notebooks contain an image that has changed, the old image is shown on the left, and the new one the right—making the ‘diff’ accessible to humans.

Hans Fangohr introduced and demonstrated NBVAL, a tool that can be used to validate Jupyter notebooks. It takes a saved notebook that contains computed output cells, re-executes the notebook, and compares the computed output with the stored output. If the outputs differ, an error is raised. In some sense, NBVAL is for Jupyter Notebooks what doctest is for documentation strings.

Jeroen Demeyer and Sylvain Corlay showcased IPython widgets, which can be used in the Jupyter notebook to create interactive interfaces hosted inside the notebook in the browser. Sylvain showed  that IPython widgets understand gamepad input to the surprise of many and mentioned that the release of version 6.0 of IPython widgets will happen very soon.

One of the design choices of Jupyter Notebook (at that time called IPython Notebook) that, probably, makes the project attractive to many users is the language agnostic messaging protocol. This allows  for Jupyter Notebook to be used with any programming language as long as a kernel that speaks that language is available. So why not use GAP inside Jupyter? Markus Pfeiffer and Manuel Martins explained how to do it as well as how to include the use of widgets to display various graphical objects.

At the workshop, we also had some talks about use case studies where Jupyter notebook was used in higher education courses. Mike Croucher mentioned the great experience of Marta Milo, from the University of Sheffield, who taught a Bioinformatics and Computational Biology course for Biomedical Science.

Mark Quinn presented the successful case of using SageMathCloud for teaching undergraduate physics. SageMathCloud offers an online platform that facilitate lectures to assign and collect assignments from students and an full online Python programming environment where students have access to Jupyter notebook, a plain text editor, and the Unix terminal. Moving away from programming courses but still on the educational theme, Christian Lawson-Perfect demonstrated Numbas, a free web-based e-assessment system for mathematics that can be integrated on Moodle or Blackboard. Furthermore, in one of the coding sprints Chris Sangwin explained how to contribute to the STACK plugin for Moodle and together with Olexandr Konovalov they produced a prototype code for using GAP to check the correctness of student answers when Moodle is used in teaching abstract algebra courses.

On the last day, Hans Fangohr talked about  a case study using the Jupyter Notebook in computational science. As part of the OpenDreamKit project, a Python interface to the widely used OOMMF software has been created. This allows scientists researching magnetism at the microscale to define a computational (micromagnetic) problem in Python, execute this within the notebook, and - as a future feature - to analyse the data within the notebook. The name JOOMMF derives from Jupyter and OOMMF. Hans showed how a sequence of manually running many different simulations, extracting values from output files manually and executing further runs with redefined parameters, can be automated, and stored reproducibility using JOOMMF and the notebook.

The authors are very grateful to be able to attend the Computational Mathematics with Jupyter workshop: the organisers did a great work selecting the talks on the program that was educational and inspiring. We know, from coffee break conversations, that, like us, other attendees had good ideas for new projects during the workshop.

We will cover the hackathons in another post. Stayed tuned to read it.

Share on blog/article:
Twitter LinkedIn