Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
GSOC 2015 Application Param Singh : Improving Sympy's plotting module by adding Mayavi and d3.js backends
- 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: http://github.com/paramsingh
- IRC: not_on_fp
- Blog: http://singhparam.tumblr.com
- 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
#8989: Added units like Hz, Pa and J to the mks unitsystem (merged)
#9026: Add support for parsing
==in parse_expr (under review)
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  and needs to be implemented.
Addition of d3.js as a backend has also been discussed and worked on earlier by the community . 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:
- 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.
- 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.
- Squash bugs and fix performance issues in Mayavi backend, as needed.
- Begin working on d3.js backend in IPython
- 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
- 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