GSoC 2017 Report Szymon Mieszczak: Implementation of multiple types of coordinate systems for vectors - sympy/sympy GitHub Wiki

This page summarizes the work which I've done this summer.

About me

My name is Szymon Mieszczak and I'm master student at Adam Mickiewicz University in Poznań, Poland.

The goals

The aim of my work was to introduce different kind of orthogonal curvilinear coordinate systems to vector package in SymPy. Previously coordinate system could be only rotated or/and translated with respect to other coordinate systems.

My work can be split into tasks. I shortly described everyone and made a lists with pull requests which are dealing with them.

Differential operators

The work here concerns two things. Firstly, we need to calculate correctly gradient, curl, and divergence in different types of orthogonal curvilinear coordinate systems. We used here Lame coefficients which are obtained from transformation equations. Secondly, we can deal here with complex expressions which depends on many coordinate system so product rules for differential operators needs to be considered. We also introduced unevaluated expression for vector products and differential operators because sometimes it's not possible to determined exact value of expression.

  • #12696 Create operators.py file
  • #12720 Introducing curvilinear coordinate system in Vector module
  • #12737 Differential operators handle different type of coordinate systems.
  • #12749 Move calculation from Del class to gradient, curl, divergence
  • #12987 Add classes Dot, Cross and functions cross, dot
  • #12991 Reconstruction of directional derivative
  • #13069 Use det from matrices module instead of inner code in vector module.
  • #13118 Mixed coordinates for gradient
  • #13128 Mixed coordinate system for divergence
  • #13154 Mixed coordinate system in curl

Introduction of transformation equations

Several new methods were added to CoordSys3D which are calculating transformation equations from rotation matrix and location vector, but also calculate inverse transformation equations. There are also methods which store informations about curvilinear coordinate systems, so user can just type coordinate system which are interested in without knowledge about transformation equations.

When we connect more than two coordinate systems we need to also take care about composition of transformation equations.

CoordSys3D constructor were modified to keep information about transformation equations and Lame coefficients. New parameter were add, transformation, which allows us to set any supported transformation(rotation, translation, and new ones). This parameter is used in whole package insead of rotation_matrix and location. It makes the code much more consistent.

express is a method which recalculates expression from some coordinate system into other coordinate system. This function were modified to support new types of transformations.

  • #12803 Add transformation equations to CoordSysCartesian.
  • #12829 Change class name from CoordSysCartesian to CoordSys3D.
  • #12872 Inverse transformation equations
  • #12882 Checker functions for orthogonality of coordinate system
  • #12916 Clean up in CoordSys3D
  • #12960 Add transformation equations for rotation matrix
  • #13034 Add method for inverse rotation matrix.
  • #13040 Add _translation_trans_equations method.
  • #13056 Reconstruction constructor in CoordSys3D
  • #13172 Add transform_to method to CoordSys3D
  • #13186 Constructor fix
  • #13191 Express in vector module

Tests and documentations and others

I systematically updated documentation. I also add pretty and LaTeX printing for newly created objects, like unevaluated Curl, cross etc.

  • #12871 Update documentation
  • #13013 Replace CoordSysCartesian by CoordSys3D
  • #13096 LaTeX and pretty printing in vector module
  • #13180 curvilinear coordinate system in documentation

Further work

Not everywhere transformation is used instead of rotation_matrix but it's rather small amount of work here. New functionalities should be also more intensively tested to find every possible problems. I think that bugs somewhere can still exist.