Skip to main content


Showing posts from 2018

GSoC 2018: Week 11

Hello everyone. Here is the brief progress of Rubi module in the 11th week of GSoC period.
The main PR, which contains the major changes of this GSoC period was merged this week. I had not run pyflakes on it. I ran pyflakes on the main PR and fixed undefined issues. 
This week was mainly spent to test code generation. Initially, there was some error in generating the code. An issue was opened in this regard. I tried various other structure of Rubi to get it working.  Currently, patterns are not matched correctly. I have opened a PR for this. We are still trying to get the code generator working so that we can reduce the loading time of rules. Now, the loading time of all rules is around 10 minutes.

GSoC 2018: Week 10

Hello everyone. Here is the brief progress of Rubi module in the 10th week of GSoC period.
Last week, we were able to load all rules. Rubi has now come in a very stable and working condition. One Missing thing in the main PR was missing instructions and documentation. This week I tried my best to write instructions, so that a new user can easily get familiar with it. I have kept it really simple.
Initially, I wrote a script in Mathematica to generate downvalues in separate files. This was done till now manually, but now it's automated. Then I wrote a sympy script to generate all rules and constraints in proper files directly just by running a function. For a more easier understanding of steps, I created `` explaining all steps.
Next thing I realised that it would be good if we create a parsing script for the tests too. Till now I used maple format. But a lot of manual things were required. So I wrote a script which directly parses tests into sympy format. All this…

GSoC 2018: Week 9

