GSoC 2017 Application Bhavishya : Efficient Equation of Motion Generation - sympy/sympy GitHub Wiki

Personal Background

Contacts :

  • Name : Bhavishya
  • University : Indian Institute of Technology, Kanpur
  • Branch : Computer Science and Engineering
  • Position : Freshman
  • Email-Id : [email protected]
  • Github:@bhavishyagopesh
  • Gitter:@bhavishyagopesh
  • IRC(Nick,at freenode): bhavishya
  • Gitlab:@bhavish_grayhat
  • Phone:-9460790028
  • Blog : For maintaining log of my work.

About me

I am a Computer Science (C.S.E) Freshman at Indian Institute of Technology Kanpur,India.There is great tradition of FOSS at my college and which motivated me to pursue open-source development, and finally leading to G-SoC. It seems to me that I might do open source probably for my whole life-time.And GSoC could be my first big opportunity.The idea that code written by myself could be a part of industry(and hence could reach to so many users) intrigues me.

Why sympy

To achieve the aforementioned, I started looking out for organisations, and with sympy I got my perfect match.The versatility of sympy really struck me, it is capable of doing almost all the stuff that very heavy-weight software(like matlab,octave etc.) do.And another major reason for me choosing sympy has been Physics. Physics and open-source ,at the same time would be simply too much fun.

SKILLS :

  • Languages : Python, C, C++, bash, HTML(& CSS), javascript(beginner)
  • Tools : vim, git, github, cmake(c-Lion)
  • Frameworks : Django(beginner)(made a blog too),Docker(beginner),Kubernetes(beginner)
  • OS : Arch Linux,Mac -OS(Sierra),Ubuntu,CentOS

Achievements

Contributions to Open-Source :

  • To sympy :

PR made :

  1. #issue12300(merged)(PR)
  2. #issue11967(PR)
  3. #issue9506(merged)(PR)
  4. #issue11759(PR)
  5. #issue12354(PR)
  • To SymEngine :
  1. I'm working on CSE(Common Subexpression Elimination)#issue1219

Issues made :

1.#issue12425

  • To hyper -h2 : Wrote tests for hyper-h2-protocol stack.
  • To coala : Discussed various issues, wrote example bears and also contributed to documentation.
  • To Mailman : Read about internet protocols,RFCs and various implementations to solve security issues of Mailman(To generate encrypted lists,using python crypto libraries like OpenSSL).Also suggested various threat models and their remedies.Also deployed mailman on specific domain by using POSTFIX.Also deployed docker(containers) to test my code.

General Programming :

  • Linux : I am a linux junkie with experience with Arch Linux and various distros(ubuntu,CentOS etc.).I have also done LFS(Linux from Scratch,implementing and compiling all packages from scratch).
  • Recently made a package manager in python(used beautifulsoup,requests module) using Kahn's algorithm(for topsort) for my LFS project.
  • I made a student-search(totally in bash) for my college by scraping data from web.It had the all the details of a particular student even his photo displayed in the terminal itself.
  • Also wrote python-scripts that could communicate among themselves using zeromq thus playing passing the parcel game(pass nos. following Collatz Conj.).
  • Implemented MQTT script in Lua for creation of local network(using arduino and bluetooth module)
  • Have successfully completed/doing following CS, math and PHYSICS courses :
  1. C programming
  2. Calculus
  3. Linear Algebra
  4. ODE
  5. Electrodynamics
  6. Classical Mechanics

PHYSICS -specific :

  1. Got AIR(all india rank) - 169 in JEE Advanced(Entrance Test for getting admission to IITs)
  2. Got selected for INPHO(Indian national Physics Olympiad, path to IPhO)(top 1% in India)
  3. Cleared INAO(Astronomy olympiad,involved huge portions of classical mechanics)

Experience with Physics, Python and C++ :

  • Books Read (Core Physics) : Feynman Lectures,I.E Irodov, Krotov, Klepner ,David Morin, Griffiths.
  • For Python(following) : The hitchhiker's guide, official docs.
  • For C++(following) : Book from Bjarne Stroustrup.

Project Proposal :

Abstract :

To improve efficiency of EoM(Eq. of motion generation) by improving upon the sympy(mechanics package),refactoring code,profiling slow functions and implementing similar modules in C++(for SymEngine).Providing wrappers for(these modules in C++) ease of use in Sympy and reaching certain benchmarks(complex multibody problems in python for now.)

Overview :

Though Sympy is an amazing library but it lacks one very important feature --speed(explicitly when performing complex operations), but SymEngine(which is a C implementation of sympy) comes out to be a nice solution, but it still needs to implement the physics package(this project aims at building the mechanics package).At the end following is expected :

  • Profiling of slower-functions and implementation of their improved forms in sympy
  • Implementation of sympy.physics.vector and sympy.physics.mechanics packages equivalents for SymEngine
  • Testing of SymEngine to complete benchmarks setup(These are existing ones) but I intend to create new benchmarks in python.(May include multiple-body problems or any problems that at present are difficult to do with sympy or are time inefficient)

