Closed tejasvicsr1 closed 2 years ago
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
651b372 | Revert "Merge branch 'u/gh-tejasvicsr1/special_functions_for_lazy_series' of git://trac.sagemath.org/sage into t/32324/lazy_taylor_series" |
7c9a5dd | fix invert |
51357a0 | Small reworkings and fixes. Adding another composition test. |
7501204 | Adding documentation to the user-facing class level documentation. |
4723f6b | Refactoring we discussed at the meeting today. |
651c3ed | only get coefficient if necessary |
65e604d | Merge branch 'u/mantepse/dense_lls-31897' of git://trac.sagemath.org/sage into t/32324/lazy_taylor_series |
b332728 | fix and document series reversion |
6a2391e | Merge remote-tracking branch 'trac/u/mantepse/lazy_taylor_series' into t/32367/replace_lazy_power_series_in_species_directory_with_the_new_lazy_taylor_series |
0d56b02 | Merged new Taylor series and deleted new_gs.py |
Commit: 0d56b02
Changed keywords from LazyPowerSeries, FormalSeries, GSoC21 to LazyPowerSeries, FormalSeries, gsoc2021
Dependencies: #32324
Branch pushed to git repo; I updated commit sha1. New commits:
39993e3 | Fixed the initialising issue. |
Branch pushed to git repo; I updated commit sha1. New commits:
974fa4f | Changed _list and _term methods. |
6cfdf8d | Created restrict method in the series helper function. |
eef15d8 | Changed the name of iterator to callable. |
7d491f6 | Raised a not implemented error for all not corrected methods in the generating_series file. |
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
661c3d4 | backport two fixes from 32324 |
8a7dcd3 | fix oversight in shift |
78b8fff | Last trivial fix for clean pyflakes. |
96771f0 | Merge branch 'u/tscrim/dense_lls-31897' of git://trac.sagemath.org/sage into t/32324/lazy_taylor_series |
86925af | initial version of lazy symmetric functions |
aa8a250 | initial and insanely stupid plethysm implementation |
1a36f59 | add (currently failing) doctest for plethysm |
03198a0 | fix bug in plethysm |
eb3e88f | more doctests for composition and plethysm |
a9084c6 | Merge branch 'u/mantepse/lazy_taylor_series' of git://trac.sagemath.org/sage into t/32367/replace_lazy_power_series_in_species_directory_with_the_new_lazy_taylor_series |
Branch pushed to git repo; I updated commit sha1. New commits:
4b76e93 | switch to power sum by default |
Branch pushed to git repo; I updated commit sha1. New commits:
48e8e26 | Changed more methods. |
Branch pushed to git repo; I updated commit sha1. New commits:
78a85ae | Some more work in generating series. |
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
e4479ed | fix missing space |
3da6b3d | better docstring |
8798139 | Adding a slightly more complicated doctest and other small tweaks. |
75e3f3b | Merge branch 'public/rings/laurent_quo_rem_bug-34330' into public/rings/lazy_talyor_series-32324 |
c74fd71 | improve documentation, move options to abstract base class |
9d6579b | improve documentation, move zero, one, characteristic, etc. to ABC |
feba6b8 | Working more on `__call__` for LazySymFunc. |
3f3e0f2 | Merge branch 'public/rings/lazy_talyor_series-32324' of https://github.com/sagemath/sagetrac-mirror into public/rings/lazy_talyor_series-32324 |
6727228 | Merge branch 'public/rings/lazy_talyor_series-32324' of trac.sagemath.org:sage into t/32324/public/rings/lazy_talyor_series-32324 |
d4f2e5c | Merge branch 'public/rings/lazy_talyor_series-32324' of trac.sagemath.org:sage into t/32367/replace_lazy_power_series_in_species_directory_with_the_new_lazy_taylor_series |
Branch pushed to git repo; I updated commit sha1. New commits:
028796d | Fixing numerous issues with `__call__` and expanding its functionality. Moving plethysm to a Stream_plethysm. |
9fb155f | Removing unused code from previous version. |
1b34e62 | Merge branch 'public/rings/lazy_talyor_series-32324' of trac.sagemath.org:sage into t/32367/replace_lazy_power_series_in_species_directory_with_the_new_lazy_taylor_series |
Branch pushed to git repo; I updated commit sha1. New commits:
7f9dbb1 | Some last doc fixes and tweaks. |
4e03fee | remove unused local variable |
e780472 | Addressing the linter complaint. |
5ba18e8 | Merge branch 'public/rings/lazy_talyor_series-32324' of trac.sagemath.org:sage into t/32367/replace_lazy_power_series_in_species_directory_with_the_new_lazy_taylor_series |
Is this ready for review?
No, not at all, I am working on it.
I am having slight difficulties with plethysm, but I think that I have mostly resolved these by now.
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
50ce450 | derivative for LazyTaylorSeries |
10cfc11 | derivative for LazySymmetricFunctions |
7be0b86 | functorial composition for LazySymmetricFunctions |
c755d71 | implement arithmetic product for LazySymmetricFunction |
c36796e | Merge branch 'u/mantepse/implement_arithmetic_product_of_lazy_symmetric_functions' of trac.sagemath.org:sage into t/32367/replace_lazy_power_series_in_species_directory_with_the_new_lazy_taylor_series |
18429ef | do not use change_ring, because it is brittle, and take care of zero coefficients which are not symmetric functions |
481d78d | Merge branch 'u/mantepse/implement_functorial_composition_of_lazy_symmetric_functiosn' of trac.sagemath.org:sage into t/34423/implement_arithmetic_product_of_lazy_symmetric_functions |
b469431 | do not use change_ring, because it is brittle |
56ee69e | Merge branch 'u/mantepse/implement_arithmetic_product_of_lazy_symmetric_functions' of trac.sagemath.org:sage into t/32367/replace_lazy_power_series_in_species_directory_with_the_new_lazy_taylor_series |
1e8f69d | remove LazyPowerSeries and Stream |
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
e1e7f0d | Merge branch 'u/mantepse/implement_derivatives_of_lazy_series' of trac.sagemath.org:sage into t/34473/remove_rings_from_streams |
6010361 | remove ring argument from Stream_map_coefficient and Stream_function |
aa15394 | Merge branch 'u/mantepse/remove_rings_from_streams' of trac.sagemath.org:sage into t/34422/implement_functorial_composition_of_lazy_symmetric_functiosn |
760372a | address reviewer's comments |
8ca3624 | polish functorial composition |
b2ef1e4 | allow SymmetricFunctions as arguments of functorial composition |
83e7dd3 | Merge branch 'u/mantepse/implement_functorial_composition_of_lazy_symmetric_functiosn' of trac.sagemath.org:sage into t/34423/implement_arithmetic_product_of_lazy_symmetric_functions |
d22f87a | adapt code after merge |
f2a3caf | reimplement arithmetic_product by using the symmetric function version (which is more robust |
d75ac13 | Merge branch 'u/mantepse/implement_arithmetic_product_of_lazy_symmetric_functions' of trac.sagemath.org:sage into t/32367/replace_lazy_power_series_in_species_directory_with_the_new_lazy_taylor_series |
Branch pushed to git repo; I updated commit sha1. New commits:
293b439 | adapt doctests |
A small step but a giant leap!
Changed dependencies from #32324 to #34423
Changed author from Tejasvi Chebrolu to Tejasvi Chebrolu, Martin Rubey, Travis Scrimshaw
From a first quick look, it seems like there are just a few small things to address:
These need at least one doctest each:
def __init__(self, base_ring):
super().__init__(base_ring, names="z")
This can be simplified:
- return CIS(lambda n: _cl_term(n))
+ return CIS(_cl_term)
We can also use (the cached)
-base_ring(1)
+base_ring.one()
We no longer have a coefficients()
method (a difference between the implementations), right? We should introduce a deprecation message for this method or add it to the lazy series. I am leaning towards adding it to the lazy series as a redirect of self[:n]
.
Branch pushed to git repo; I updated commit sha1. New commits:
8b6a752 | no period at end of input description, break long doctest |
f88a5c8 | fix arithmetic product with 0 and finite support |
89270eb | Merge branch 'u/mantepse/implement_arithmetic_product_of_lazy_symmetric_functions' of trac.sagemath.org:sage into t/32367/replace_lazy_power_series_in_species_directory_with_the_new_lazy_taylor_series |
There are several failing doctests and a few hidden bugs elsewhere (found using grep LazyPowerSeries). Trying to fix.
There is at least one place, where we feed the LazyPowerSeriesRing with an infinite iterator, see below.
While this is surely easy to change, shouldn't we support this, too? Actually, I thought we did, but I cannot find it right now.
# If we're here, we may not be a finite crystal.
# In fact, we're probably infinite.
from sage.rings.lazy_series_ring import LazyTaylorSeriesRing
if q is None:
P = LazyTaylorSeriesRing(ZZ, names='q')
else:
P = q.parent()
if not isinstance(P, LazyTaylorSeriesRing):
raise TypeError("the parent of q must be a lazy power series ring")
ret = P(iter_by_deg(mg))
return ret
There is one doctest from a book which we cannot sensibly support anymore, see below.
In short:
sage: L.<z> = LazyPowerSeriesRing(QQ)
sage: C = L()
sage: C._name = 'C'
sage: C.define( z + C * C )
must become
sage: L.<z> = LazyPowerSeriesRing(QQ)
sage: C = L.undefined(valuation=1)
sage: C.define( z + C * C )
Can I simply change this? (Note that we do not support this recursive definition with valuation=0 anymore.)
Sage example in ./combinat.tex, line 654::
sage: L.<z> = LazyPowerSeriesRing(QQ)
Sage example in ./combinat.tex, line 661::
sage: C = L()
sage: C._name = 'C'
sage: C.define( z + C * C )
Sage example in ./combinat.tex, line 666::
sage: [C.coefficient(i) for i in range(11)]
[0, 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862]
Similarly, also in src/sage/tests/books/computational-mathematics-with-sagemath/
, but polynomes.tex
.
I think we can make exponential
an alias, but compute_coefficients
does not really make sense anymore.
sage: L.<x> = LazyPowerSeriesRing(QQ)
sage: lazy_exp = x.exponential(); lazy_exp
O(1)
Sage example in ./polynomes.tex, line 2039::
sage: lazy_exp[5]
1/120
sage: lazy_exp
1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + O(x^6)
Sage example in ./polynomes.tex, line 2062::
sage: f = L(1) # the constant lazy series 1
sage: for i in range(5):
....: f = (x*f).exponential()
....: f.compute_coefficients(5) # forces the computation
....: print(f) # of the first coefficients
1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + O(x^6)
1 + x + 3/2*x^2 + 5/3*x^3 + 41/24*x^4 + 49/30*x^5 + O(x^6)
1 + x + 3/2*x^2 + 8/3*x^3 + 101/24*x^4 + 63/10*x^5 + O(x^6)
1 + x + 3/2*x^2 + 8/3*x^3 + 125/24*x^4 + 49/5*x^5 + O(x^6)
1 + x + 3/2*x^2 + 8/3*x^3 + 125/24*x^4 + 54/5*x^5 + O(x^6)
Finally:
Sage example in ./polynomes.tex, line 2105::
sage: from sage.combinat.species.series import LazyPowerSeries
sage: f = LazyPowerSeries(L, name='f')
sage: f.define((x*f).exponential())
sage: f.coefficients(8)
[1, 1, 3/2, 8/3, 125/24, 54/5, 16807/720, 16384/315]
(L
is the lazy power series ring here)
I thought we also supported iterators too, but it is possible that we don’t. I don’t quite have any explicit memory of what we did other than have a discussion about how to handle them. It might have fallen through the cracks.
We can make these changes. The standard thing to do is to cc the book author(s) to let them know.
I guess we don’t have a good mechanism for finding out what is the smallest valuation for a define()
series should make sense. I remember us talking about this for Laurent series and not knowing there is a unique solution, much less knowing what lower bound might work. The issue for the power series was we had to try and catch an infinite recursion error (which would be very bad practice because it would hide bugs). I don’t think we talked too much about other solutions. When we have one unknown function, we could take its _approximate_order
to be a variable, e.g., n
and take the ceiling of the smallest positive real root of f(n) - n
, where f
is the function that we get from the define()
input _approximate_order
.
Well, if we don’t want to try anything like this beforehand (or it becomes too much work), then we can simply change the test (and I would say it is better for the user to supply anyways). (That is also a very evil test. :p
)
I think exponential()
is a good alias to have. I would add a deprecation for compute_coefficients()
and remove the line in the above doctest.
Important and somewhat urgent question:
Support for passing generators turns out to be easy, but there is a question of semantics. If the valuation is specified, should it refer to the first term yielded by the generator, or the first non-zero term yielded by the generator.
Both is easy to achieve.
By way of example: do we want
sage: L.<x> = LazyLaurentSeriesRing(QQ); L(iter(NN), valuation=-3)
x^-3 + 2*x^-2 + 3*x^-1 + 4 + 5*x + 6*x^2 + O(x^3)
or
sage: L.<x> = LazyLaurentSeriesRing(QQ); L(iter(NN), valuation=-3)
x^-2 + 2*x^-1 + 3 + 4*x + 5*x^2 + 6*x^3 + O(x^4)
Compare with our current decisions:
sage: L.<x> = LazyLaurentSeriesRing(QQ); L(range(5), valuation=-3)
x^-3 + 2*x^-2 + 3*x^-1 + 4
sage: L.<x> = LazyLaurentSeriesRing(QQ); L(lambda n: n+3, valuation=-3)
x^-2 + 2*x^-1 + 3 + 4*x + 5*x^2 + 6*x^3 + O(x^4)
The first nonzero term following our statement that passing the valuation
means the series exactly has that valuation.
We might want to do something as a safety guard of running forever (say 1000 trials) if someone does something crazy like pass
def zero():
while True: yield 0
(This might arise more naturally if someone passes something that is not known to be exactly 0
but ends up being 0
and doing some iteration over that.)
Branch pushed to git repo; I updated commit sha1. New commits:
b76d8f4 | allow to define lazy series using iterators, adapt doctest |
In this ticket we finalize the implementation of lazy series, and replace the old lazy series framework.
Depends on #34423
CC: @mantepse @tscrim @pfili @zimmermann6 @sagetrac-tmonteil
Component: combinatorics
Keywords: LazyPowerSeries, FormalSeries, gsoc2021
Author: Tejasvi Chebrolu, Martin Rubey, Travis Scrimshaw
Branch/Commit:
4fc981b
Reviewer: Martin Rubey, Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/32367