So far

My PR 9262 finally got merged. However, we have not yet decided which algorithm to use for the trigonometric and hyperbolic functions. In most cases there are multiple options

  • Expansion using closed form formula
  • Expansion of tan and tanh using a form of Newton’s method
  • Expansion of sin, cos, sinh and cosh from tan and tanh

Newton’s Method

Newton’s method is rather interesting. It lets you calculate the series expansion of a function, given the series expansion of its inverse. Now, the formula for the expansion of tan is much more complicated than that of atan. So using atan’s series expansion for tan makes sense. The basic idea is as follows:

Say I have a continuous and differentiable function f(x), whose inverse is g(x), i.e, f(g(x)) = x. Assume that we have an efficient implementation for g(x) and we want to use it for f(x). Let h(x) = y - g(x). On solving this equation, we’ll get a root c, such that: h(c) = 0 or y = g(c) or c = f(y)

Now, using Newton’s method we have the following iteration: x_j+1 = x_j + (y - g(x_j)) / g'(x_j)

The more iterations we do, higher the precision of our series expansion. If you are interested in the mathematics behind it, you can refer to this

As of now, ring_series has the code for plain vanilla formula based expansion too. I need to properly benchmark the different methods to conclude anything about their relative performance.

Puiseux Series

This week I am working on PR 9495, which will let us manipulate Puiseux series in ring_series. A Puiseux is a series which can have fractional exponents. By definition, a polynomial should have only positive integer exponents. So, I was hoping that using a Rational doesn’t break anything in the polys module. Unfortunately, my PR is causing some tests to fail. I hope I don’t need to make major changes because of it.

Once Puiseux series gets up and running, I will add the remaining functions dependent on it.

Next Week

A Symbolic Ring

Just as the type of series decides how the exponents of the series will be, the coefficients are determined by the ring over which the polynomial is defined. To be able to expand functions with arguments that have a constant term with respect to the expansion variable, the series should be allowed to have symbolic expressions as coefficients. For example, a 2nd order expansion about 0 of sin(x + y), wrt x, is sin(y) + x*cos(y). To be able to do this with ring_series, the polynomial needs to be defined over the EX or expression ring, which is Sympy’s implementation of a symbolic ring. Currently ring_series works with EX ring but it can not handle a series with constant terms.

So, my major tasks for next week are:

  • Get ring_series working with symbolic ring
  • Implement series expansion of polylog and series reversion
  • Discuss the structure of Series class and send a PR for it.

Cheers!