GSoC 2016 Application Sanya Khurana:Implementation of multiple types of coordinate systems for vectors - sympy/sympy GitHub Wiki

Personal Information

Name: Sanya Khurana

Email: [email protected]

University: Indira Gandhi Delhi Technical University for Women

Github username: sanyagithub

Website : www.sanyakhurana.com

Country of residence: India

Timezone: IST (GMT +5:30)

Primary language: English

Short Bio

I am Sanya Khurana, currently pursuing Masters in Computer Science ( Second Year ). I completed my graduation in B.Sc(H) Computer Science from University of Delhi. I have experience in creating Android/iOS Applications and Web Applications. I am the Founder and Chapter Leader of Lean In India. "Lean In" is an organisation founded by Sheryl Sandberg, COO of Facebook which aims to empower women towards their ambitions. I am a mentor in "Learn IT, Girl" Organisation - A global mentor-ship program for women around the globe to learn a programming language of their choice. This is my first effort to contribution to an Open Source project as I am a newbie to Open source community.

Programming Experience

I am currently working on MAC OS and I use Sublime Text 2. I like working on Sublime Text 2 mainly because of its User Interface and functionalities. It is simpler to use than many other editors. I believe good UI is very important for a coder to work efficiently.

I started coding during my graduation, freshman year. I have created many Android and iOS Applications like Childhood Epilepsy Detection Tool, ( Android Version ), What would you do if you weren't afraid? and Im4Change . I also created a Student Feedback System for my Campus recently. I am currently working on a Mobile Application Girl-Gorithm that teaches basics of Algorithms and Data Structures to high-school girls to encourage Computer Science Adoption amongst girls. During my graduation I did some Mathematical courses like Calculus and Matrices, Calculus and Geometry and Differential Equations.

I started learning Python 6 months ago and simply fell in love with the language. Before python, I worked in Objective C, Java, C/C++, PHP, JavaScript and HTML. I like Python because of its easier syntax and shorter code ( compared to other languages I worked on ). The language is intuitive and easy to learn. It takes lesser time and code to create a functionality in Python. I was introduced to Sympy and Open Source at the same time and was thrilled to know that I can contribute to this Computer Algebra System. This is the first Open Source I have contributed to and it was a great learning experience already. I love all the features of Sympy but my favourite ones are : the printing module, plotting module and the vectors module.

>>> from sympy.plotting import plot3d

>>> x, y = symbols('x y')

>>> plot3d(x*y, (x, -5, 5), (y, -5, 5))

>>> from sympy import jscode, symbols, Rational, sin, ceiling, Abs

>>> x, tau = symbols("x, tau")

>>> jscode((2*tau)**Rational(7, 2))

'8*Math.sqrt(2)*Math.pow(tau, 7/2)'

>>> jscode(sin(x), assign_to="s")

's = Math.sin(x);'

Contribution to Sympy

(Issue) sympify evaluates Div Operation in case of Unary Operator when evaluate = False

(Merged) Fixes Issue #10773 and #10560

(Closed) Fixing sympify (evaluate = False) for Unary Operators - Issue #10560

(Unmerged) Fixed Issue UserWarning plot3d #10612

Project

I plan to give 6 hours a day to the project and I do not have any prior commitments.

Idea

Sympy currently implements only Cartesian Coordinate System. The ideas of this project is to change the vector class such that it has the base class - Orthogonal Coordinate System and their subclasses which are various Coordinate Systems and implement their functionality like - Vector Algebraic Operations and Vector Calculus. We also need to write functions to convert the coordinates from one Coordinate System to another.

We can implement Vector Algebraic/Calculus Operations in 2 ways -

First Way - Convert every Coordinate System into Cartesian System and then compute the operation. In this way, the function has to be rewritten for each Coordinate System.

def class SphericalCoordSys(Vector):

def SphericalSysdot(self, other):

v1 = convertCartesianSys(self)

v2 = convertCartesianSys(other)

return v1.CartesianSys(v2)

Note : This is not the exact code that would be written - just a pseudo code to explain the logic.

Second way - Write generic functions in the super class which can be implemented by each coordinate system.

def class Vector(BasisDependent):

def dot(self,other,angle):

return self*other*cos(angle)

Note : This is not the exact code that would be written - just a pseudo code to explain the logic.

Timeline

Community Bonding Period

I will use this time to revise my Mathematical Skills and prepare a more detailed schedule. I will use this time for investigation. I will not be able to contribute much ( as far as coding is concerned ) because of my University Semester Exams during that time.

23rd May - 27th June

Basic Implementation and Functionality

  • Change the current Vector Class

  • Implement subclasses -

    • Cartesian Coordinate System
    • Cylindrical coordinate system
    • Spherical coordinate system
    • the rest of the systems only if time allows
  • Implement functionality for each class-

    • Unit Vector
    • Base Vector and Vector Components
    • Addition/Subtraction
    • Scalar Multiplication
    • Dot Product
    • Cross Product
    • Triple Product
    • Triple Vector Product

for all Orthogonal Coordinate Systems

20th June - 11 July

Test and Documentation

  • Write tests and documentation for all the work implemented.

11 July - 15th August

Vector Calculus

  • Implement Vector Differentiation Operations like -

    • Gradient - Measures the rate and direction of change in a scalar field.
    • Curl - Measures the tendency to rotate about a point in a vector field.
    • Divergence - Measures the scalar of a source or sink at a given point in a vector field.
    • Vector Laplacian - Measures the difference between the value of the vector field with its average on infinitesimal balls.
    • Laplacian - Measures the difference between the value of the scalar field with its average on infinitesimal balls.
  • Implement function to convert from one Coordinate System to another

15th August - 23rd August

Finalizing the Code

  • Fixing bugs
  • Writing rigorous tests
  • Finalizing documentation

References

https://en.wikipedia.org/wiki/Orthogonal_coordinates http://emweb.unl.edu/Math/mathweb/vectors/vectors.html https://en.wikipedia.org/wiki/Vector_calculus http://math.oregonstate.edu/home/programs/undergrad/CalculusQuestStudyGuides/vcalc/vcalc.html