GSoC 2011 Application Yuri Karadzhov - sympy/sympy GitHub Wiki

Title: SymPy: Implementation of Parametrization module, Symmetry search and handle module.

Student: Yuri Karadzhov

Abstract: Computer algebra systems (CAS) for professional mathematicians and physicists mostly serve as a tool for handling simple yet technically complex problems. Sure, it can solve some problems entirely from the start till the end, but the main purpose of using CAS is to simplify our daily routine. So the goal of my project is to improve the base of Sympy. This will significantly reduce the amount of repeated and cumbersome operations and serve as base for other more complex and specific tools. For me this tools are – parametrization (that helps solve ODEs and PDEs depending on arbitrary parameters) and concerned problem of searching and handling symmetries of single ODE or PDE or system of such equations.


Table of Contents

Personal info

Name and Contact Info

Name: Yuri Karadzhov

Gmail and GoogleTalk: [email protected]

IRC: yuri-karadzhov on freenode

Skype: kara-ya

Mailing List: Parametrizator or Symmetries

Education

Current:

  • PhD student in Applied math department of the Kiev Institute of Mathematics, National
Academy of Science, Ukraine.

Former:

  • MS of Mathematical Physics and Computer Sciences in Mechanic-Mathematical faculty of the Kiev National Tars Shevchenko University (honours degree).
  • BA of Mathematical Physics and Computer Sciences in Mechanic-Mathematical faculty of the Kiev National Tars Shevchenko University (honours degree).

Current research and background

Background which might be helpful: Computation Theory, Algebra, Mathematical and Functional Analyses , Theoretical Physics, Quantum Mechanics, Integral Transformations, Special Functions, Differential Equations, Mathematical Physics, Supersymmetries and Symmetries Analyses.

Currently I'm studying the theory of Lie groups and its application to the differential equations at the applied math department. My most recent works are however concerned with supersymmetry of Schrödinger-Pauli equation of arbitrary dimension. The obtained results widely extend the number of exactly solvable Quantum Mechanic problems as well as generalize the approach of finding such problems.

Technical background & Programming experience

I've bin using GNU Linux since 2001. It is my only operation system for the last five years. I worked with Mandrake, Red Hat, Gentoo, Debian. Now I use Kubuntu as it is simple to configure and up to date. I used to work as a system administrator, so I am familiar with sh.

Programmer experience:

  • Professional:
    • Java EE, JDBC, JavaScript (ExtJs) – Summer work in Global Logic (2010)
    • Java SE – Institute project: Partial TeX translator for SIGMA journal (2009)
    • APL – Simcorp LLC (2008-2009)
  • Academic:
    • C/C++, Python – writing labs in University
    • Scala – experimenting with Processing
I have experience with SVN, Hg.

IDE: Eclipse, Netbeans, IDLE

Mathematical Software

I have good knowledge of

  • Maple
  • Mathematica
tried to use
  • Sage and Maxima
I completed the desired functionality as Maple Library and now porting it to Mathematica.

Project Motivations & Expectations

The main reason I applied to this project is to invest in the base of the sympy. This will help improve more complex functionality which I need in my research. I expect to continue my work on sympy after the end of the project, especially on differential and Lie modules, they are of great interest to me. This is why, after my work on SSQM is complete I will recalculate and correct Amaldi classification, incomplete version of which is used in Maple to solve systems of ODEs and PDEs.

Project Goal

Parametrizator

The project itself includes many steps, but the main goal is to implement parameter checking functionality (the idea is original and has no realizations in any other CAS).

e.g. Bernoulli differential equation dependent on parameters

f ' (x) = af 2(x) + b

has different solutions depending on parameter values

  • f(x) = C1 if a = 0, b = 0
  • f(x) = bx + C2 if a = 0, b ≠ 0
  • f(x) = 1/(C3-ax) if a ≠ 0, b = 0
  • f(x) = sqrt(b/a) tan( sqrt(ba) (x + C4)) if a ≠ 0, b ≠ 0
where Ci - integration constants.

The other example of a parameter dependent answer is a matrix rank.

e.g. Assume that we have a matrix dependent on parameter

A = Matrix((1, x),(1, 1))

this matrix has different rank depending on parameter x

  • rank(A) = 2 if x ≠ 1
  • rank(A) = 1 if x = 1
So if we use Cramer method of finding rank we can note that det(A -1) has infinite value at x = 1

So high level function casemap should be implemented to make this real. And we will be able to write

>>> casemap(dsolve, diff(f(x),x)==a*f(x)**2+b, (a, b))  # parameter-wise solution of given ode
(C1, (a==0, b==0))
(bx + C2, (a==0, b!=0))
(1/(C3 - ax), (a!=0, b==0))
(sqrt(b/a) tan(sqrt(ba) (x+C4)), (a!=0, b!=0)))

or for rank calculation

>>> casemap(det, inverse(A), (x)) # parameter-wise determinant calculation
(1/(1-x), (x!=1))
(infinity, (x==1)) 

Symmetries

The problem of searching symmetries of a differential equation (system of equations) partial and ordinary is the fundamental problem of analysis of differential equations. Assuming that we know symmetries of DE we can reduce its order or even completely solve it, reproduce its solution and give some predictions about asymptotic behavior of solutions. Implementation of symmetries module leads to a common integration procedure (by Lie) which significantly improves the ODE module.

