GSoC: Week 2 Begins

First, I am going to talk about what has been done since last week. I implemented methods to find a recurrence relation in the coefficients of Power series expansion of a Holonomic Function, and then method to find the Power series.

One of the many interesting properties of Holonomic Functions is that the coefficients in Power series expansion of a Holonomic function is a Holonomic sequence, i.e. these coefficients satisfy a recurrence relation having polynomial coefficients.

This recurrence relation can be used to efficiently calculate the coefficients of Power series. The PR 11153 had these methods and got merged today. Here are a couple of examples of the implementation.

In []: p = HolonomicFunction(Dx – 1, x, 0, [1])  # exp(x)
In []: p.to_sequence()

Out []: HolonomicSequence((-1) + (n + 1)Sn, n), u(0) = 1

In []: p.series()

Out []: 1 + x + x**2/2 + x**3/6 + x**4/24 + x**5/120 + O(x**6)

For this week it is planned first to implement a method to numerically integrate differential equations of holonomic type from any point x=a to x=b in the complex plane. The next thing to implement after this would probably be converting symbolic functions/expressions to Holonomic Functions.

Cheers and Happy Coding.

Advertisements

GSoC: First Week of Coding Phase

Since my last blog post I have opened two new PR’s for the Project. We’ll see what they do and discuss the goals of this week.

A major issue in the first PR was the slow performing algorithms, a consequence of using recursive expressions internally. Most of the algorithm implemented used matrices module to solve the linear system which doesn’t support DMP and DMF objects.

So I defined a new class subclassed from MutableDenseMatrix and changed some methods to make it work with Polynomials and Fractions and used this to use Polynomials internally. Thanks to Kalevi for this idea. It works much more robust now. I have also added methods to find composition of Holonomic Functions and converting a Hypergeometric Function to Holonomic. These things are added in this PR. I hope the PR gets merged in a couple of days.

A new PR was opened for features relating to recurrence relations in coefficients of Power Series expansion of Holonomic Functions. The first thing I did was defined a class RecurrenceOperator parallel to DifferentialOperator to store the recurrence relation.

Goals of the Week:

In this week, I have planned to define a function to find the Recurrence Relation of series coefficients and then go for numerical computation of Holonomic Functions. Let me know If anything else should be implemented first as I haven’t discussed this with mentors yet.

The chronology might be different from what I wrote in the Proposal but we are quite ahead of that.

Cheers Everyone.

GSoC: Community Bonding Period

The 4th week of Community Bonding Period is about to kick off. I am here to write about what I’ve done so far and my goals for next week.

The first PR for the project “Implementation of Holonomic Function” got merged today. This adds following functionality in SymPy.

  • Differential Operators with Polynomial Coefficients and operation like addition, multiplication etc.
  • Holonomic Functions. A representation of Holonomic Functions given its annihilator and Initial Conditions (optional).

A little about the API to get you an idea of this.

>>> from sympy import *
>>> from sympy.holonomic import HolonomicFunction, DiffOperatorAlgebra

>> x = symbols(‘x’)
>>> R, Dx = DiffOperatorAlgebra(ZZ.old_poly_ring(x), ‘Dx’)

>> Dx * x
(1) + (x)Dx

>>> HolonomicFunction(Dx – 1, x, 0, [1]) + HolonomicFunction(Dx**2 + 1, x, 0, [0, 1])
HolonomicFunction((-1) + (1)Dx + (-1)Dx**2 + (1)Dx**3, x), f(0) = 1, f'(0) = 2, f”(0) = 1

Operations supported for Differential Operators are addition, multiplication, subtraction and power. Holonomic Functions can be added and multiplied with or without giving the Initial Conditions. Special thanks to OndrejKalevi and Aaron for all the help, suggestions and reviews.

What Now?

Now the goal is to use Polynomials and Fractions i.e. instances of DMP and DMF classes instead of expressions for all the manipulation done internally. This is necessary for robustness. After that is done I work on to implement conversion of Hypergeometric Functions to Holonomic Functions.

This has been super exciting so far and I hope same for future.

Thank You.