Hello everyone. Here is the progress of rubi module in the 9th week of GSoC period.
In the very beginning of the week, the PR for appelf1 was merged. My aim for this week was to load all rules and test at least a small part for each type of rule. Due to the time factor, its not possible to test all. Moreover, rubi needs to be updated to the latest version, so the test suite too will be updated.  
I started with trigo rules. They are huge in number. They were never tested before, so some utility_functions like `TrigReduce`, `KnownTrigIntegrandQ`, `FunctionOfTrig` etc were wrong. They were corrected. Soon I realised a difference between sympy and Mathematica. In mathematica, `1/Cot[x]` is automatically transformed to `Tan[x]` and `1/Tan[x]` too was transformed to `Cot[x]`. But in sympy, these are different. So, `tan(x)` didn't match to `cot(x)` . Francesco suggested to replace all `cot` with `1/tan`  and similarly for `sec` and `csc` (in the code generator too). 
Next, I moved to `i…

GSoC 2018: Week 8

Hello everyone. Here is the brief summary of the progress of rubi integration module in the 8th week of GSoC period.

We completed the testing of logarithmic test cases. Some of the tests are failing as they depend on trigonometric rules. The rules and tests have been updated in this PR.

Next, I loaded all trigonometric rules. They are huge in number. So the loading time increased from 1 min 30 sec to around 6 min. For now, I have not loaded them. I also updated the test cases for parsetools and fixed code quality issues. Currently, the travis is failing due to a bug, which has been fixed in branch 1.2. In the upcoming week, 1.2 probably will get merged in master.

Then I moved on to implementing appellf1 in sympy. Progress can be seen in this PR.

We will be updating our utility_functions to the latest version of RUBI.

GSoC 2018: Week 7

Hello everyone. Here is the brief summary of my work in the seventh week of GSoC period.
Last week, we found a solution for matching `exp` as `Pow`. This week major part was spent in testing exponential rules. Here are some problem faced.
1. UnevaluatedExpr is quite untested and results in recursion errors in many places. like `u = UnevaluatedExpr(E)` now when we want to find imaginary and real part of `u`, using `im(u)`. It causes recursion error. There were other instances too. So in those functions, I replaced them back to `exp`.
2. There was a lot of index error because length of args of a `Pow` object is 2. Whereas for `exp` it's 1. Utility functions used in lot of places `.args[1]`. I found all possible places where arguments of a `Pow` object was accessed using `.args[0] and .args[1]` . I replaced them with `.base` and `.exp`. This solved the problem
There were more minor changes in many utility functions. Currently, I have finished the exponential testing and almost all are pas…

GSoC 2018: Week 6

Here is the brief work done for rubi in the 6th week of GSoC period.

Last week almost 70 % of the miscellaneous algebra was tested. In the start of the week, the miscellaneous algebra testing was completed. The miscellaneous algebra test cases have been pushed in this PR.

After this, I moved on to load exponential rules and test them. While loading the exponential rules, there were some parsing issues. Those were fixed. On start of the testing, it was found that some integrals depend upon the logarithmic and special_function rules. Those too needed to be loaded. There were some undefined or wrongly defined utility_functions like `CancelCommonFactors`, `Gamma (gammainc)`, `PolyGamma`, `ProductLog` and few more small functions. These didn't take much time. I fixed all these.
Soon I realised a major issue of `exp` and `Pow`. Sympy doesn't identify exp as Pow. The rubi rules are defined in such a way that exp needs to be realised as Pow. I tried to process an expression to replace e…

GSoC 2018: Week 5

Hello everyone. Here is the brief summary of my work in the 5th week of GSoC period.
I started this week with testing miscellaneous algebraic test cases. Soon it was found that most test cases depend on rules of `Miscellaneous integration`. So I loaded those rules. There were few new structure in constraints. So parser too was updated for incorporating those. 
While testing, `ExpandIntegrand` did not function well. Matcher used in ExpandIntegrand was of sympy. I changed ExpandIntegrand using replace_all of matchpy. In few more functions I changed the structure using matchpy. In this week, a major part of the time was spent in utility functions. There are many changes. Also some of the test cases of last year was wrong. It gave different result in mathematica. The test cases which I have updated matches with Mathematica's output. I have pushed all changes of utility function in this PR.
Parallely I have also tested around 70 % of miscellaneous algebraic. I will complete the testing…

GSoC 2018: Week 4

Hello everyone. Here is the brief work done in the 4th week.

In this week I have completed the testing of trinomial products. There are around 2700 test cases. I have tested them all in sympy. I have updated the PR .

Currently, a few tests are failing because of 2 major issues :
Apart - Some features are unimplemented in apart of sympy. So expressions are not simplified.appellf1 - There is a missing implementation of appellf1 in sympy. If the above two issues are solved, almost all tests will pass.
Utility functions have been improved a lot this week. The is_polynomial of sympy has certain issues and so the constraints were affected. I have re-written PolynomialQ. It is not full proof, but it handles most of the cases. There are many small changes in utility functions. They can be seen in the PR.
I am lagging behind my proposed timeline. But the work in rubi is time-consuming. When a test fails, finding the same rule in Mathematica, finding whether all constraints return the same result…

GSoC 2018: Week 3

Hello everyone. Here is the update of my work in the third week of GSoC. 
Unlike last week, this week clarified some of the real problems of our implementation of rubi. I began to freshly test trinomial products after getting the older test-suite. 
Initially, I came across the problem of Coeff and Sum. I solved this by redefining Coeff and introducing a function Sum_doit. After this, I realised With statement was not being parsed correctly for many cases. Parsetools was improved to take care of the with statements.

After this, I encountered with some utility functions where the output was not as expected. This is the major cause of the failing tests. Constraints too are affected by this. I tried to find and solve as much as possible. I have to trace all functions in cases of failing tests and compare the output with Mathematica. I improved few utility functions and updated in the PR. Also, there were some exceptions in Matchpy, where constraints were being checked taking x as a numerical …

GSoC 2018: Week 2

Hello everyone. Here is the brief work done and progress in my project (Rubi) in the second week.
This week was quite frustrating for me. I gave a lot of time but the outcome was little less. Initially my aim was to solve the problem of the order in which rule was matched. But I have to revert back to my initial structure as the new structure was extremely time consuming. Next I thought to keep track of the rules applied to an expression. This could be a great help in debugging too. So I implemented it.
Next I moved on to testing trinomial_products . But here also results were not good. Our rules are of older version (4.10.8) , but we did not have the test-suite of that version. So I tried extremely hard to test those tests with rubi 4.10.8 . For 3 - 4 days , I put a great effort. At last I realised, things will not work this way. So, I then mailed to Albert, the maintainer of original Rubi, asking him for the test-suite of older version. And the good part is that he has provided me the…

GSoC 2018 : Week 1

Hi everyone. Here is the brief summary of my works completed and works which are in progress in the first week.
For proper implementation of RUBI in sympy, we have a high dependence on matchpy. This might limit the performance of RUBI in sympy. I am currently targeting to have a correct set of rules and utility functions. 
This week I opened this PR #14724,  from which progress in my work can be tracked. While testing the code, sometimes there were recursion errors because the same set of rule continuously were applied to the expression and there was no simplification. This worked in Mathematica because a order of matching(specificity order) is maintained in Mathematica. We use downvalues to parse the code in matchpy format. So we know the order. I found a way to fix the order in matchpy. I used ManyToOneMatcher to find all rules being matched to an expression. Then pickup the most prior rule and then perform replacement. It is little slow but we can debug our rules (parsetools) and uti…

GSoC 2018: Proposal Acceptance and Community Bonding Period

Hello, I'm Ashish Kumar Gaurav a undergraduate student at Indian Institute of Technology, Kharagpur. My proposal for completing rule based integration(RUBI) in sympy has been accepted as a part of Google Summer of Code.

RUBI consists of about 10,000 rules. Sympy can use these rules rather than various algorithms to perform efficient integration. RUBI had been a GSoC project last year but it could not be completed. I hope that I will be able to bring RUBI in a working state.

Community bonding period is near end and coding period will be starting on 14th May. In this period I have done the following improvements: Fixed a bug in parsetool, which raised exceptions while sympifying the code.Removed repeated definition of same constraints. All constraints are present in a single file , in which each constraint is defined uniquely. Earlier same constraints were defined multiple times. An issue had also been created here.Removed dependencies of lambda function from constraints…