Of course, the problem of finding symmetries includes the problem of integration of overdetermined system of DE's at the last step, which is huge and resource consuming (and Gröbner basis implementation is required, at least). Nevertheless it is usually easy to solve without a computer.

The huge routine part is obtaining the system of determining equations. So the goal of the project is to present tools to handle this problem:

  1. Generate infinitesimal operator for given variables
  2. Calculate the extension of infinitesimal operator of given order
  3. Calculate a differential sequence of given equation (system of equations)
  4. Apply the infinitesimal operator to the equation (system of equations)
  5. Obtain a system of determining equations
  6. Obtain a system of determining equations for a classification problem
The classic example for Heat Equation
>>> u = Function('u')(t,x)
>>> eq = diff(u,t)-diff(u,x,x)
>>> infinitesimal(eq)
tau(t,x,u)dt+xi(t,x,u)dx+eta(t,x,u)du
>>> deteq(eq) # Obtaining system of determining equations
diff(tau,u,u)==0
2*diff(xi,u)+2*diff(tau,x,u)==0
2*diff(tau,u)==0
2*diff(tau,x)==0
diff(tau,x,x)-diff(tau,t)+2*diff(xi,x)==0
diff(xi,u,u)==0
2*diff(xi,x,u)-diff(eta,u,u)==0
diff(xi,x,x)-diff(xi,t)-2*diff(eta,x,u)==0
diff(eta,t)-diff(eta,x,x)==0

Project Plan

Main Functionality

Parametrizator

  • Two versions of a singular function should be implemented. This functions should
return values of parameters that makes given expression singular. The first one should work only with one parameter and the second one - with several.
>>> singular(tan(c)*y/(b*(a+x)),(a,b,c)) # searching for singular points of expression
(b==0),(c==Pi/2+Pi*N_1)
  • Implement a function set that can handle different cases. Produce all different cases from the given ones, intersect cases and so on.
  • Implement parametrizer casemap that does the required operation
parameter-wise (see examples above)

Symmetries

  • Implement a generation of infinitesimal operator for given variables
  • Implement a calculation of the extension of infinitesimal operator of given order
  • Implement a calculation of a differential sequence of the given equation (system of equations)
  • Implement a function that applies the infinitesimal operator to the equation (system of equations)
  • Implement obtaining of the system of determining equations

Additional Functionality

Parametrizator

  • Implement a function that returns minimal list of linearly independent functions form given ones.
>>> linind(cos(t+1), sin(t), cos(t))
(sin(t), cos(t))
  • Implement functions that will help collect similar members of
an expression containing functions and to gather coefficients of linearly independent members.
>>> collect(x*(a+b*y+sin(y))+y*(c+3*x+x^2)+x*sin(y+3)+x*cos(y)+f(x,y,t), x)
a*x+(b+c)*y+3*x*y+x^2*y+(1+cos(3))*x*sin(y)+(1+sin(3))*x*cos(y)+f(x,y,t)
>>> coeffs(x*(a+b*y+sin(y))+y*(c+3*x+x^2)+x*sin(y+3)+x*cos(y)+f(x,y,t), x, o)
[a, b+c, 3, 1, 1+cos(3), 1+sin(3), 1]
>>> o
[x, y, x*y, x^2*y, x*sin(y), x*cos(y), f(x,y,t)]
  • Improve singular and casemap functions to be able to handle more complex cases e.g. 1/(a+b*x)
>>> singular(1/(a+b*x), (a,b))
(a==0, b==0)

Symmetries

  • Adapt main functionality to a classification problem

Future Extensions

Parametrizator

  • Add case recognition depending on >, < (in real domain).
e.g. tanh(a(x+b))-> 1, b -> infinity if a > 0

and tanh(a(x+b))-> -1, b -> infinity if a < 0

or an example of integration of real functions:

integrate(1/(x**2+a))

is equal to atan(x/sqrt(a))/sqrt(a) if a > 0

and -atanh(x/sqrt(-a))/sqrt(-a) if a < 0

so the answers are real if a is real.

Symmetries

  • Create pde module which will be able to solve systems of PDEs
  • Add ability to solve overdetermined systems of PDEs
  • Add ability to find symmetries of ODEs and PDEs
  • Classify obtaining algebras

Schedule

Before the beginning: I completed solutions for issue 2238, 2246, 2250. I will end up with issue 2249. Also I will create simple PDE module (to solve simple PDEs).

  • Phase 1 (May 23 - June 27): Main functionality (two versions of singular function, start working on case handle function, generation and extension of infinitesimal operator, calculation of a differential sequence).
  • Phase 2 (June 27 - July 15): Main functionality (finish case handle function, work on casemap function, apply infinitesimal operator to the equation, obtain the system of determining equations).
Midterm Evaluation
  • Phase 3 (July 15 - August 5): Additional functionality (linear independent functions, improvement of casemap, classification problem).
  • Phase 4 (August 5 - August 22): Final tests and documentation (classical examples will be checked in tests, documentation will be created).
Final Evaluation

References

  1. Symmetries of differential equations
  2. Symmetry in physics
  3. Lie group
  4. Lie algebra
  5. Peter J. Olver, Applications of Lie groups to differential equations
⚠️ **GitHub.com Fallback** ⚠️