GSoC Week 10
I spent a good amount of time this week trying to make the series function more
intelligent about which ring
it operates on. The earlier strategy of using the
EX
ring proved to be slow in many cases. I had discussions with Kalevi
Suominen, who is a developer at SymPy and we figured
out the following strategy:

The user inputs a Basic
expr
. We usesring
over QQ to get the starting ring. 
We call individual functions by recursing on
expr
. Ifexpr
has a constant term we create a new ring with additional generators required by the ring (e.g sin and cos in case ofrs_sin
and expandexpr
over that.) 
This means that each
ring_series
function now can add generators to the ring it gets so that it can expand the expression.
This results in considerable speedup as we do operations on the simplest
possible ring as opposed to using EX
which is the most complex (and hence
slowest) ring. Because of this, the time taken by the series_fast
function in
faster_series is
marginally more than direct function calls. The function doesn’t yet have code
for handling arbitrary expressions, which will add some overhead of its own.
Most of the extra time is taken by sring
. The overhead is constant, however (for
a given expression). So for series_fast(sin(a**2 + a*b), a, 10)
the extra
routines take about 50% of the total time (the function is 24 x slower). For
series_fast(sin(a**2 + a*b), a, 100)
, they take 2% of the total time and the
function is almost as fast as on QQ
There is, of course scope for speedup in sring
(as mentioned in its file).
Another option is to minimise the number of calls to sring
, if possible to
just one (in the series_fast
function).
In my last post I talked about the new solveset
module that
Harsh and Amit are
working on. I am working with them and I sent a
patch to add a domain
argument to
the solveset
function. It is pretty cool stuff in that solution is always
guaranteed to be complete.
Next Week
I haven’t been yet been able to start porting the code to Symengine as the
Polynomial
wrappers are not yet ready. Hopefully, they should be done by the next
week. Till, then I will focus on improving series_fast
and any interesting
issues that come my way.

Write a fully functional
series_fast
. Profile it properly and optimise it. 
Polynomial wrappers.

Document the functions and algorithms used in
ring_series.py
Cheers!!
Enjoy Reading This Article?
Here are some more articles you might like to read next: