GSoC 2016 Application Anish Shah: Assumptions - wrat/sympy GitHub Wiki

About Me

Basic Information

Personal Background

I am Anish Shah, a fourth-year undergraduate student at VJTI, Mumbai, India. I am pursuing a degree in Information Technology (B.Tech.). I have taken courses like Linear Algebra, Calculus, Discrete Mathematics, Data Structures and Algorithm, Operating System. These courses have been helpful while contributing to SymPy.

Programming Details

Platform & Editor

I work on Ubuntu 15.10 and Atom is my primary editor. I like Atom because it has a built-in package manager and git integration. Built-in package manager provides packages that add new features to Atom. I have been using Git for quite some time while working on open source projects and projects for my courses. Git integration in Atom helps a lot as all my software development tools are in one place.

Programming Experience

I started learning to program in 2010 with C and C++. Then, I got introduced to Python in 2012 during my first year of undergrad. Since then I have used Python for my course projects and during my internships. I have interned at three startups based out of Mumbai (India) where I have used Python extensively for building their products. I interned at Amazon.com (Hyderabad, India) last summer where I used Java. TODO: ref

Python & SymPy

Python provides a lot of libraries out of the box. My favourite features are:

  • unittest - It provides a base class, TestCase which can be used to write tests easily.
  • PEP 0008 - Style guide for Python Code to improve code readability.

The first thing that I came across when I used SymPy was simplify function. When I first learnt Algebra or Trigonometry in school, we used to have questions about simplifying expressions. Those questions can be solved using just two lines of code with the help of simplify function.

In [1]: from sympy import *

In [2]: from sympy.abc import x

In [3]: expr = (cos(x)-1)/sin(x) - sin(x)/(cos(x)-1)

In [4]: simplify(expr)
Out[4]: 2/tan(x)

In [5]: numer = 1 - 9/x**2

In [6]: den = 1 + 5/x + 6/x**2

In [7]: simplify(numer/den)
Out[7]: (x - 3)/(x + 2)

Contribution to SymPy

I started contributing to SymPy in January 2016 and here is the list of all the merged and unmerged pull requests in chronological order:

TODO: Summary of PR

  • (Merged) apply inverse() in simplify #10491
  • (Merged) add zeta function to Sum #10524
  • (Merged) Simplify FiniteSet in ConditionSet #10580
  • (Merged) (t**n).is_algebraic returns None when t is transcendental #10605
  • (Closed) assumptions that are wrong in master #10616
  • (Closed) fix in assumtions - addition of infinite terms #10627
  • (Unmerged) Q.hermitian/Q.antihermitian for matrices #10652
  • (Merged) sympify(set) gives FiniteSet #10657
  • (Unmerged) Assumptions: Symmetric handlers for actual matrices #10704
  • (Unmerged) assumptions for MatrixElement #10736
  • (Merged) Remove Support for Python 2.6 and 3.2 #10778

During the discussion on PR#10657, we came across a bug and a new requirement for which I opened two issues:

  • hash(Rational(a, b)) should be equal to hash(S(Floating point number)) #10675
  • sympify(dict) should give Dict #10726

The Project

Overview

TODO

Plan & Execution

  1. Remove inconsistencies between new and old assumptions.

    In [1]: from sympy import *
    
    In [2]: ask(Q.real(oo))
    Out[2]: False
    
    In [3]: oo.is_real
    Out[3]: True
    
  2. Old assumption should call the new assumption internally.

  3. New assumptions

    • functions
    • matrices
  4. Improve refine

Timeline

** Pre GSoC**

Merge open pull requests

Community Bonding

facts for new assumptions remove inconsistencies refine

Week 1, 2, 3

remove inconsistencies add tests

Week 4, 5, 6

call new assumptions inside old assumptions check fail tests add new tests add benchmarks

Week 7, 8, 9

facts for assumptions implement assumptions for functions tests implement assumptions for matrices tests

Week 10, 11, 12

improve refine documentations

Notes

  • I have no other plans for summer and I can contribute full-time for 40+ hours per week.

  • I'm in the final semester of my college which ends on 15th May. I have no other commitments till October 2016. So, I would work on my projects even after GSoC period.

References

[1]. GSoC 15: Improving Assumptions

[2]. S.Zero.is_imaginary should be True

[3]. Proof of concept for the new assumptions

[4]. Proof of concept: new assumptions check old assumptions for Symbol

[5]. Add symbol's assumptions to the global_assumptions context

[6]. Assumptions (wiki)

[7]. Since new assumptions refine is horribly slow (2000x slower) #9714

[8]. Proposition: assumptions for functions #8760

[9]. New (definite-related) assumptions for matrices #8803

[10]. No way to set assumptions on matrix symbols #10265

[11]. Assumptions: Symmetric handlers for actual matrices #10704

[12]. Q.hermitian/Q.antihermitian for matrices #10652

[13]. Documenting (new) assumptions #2538