@isuruf @certik This is about 3.5x faster than Sage+Pynac

@rwst are you talking about #651?

Did you benchmark the piranha int or flint int?

@isuruf can you update me on what the current status of polynomials and series expansion is? We have Piranha and Flint ones. Then we have classes of our own, like

`UnivariatePolynomial`

. What is the status and the plan forward? Let's document it on the wiki, probably here: https://github.com/symengine/symengine/wiki/En-route-to-Polynomial
@rwst I guess that was a question for you too. Do you prefer the Flint or Piranha polynomials?

Which one should we use to get the capabilities comparable to sympy?

First of all, the series expansions we have now are univariate power series

`URatPSeriesFlint`

can do only rational coefficient power series.`URatPSeriesPiranha`

can do rational coefficient power series (possibly laurent)`UPSeriesPiranha`

can do Expression coefficient power series (possibly laurent)
I see. I assume we don't have integer power series, since those are very rare?

`UnivariatePolynomial`

is an integer coefficient polynomial that is not fully integrated`UnivariateSeries`

is a series based on `UnivariatePolynomial`

and has limited functionality
@certik, yes. If we want a integer series it's very easy to do, but it's very rare

I see, thanks. What is the best way forward?

We want the ones that deliver maximum speed, but we need to add functionality so that it can be used by sympy and Sage.

Also,

`UnivariateSeries`

should be using `SeriesBase`

to have the same interface, shouldn't it?
So that we can have multiple implementations but the same interface.

Have a

This is what @irislq and the team are doing.

Also we need to have multivariate support for Piranha as well. To do that few changes are needed. sin, cos and other functions implementations are the same as the univariate ones, but

`UPSeries`

which would just use SymEngine and have Expression coefficients.This is what @irislq and the team are doing.

Also we need to have multivariate support for Piranha as well. To do that few changes are needed. sin, cos and other functions implementations are the same as the univariate ones, but

`series_invert`

, `series_root`

needs to be handled carefully.
Yes,

`UnivariateSeries`

is an isolated class, which needs to be done correctly.
Will UPSeries subclass SeriesBase?

Why not to just use Piranha? That should be faster than what we can do, wouldn't it?

I mean, why not just use

`URatPSeriesPiranha`

and `UPSeriesPiranha`

.
Piranha is an optional dependency. Right now there is no series that can be run without optional dependencies.

Yes

`UPSeries`

will subclass `SeriesBase`

I like the fact that piranha uses templates for everything and we can easily use Expression as a coefficient type, but considering piranha has boost, mpfr, gmp and bzip2 as dependencies and cannot be built on MSVC, I think we should have an implementation even if it is slower

We should have a "reference" implementation ourselves, no doubt.

But will it be possible to switch to Piranha if the user wants to get maximum speed?

I would hope that the

`SeriesBase`

approach would allow that.
Yes. It's just a matter of replacing

Also

Right now

`UPSeries::series`

calls to `UPSeriesPiranha::series`

calls.Also

`series`

method will always prefer Piranha implementation over SymEngine if Piranha is installed.Right now

`URatPSeriesFlint`

is preferred over `URatPSeriesPiranha`

due to performance
I see, that's perfect.

In order to implement

`UPSeries`

we need a polynomial.
Will that use

`UnivariatePolynomial`

?
No,

`UnivariatePolynomial`

handles only integer coefficients. (Name is misleading, I know). @chenchfort is writing one that can handle Expressions as coefficients
I see. I think that's good for a reference implementation.

Obviously, for speed, one always has to use the fastest / most specialized types, so rational coefficients for series. That gets you pretty far, but of course, you can't so sin(x) around x=1 and such stuff. But you can do most other series. So our reference implementation, even though slow due to using an

`Expression`

, by being a polynomial, the data structures would still allow fast operations like multiplication (compared to just using Basic expressions and multiplying them).
Exactly

Ok, I like this plan. Thanks for clarifying it.

Will you have time to stay on top of their project?

Yes, sure

Thank you. That would be really helpful. In projects like this one, we need to make sure the design choices are made right.

@certik & @isuruf Since

`UnivariatePolynomial`

seems to be a misleading name, Charles and I were wondering if we could rename it to something else. I was also thinking of renaming the current UnivariateSeries into UPSeries and use the name UnivariateSeries for the new polynomial with Expression coefficients
Just want to be consistent is all