Skip to content

Improving Rule Based Integrator

Mayank Singh edited this page Mar 25, 2018 · 1 revision

About Me

Basic Information

Heading Details
Name Mayank Singh
University Jaypee Institute of Information Technology, Sector 62 - Noida, India
Github profile code-monk08
Time zone IST (UTC +5:30)

Personal Background

I am Mayank Singh, a first-year undergraduate student studying at Jaypee Institute of Information Technology Noida Sector - 62, India. I am currently majoring in Information Technology. I started programming in C around one and a half year back, I gradually learnt C++ and Java. In the last 6 months, I started out with Python3 from the book “Automate the Boring Stuff with Python” and since then Python is my favourite language, Python’s short and simple syntax and it’s usage in wide variety of fields is what that makes me love Python, I have developed very small scripts in Python for my personal usage and one basic Space Invader game with the help of turtle module. Space Invader I have also worked with some of the front-end web technologies including HTML, CSS, JavaScript, Sass, Bootstrap, in the last 8 months, I have been working with Git & GitHub for over 5 months now, currently I am working on Data Structures and Algorithms in C

Platform Details

  • OS: Ubuntu 16.04 LTS
  • Hardware Details: Intel® Core™ i5-7300HQ CPU @ 2.50GHz × 4 , RAM 8GB
  • Code Editor: Vim / Nano

Me and Sympy

This is my first encounter with a SymPy where I also got to know about Computer Algebraic Systems (CASs), although for over a week I had been exploring the possibilities of SymPy (CAS) from SymPy Documentation, SciPy videos (YouTube Channel: Enthought) and through GitHub.

I am interested in contributing to the development of SymPy in the Mathematics Project particularly in the module integration, since the time I started with calculus, Integration became one of my favourite topic, I also want go deep into Python and develop my Skills, and for that SymPy is a great choice.

My favourite feature from SymPy is definitely its core feature, representing everything in terms of Symbols, this really makes understanding very easy, and indeed the process of calculation is coherent with what we do on, on paper calculations

Contributions to SymPy

I have started with contributions to SymPy around a week ago and up till now I have one merged commit in SymPy

The Project


SymPy is Computer Algebraic system written in Python, with focus on keeping the code as simple as possible, there are different modules which are present in SymPy based on different Mathematical domains, like algebra, calculus, combinatorics, differentiation, integrations etc. , In the Integration various Integration Algorithms have been implemented in Python and in the year 2017 during GSOC period, two selected students Arihant Parsoya and Abdullah Javed Nesar have implemented Rule Based Integrator (Rubi) and due to lack of time they could not entirely complete the same, this year I propose to take on the work from where it was left, presently Rubi integrator contains over 6000 integrations rules, according to various expression types of the integrand, these are:

  •  Algebraic
  •  Exponential
  •  Logarithmic
  •  Trigonometric
  •  Inverse Trigonometric
  •  Hyperbolic
  •  Inverse Hyperbolic
  •  Special Functions
  •  Miscellaneous

Rule Based Integrator gives optimal performance for different mathematical expressions and it is also better in performance when compared to other Computer Algebraic Systems like Maple 18, Mathematica 10.


In 2014, on basis of issues PR #7748 & PR #7749 an Idea was proposed by Ondřej Čertík to implement 10,000 Integration rules in SymPy which should be completely based on the idea of implementing a decision tree so that on giving an input expression into SymPy it should match the given set of Transformation Rules. There were challenges like if already a similar kind of rule existed in SymPy than either the output of old rule should be overridden by the newer rule, or the outputs of both the rule should be displayed, or otherwise an exception should be raised, also Work on issue should be initiated in such a way that even other applications can also use them, all this was brought into consideration as Rubi showed tremendous output success when compared to other Computer Algebraic Systems such as Maple or Mathematica, then It was proposed by Upabjojr to use hashable lookup elements in rules and verify them by list lookup, also he suggested to use Downvalues and Upvalues as used by Mathematica. Where Downvalues were defined when variable itself does have no meaning but can get meaning when combined with proper arguments: Example : f[x_] = x^2 means that every time f[...] is encountered it is to be replaced by ...^2 , but when only f is present it would become meaningless. In Upvalues sometimes it is convenient not to associate the rule to outermost symbol. Example : you may want to have a Symbol whose value is 2, when it has subscript of 1, C/: subscript[c, 1] = 2 when only c is encountered then it is ownvalue (meaning only a variable). Following discussions from #12233 and during GSOC timeline in 2017 work was done on implementing a rule based integrator in SymPy by two of the Selected Students 1. Abdullah Javed Nesar – GitHub : 2. Arihant Parsoya – GitHub : The core Idea behind the work was to take a few rules from Rubi 4.9, and then try to implement all those ideas into SymPy, then there it was required to have some kind of list and when expression was given to SymPy for evaluation, then using pattern matching techniques the correct rule should be matched with a generalised pattern defined in SymPy and evaluated so as to generate an output, also on scaling it was required to measure out the speed and to develop some debugging and documentation tools, ultimately Rubi was implemented into SymPy where for Pattern Matching Matchpy Module was used and many utility functions were also implemented, but a lot of work is pending in SymPy and there many such transformation rules which have to implemented in SymPy plus there is lot of work on Improving the performance in terms of speed of the Rule Based Integrator and to add more rules, so I propose to continue work from here and try my level best to be successful in implementing more Integration Transformation Rules into SymPy.


To improve Rubi Integrator by adding more transformation rules and improving the performance.


I will try to devote about as much time required to get the work done per week to improve SymPy’s Rubi Integration Project. I will try completing all issues on time with proper guidance and communication with my mentor. My examinations will start from 14th May 2018 and will end up on 21st May 2018 also my vacations will officially start from 28th May 2018 and will end up on 15th July 2018. Community Bonding Period: I will devote enough of my time in understanding SymPy’s Documentation, and particularly Integral and Rubi Integral Module, I will get in touch with Mentors and other selected students to ensure proper functioning of the Open Source Community.

  • By 10th June: I will try to improve and implement on all issues including PR #12233, PR #7749 and the one which would be assigned to me by my mentor, and be ready before the first Phase Evaluation.

  • By 30th June: I will try to fix Issue PR #13241 & Issue PR #13339as both are performance related issues of Rubi Integrator and continue on adding more transformation rules to SymPy.

  • By 10th July: I will try to resolve Issue PR #13240 which is “Rubi integrate is 7.6x slower than integrate” and PR #13022 as it will be related to the previous work which i would have done, before 2nd phase evaluation.

  • By 17th July: I will continue adding more transformation rules to SymPy and work as my mentor guides me.

  • By 26th July: I will try to work on the issue PR #13261 “WIP : Sphinx documentation for Rubi”

  • By 31st July: I will continue improving Rubi, Issue PR #13243 .

  • By 5th August: I will try resolving all the issues including PR #7264and the ones related to my project and recheck for any needful changes in any issue in accordance with my mentor.

  • By 10th August: I will try to submit my project completely.

In the above coding period, I will be constantly curious and open to all learning experiences, Programming is something which I am passionate about and It will be great opportunity for me to be involved in contribution to SymPy under Google Summer of Code 2018


Clone this wiki locally
You can’t perform that action at this time.