@certik Ok! I get it now. So we let the user adjust 'n' so that he gets the desired number of terms.

I was wondering if we'd want to have lazy series expansion. Sympy's lseries uses nseries repeatedly so it is slow. Perhaps we can implement lseries in CSympy only for functions that have a closed form.

I was wondering if we'd want to have lazy series expansion. Sympy's lseries uses nseries repeatedly so it is slow. Perhaps we can implement lseries in CSympy only for functions that have a closed form.

I benchmarked hash comparisons for symbols here https://github.com/sympy/csympy/issues/379#issuecomment-73395521

It seems to be the fastest. It'd be great if someone else could benchmark it too.

It seems to be the fastest. It'd be great if someone else could benchmark it too.

I don't like the hash comparison, as two different symbols with the same hash will compare equal.

As to series, I am experimenting with the series design here: https://github.com/certik/sympy/compare/formal_power_series

Essentially, the series are just polynomials, and so fast polynomial arithmetic must be used.

Read also the docstring of

`FormalPowerSeries`

in the branch.