Implementation Timeline :

  • Pre- GSoC(present - May4) :

Increasing Acquaintance with SymEngine and cmake(Already started with on various issues with isuruf).Deciding upon the order of implementation of various modules to be implemented in SymEngine(for example,to increase my acquaintance,I started with CSE(Common Subexpression Elimination) implementation for Symengine.) and hunt for slower functions in mechanics package in sympy.Discussion with mentors,to weed out any conflicts that may arise in implementation of proposal.Also deciding upon a more stringent workplan.

  • Community Bonding Period(May4 - May30) :

Start code refactoring and under constant vigil(of mentors), implement fixes along the way, Performing speed-tests to find slower functions and, if possible, replace them(or at least perform simplifications over them).Complete the python refactoring part and start implementation for SymEngine.

  • Phase - I :

  1. Week1(May 31-June 6) :

  • Implementation of basic data types like ReferenceFrame(CoordinateSystem),dynamic_symbols etc. This would be followed by implementation of following curl,divergence,gradient,scalar_potential,scalar_potential_difference. I think, I would create similar objects in c++, define the corresponding methods.And now we could move to more complex types like Dyadic(complex as it involves tensors and tensor products),orient angular variables etc.
  1. Week2(June 7-June 13) :

Completion of implementations of functions and classes(physics.vector module). If everything's on track, by this week the whole vector module would be completed.Also the whole module needs to be documented(I have used sphinx till now,but the tool could be discussed in bonding phase.)

  1. Week3(June 14-June 20) :

Start implementing various data types in mechanics module which would be :

  • Mass
  • Particle
  • Inertia
  • Rigid Body
  • Dyadic
  • Linear Momentum
  • Angular Momentum
  • Using momenta functions in Mechanics
  • Kinetic Energy
  • Potential Energy
  • Lagrangian All these would be straight implementations of already existing types.
  1. Week4(June 20-June 26) :

Complete addition and also start working on functions(present in function.py,since earlier on, the code was refactored and improved upon)now the implementation would mostly follow already existing python implementation.Document everything done till now, submit report for Phase I.

  • PHASE II :

  1. Week5(June 27-July3) :

Complete any function implementation left.Implement Kane’s Method & Lagrange’s method and also the linearization module.So the present algorithms(are appropriate and since have been improved upon in bonding period and python code improvement period) on lines of sympy would be implemented.

  1. Week6 (July 4-July 10) :

Implement various constructs like rigid-body, finally completing the systems package.For example,The sympy docs have got a portion dedicated to potential issues with linearization, similar realisations could be achieved for symengine, if tests are also written(not very exhaustive though,since would take much time,but a reasonable standard which could be decided upon during community-bonding.)

  1. Week7(July 10-July 17) :

Try to complete the tests by this week.Also since a reasonable amount of code would have added by then, thus start benchmarking of code(this could help in achieving those realisations pertaining to speed.)

  1. Week 8(July 18-July 24) :

This would be a buffer weak.Documentation for whatever done till now also submit report for PHASE -II.

  • PHASE III :

  1. Week9(July 25-July 31):

Tests need to be written for everything done till now also initiate implementing wrappers for the code which is tested till now.One very important aspect(which enormously increases the ease in use of symengine) is wrappers. As proposed earlier, wrappers for the new modules added needs to be implemented in python.

  1. Week10(Aug 1-Aug 7):

Test to be written in python for complex multiple body systems, and appropriate corrections to be made. Also the work for wrappers should approach completion.Prepare for merge.

  1. Week11 & 12(Aug8-Aug 21):

Firstly the whole implementation should reach the benchmark fixed earlier on.Also tests for wrappers constructed.Running travis CI and improving upon anything thats broken. Secondly documentation to be given the final shape. Ready for merge. Prepare for final project report. Finalising the project and submission of the final project report which would include my contribution and what else could be done in coming time(may be for future G-SoCers). Also if something offtrack happens it needs to get fixed during this duration And at last push the changes.

Post - GSoC :

I would like to explore the complex mathematical portions of sympy and as I read more about Number Theory, Combinatorics and Graph Theory, would contribute in that domain too.Though I haven't done much Machine Learning till now but I would love to work on incorporating some kind of ML API in sympy.Also I'll be maintaining a blog to help for future G-SoCers. I would also like to participate in various events organised by sympy.

NOTE :

  • The timeline proposed would be flexible(I'll try hard to finish work before the committed dates so that I could document(which is a weak link in symengine currently) and test everything properly.)
  • Also I dont have any commitments During this summers and I can give any amount of time(humanely possible) to complete this project.