Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 07ca029

Browse files
committedAug 29, 2022
add a consistency check
1 parent bdc4537 commit 07ca029

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
 

‎src/sage/rings/lazy_series.py

+45
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,51 @@
9999
1/4*z^-1 - 3/8 + 1/16*z - 17/32*z^2 + 5/64*z^3 - 29/128*z^4 + 165/256*z^5 + O(z^6)
100100
sage: hinv.valuation()
101101
-1
102+
103+
TESTS::
104+
105+
sage: def check(L, z, verbose=False):
106+
....: # division
107+
....: lf = [0, L(0), 1, L(1), z, 1 + z, 2 + z + z^2]
108+
....: lg = [3, L(3), 1 + z, 2 + z + z^2]
109+
....: for f in lf:
110+
....: for g in lg:
111+
....: try:
112+
....: h = f / g
113+
....: if verbose: print("(%s) / (%s) = %s" % (f, g, h))
114+
....: except Exception as e:
115+
....: print("%s in (%s) / (%s)" % (e, f, g))
116+
....: # composition
117+
....: f = L(0)
118+
....: l = [(f, 0), (f, L(0)), (f, 2), (f, L(2)), (f, 2 + z + z^2), (f, 3/(1 - 2*z))]
119+
....: f = L(1)
120+
....: l.extend([(f, 0), (f, L(0)), (f, 2), (f, L(2)), (f, 2 + z + z^2), (f, 3/(1 - 2*z))])
121+
....: f = 2 + z + z^2
122+
....: l.extend([(f, 0), (f, L(0)), (f, 2), (f, L(2)), (f, 2 + z + z^2), (f, 3/(1 - 2*z))])
123+
....: f = 3/(2 - 3*z)
124+
....: l.extend([(f, 0), (f, L(0)), (f, 3*z/(1 - 2*z))])
125+
....: for f, g in l:
126+
....: try:
127+
....: h = f(g)
128+
....: if verbose: print("(%s)(%s) = %s" % (f, g, h))
129+
....: except Exception as e:
130+
....: print("%s in (%s)(%s)" % (e, f, g))
131+
....: # reversion
132+
....: l = [2 + 3*z, 3*z + 2*z^2, 3*z/(1 - 2*z - 3*z^2)]
133+
....: for f in l:
134+
....: try:
135+
....: h = f.revert()
136+
....: if verbose: print("(%s)^{(-1)} = %s" % (f, h))
137+
....: except Exception as e:
138+
....: print("%s in (%s).revert()" % (e, f))
139+
140+
sage: L.<z> = LazyLaurentSeriesRing(QQ)
141+
sage: check(L, z)
142+
sage: L.<z> = LazyTaylorSeriesRing(QQ)
143+
sage: check(L, z)
144+
sage: p = SymmetricFunctions(QQ).p()
145+
sage: L = LazySymmetricFunctions(p)
146+
sage: check(L, L(p[1]))
102147
"""
103148

104149
# ****************************************************************************

0 commit comments

Comments
 (0)
This repository has been archived.