GSOC 2015 Application Param Singh : Improving Sympy's plotting module by adding Mayavi and d3.js backends

Param Singh edited this page Mar 28, 2015 · 2 revisions

About Me

Personal Details

  • Name: Param Singh
  • College: National Institute of Technology, Hamirpur, India
  • Year: Freshman
  • Major: Computer Science and Engineering
  • E-mail: paramsingh258[at]gmail[dot]com
  • Github:
  • IRC: not_on_fp
  • Blog:
  • Bio: I'm a freshman at the National Institute of Technology, Hamirpur where I'm currently pursuing an integrated masters in Computer Science and Engineering. I'm from Lucknow, Uttar Pradesh.

Development Environment and Programming Experience

My development environment is really simple when it comes to explaining it. I have a Macbook Air (early 2014 13" inch) on which I have OS X 10.10 Yosemite and Ubuntu 14.10 installed. I plan to begin using KDE with Plasma 2 as soon as Kubuntu 15.04 is released. I used to use Sublime Text 2 as my primary text editor but because it wasn't FOSS and the development seemed a bit too slow to me, I have switched to Github's Atom text editor.

I've been using Python for about an year now and I feel that I'm comfortable in it to a satisfiable extent. My favorite feature of Python has to be its assimilation of features from function programming languages while keeping a good OOP implementation in place. The uses of map, reduce and filter, the presence of higher order functions were all attractions that caused me to learn Python. I also learned a little bit of Django to get familiar with making relatively bigger projects in Python, so that I could learn about code organization along with a little bit of web development.

I've also been learning a little bit of Haskell over the last few weeks because dipping my feet into purely functional languages seemed like the logical step after liking Python's functional features so much. I also participate in competitive coding competitions online as much as possible, especially on Codechef.

I've been using git for some time now (I made my github account in 2012) and I feel comfortable using it, even though it's hard to say that I know git completely because of so many extensive features that the software has.

Contributions to Sympy

The Proposal

Brief Overview

Implement a Mayavi and d3.js backend for the plotting module and then make Sympy Gamma use the d3.js backend in Sympy

Sympy's plotting module currently only supports matplotlib as a backend. While matplotlib is a pretty good backend for general use, it has certain limitations like subpar 3D plots and little integration with the browser. Hence, I would like to add support for Mayavi and d3.js by implementing their respective backends in Sympy over the summer. Implementing a d3.js backend would also allow me to make Sympy Gamma's plotting use Sympy proper's plotting instead of doing their own thing independently. I will also be working on any minor issues concerning the plotting module that might get reported along the way.

Motivation and Explanation

Sympy has a plotting module that is extensible because of the way it's been designed. My proposal is to add support for a wider variety of backends to the plotting module, especially Mayavi and d3.js. Currently matplotlib is the only one implemented however it is not the best when it comes to 3D plotting. Mayavi is ahead in terms of performance and the plots created by Mayavi are better too.

Sympy Gamma's plotting is based on d3.js and it would be useful if one could actually use d3.js for sympy plots right from IPython and Sympy Live. The second major part of my proposal is adding this functionality because this would allow for better graphs, while also allowing us to integrate Sympy Gamma's plotting functionality with core Sympy's plotting.

The third part of my proposal is to improve the interaction between Sympy Gamma and Sympy when it comes to plotting. Currently Sympy Gamma supports only a subset of all functionality that Sympy provides, mostly because matplotlib has not moved to the browser yet, and Sympy Gamma doesn't make any calls to Sympy for plotting, using their own logic instead. My task would be to modify Gamma so that it uses the aforementioned d3.js backend that I'll write for Sympy, hence adding lots of functionality (like multivariate equations etc.)


In my opinion, plotting is one of the most integral parts of any computer algebra system. Sympy's plotting system is really extensible and this can be used to our advantage a lot more than it is now. A better 3D plotting backend is a feature that has been discussed a lot [1][2] and needs to be implemented.

Addition of d3.js as a backend has also been discussed and worked on earlier by the community [3][4][5]. This is also an important feature, in my opinion, because it allows us to improve two things (Sympy and SympyGamma) in one go. SympyGamma is a product which faces the end users and we should try to improve it as much as possible.


My semester ends on the 19th of May, 2015 and after that I will be free to work on this project for the entire summer (until the first week of August when the next semester starts). I don't have any significant plans for the summer that could interfere with the project. I'll have no problems giving the 40 hours a week to the project expected, throughout the summer. The timeline that I expect the project to follow is:

Week 1

  • Community bonding
  • Get familiar with the codebase, especially the plotting module. I have been reading the Sympy code for some time now, however I will need to put some time into getting familiar with the plotting module which I expect to do in this time.

Week 2

  • Read source code of how Mayavi works with Numpy and Scipy in order to get familiar with the Mayavi API
  • Make design decisions after discussions with mentor as to how the backend should be implemented exactly
  • Begin writing code for the Mayavi backend

Weeks 3 - 4

  • Spend the third week writing the Mayavi backend and squashing bugs.
  • Read Sympy Gamma's work on d3.js and decide how much code is portable and to what extent

I expect to have sent a pull request implementing the Mayavi backend by the end of week 4.

Week 5

  • Squash bugs and fix performance issues in Mayavi backend, as needed.
  • Begin working on d3.js backend in IPython

Weeks 6-7

  • Complete the d3.js backend for IPython by the end of week 6 and send a PR
  • Work on making d3.js work with sympy-live

Weeks 8-9

  • Send a pull request to sympy-live with code that makes use of the d3.js backend
  • Begin working on the sympy-gamma codebase, making it work with the new backend.

Week 10 onwards

  • Complete work on sympy-gamma by the end of the 10th week
  • Spend the rest of the summer time period, fixing bugs and writing extensive documentation


  1. Stack Overflow
  2. Stack Overflow - Using sympy with Mayavi
  3. Future of Plotting in Sympy-Live and Gamma
  4. SymPy plots with D3.js in IPython - Relevant Pull Request
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.