Skip to content

Commit

Permalink
Trac #16268: Better normalization for fraction field elements
Browse files Browse the repository at this point in the history
Normalize the leading coefficient of the denominator to one when
reducing elements of fraction fields of univariate polynomial rings over
fields. Doing so
- often leads to more readable results,
- helps limiting coefficient blow-up during computations with fractions
over complicated base fields (e.g., elements of ℚ(x,y)(t)), typically
leading to much better performance,
- makes hashing more (though not 100%) reliable, see the original
description and the comments below.

The following further improvements are IMO desirable but out of the
scope of this ticket:
- clearing denominators in the numerator and denominator instead of
making the leading coefficient of the denominator monic when that makes
sense (i.e., for printing, and perhaps for computations in nested
rational function fields, but making it fast enough requires some work),
- also normalizing the leading coefficients over non-fields where that
makes sense.

Original description:

If K is a field then K(u), the function field, has a reduce() method
which cancels the gcd but does not put into a canonical form by (for
example) dividing through by the leading coefficient of the denominator
to make the denominator monic.  This means that equal elements may have
different hashes, and hence that putting function field elements into a
set does not work as a mathematician would expect.  For example:
{{{
sage: Ku.<u> = FractionField(PolynomialRing(QQ,'u'))
sage: a = 27*u^2+81*u+243
sage: b = 27*u-81
sage: c = u^2 + 3*u + 9
sage: d = u-3
sage: s = a/b
sage: t = c/d
sage: s==t
True
sage: len(Set([s,t]))
2
}}}

URL: https://trac.sagemath.org/16268
Reported by: cremona
Ticket author(s): Robert Bradshaw, Erik Massop, Marc Mezzarobba
Reviewer(s): Julian Rüth
  • Loading branch information
Release Manager authored and vbraun committed Aug 25, 2018
2 parents db0b57b + af91bf5 commit f60348f
Show file tree
Hide file tree
Showing 29 changed files with 253 additions and 154 deletions.
2 changes: 1 addition & 1 deletion src/sage/algebras/quatalg/quaternion_algebra_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ cdef class QuaternionAlgebraElement_generic(QuaternionAlgebraElement_abstract):
sage: type(theta)
<... 'sage.algebras.quatalg.quaternion_algebra_element.QuaternionAlgebraElement_generic'>
sage: theta._repr_()
'1/x + x*i + (-x - 1)*j + (2/(3*x^3 + 5))*k'
'1/x + x*i + (-x - 1)*j + (2/3/(x^3 + 5/3))*k'
"""
return self._do_print(self.x, self.y, self.z, self.w)

Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/functor.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ cdef class Functor(SageObject):
Ring endomorphism of Finite Field in a of size 5^2
Defn: a |--> 4*a + 1
sage: fF((a^2+a)*t^2/(a*t - a^2))
3*a*t^2/((4*a + 1)*t + a + 1)
((4*a + 2)*t^2)/(t + a + 4)
"""
try:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/coding/linear_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -3497,7 +3497,7 @@ def zeta_function(self, name="T"):
sage: C = codes.HammingCode(GF(2), 3)
sage: C.zeta_function()
(2/5*T^2 + 2/5*T + 1/5)/(2*T^2 - 3*T + 1)
(1/5*T^2 + 1/5*T + 1/10)/(T^2 - 3/2*T + 1/2)
"""
P = self.zeta_polynomial()
q = (self.base_ring()).characteristic()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/sf/dual.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ def scalar_hl(self, x):
sage: h = m.dual_basis(scalar=zee)
sage: a = h([2,1])
sage: a.scalar_hl(a)
(t + 2)/(-t^4 + 2*t^3 - 2*t + 1)
(-t - 2)/(t^4 - 2*t^3 + 2*t - 1)
"""
return self._dual.scalar_hl(x)

Expand Down
10 changes: 5 additions & 5 deletions src/sage/combinat/sf/hall_littlewood.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def scalar_hl(self, x, t = None):
sage: HLQ([2]).scalar_hl(HLQ([1,1]))
0
sage: HLP([2]).scalar_hl(HLP([2]))
1/(-t + 1)
-1/(t - 1)
"""
parent = self.parent()
if t is None:
Expand Down Expand Up @@ -837,13 +837,13 @@ def __init__(self, hall_littlewood):
sage: HLQp = Sym.hall_littlewood().Qp()
sage: s = Sym.schur(); p = Sym.power()
sage: HLQ( HLP([2,1]) + HLP([3]) )
(1/(t^2-2*t+1))*HLQ[2, 1] + (1/(-t+1))*HLQ[3]
(1/(t^2-2*t+1))*HLQ[2, 1] - (1/(t-1))*HLQ[3]
sage: HLQ(HLQp([2])) # indirect doctest
(t/(t^3-t^2-t+1))*HLQ[1, 1] + (1/(-t+1))*HLQ[2]
(t/(t^3-t^2-t+1))*HLQ[1, 1] - (1/(t-1))*HLQ[2]
sage: HLQ(s([2]))
(t/(t^3-t^2-t+1))*HLQ[1, 1] + (1/(-t+1))*HLQ[2]
(t/(t^3-t^2-t+1))*HLQ[1, 1] - (1/(t-1))*HLQ[2]
sage: HLQ(p([2]))
(1/(t^2-1))*HLQ[1, 1] + (1/(-t+1))*HLQ[2]
(1/(t^2-1))*HLQ[1, 1] - (1/(t-1))*HLQ[2]
"""
HallLittlewood_generic.__init__(self, hall_littlewood)

Expand Down
40 changes: 23 additions & 17 deletions src/sage/combinat/sf/jack.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ def P(self):
::
sage: JP(JQ([2,1]))
((t+2)/(2*t^3+t^2))*JackP[2, 1]
((1/2*t+1)/(t^3+1/2*t^2))*JackP[2, 1]
sage: JP(JQ([3]))
((2*t^2+3*t+1)/(6*t^3))*JackP[3]
((1/3*t^2+1/2*t+1/6)/t^3)*JackP[3]
sage: JP(JQ([1,1,1]))
(6/(t^3+3*t^2+2*t))*JackP[1, 1, 1]
Expand Down Expand Up @@ -266,13 +266,13 @@ def Q(self):
sage: JQ = Sym.jack().Q()
sage: JP = Sym.jack().P()
sage: JQ(sum(JP(p) for p in Partitions(3)))
(1/6*t^3+1/2*t^2+1/3*t)*JackQ[1, 1, 1] + ((2*t^3+t^2)/(t+2))*JackQ[2, 1] + (6*t^3/(2*t^2+3*t+1))*JackQ[3]
(1/6*t^3+1/2*t^2+1/3*t)*JackQ[1, 1, 1] + ((2*t^3+t^2)/(t+2))*JackQ[2, 1] + (3*t^3/(t^2+3/2*t+1/2))*JackQ[3]
::
sage: s = Sym.schur()
sage: JQ(s([3])) # indirect doctest
(1/6*t^3-1/2*t^2+1/3*t)*JackQ[1, 1, 1] + ((2*t^3-2*t^2)/(t+2))*JackQ[2, 1] + (6*t^3/(2*t^2+3*t+1))*JackQ[3]
(1/6*t^3-1/2*t^2+1/3*t)*JackQ[1, 1, 1] + ((2*t^3-2*t^2)/(t+2))*JackQ[2, 1] + (3*t^3/(t^2+3/2*t+1/2))*JackQ[3]
sage: JQ(s([2,1]))
(1/3*t^3-1/3*t)*JackQ[1, 1, 1] + ((2*t^3+t^2)/(t+2))*JackQ[2, 1]
sage: JQ(s([1,1,1]))
Expand Down Expand Up @@ -329,15 +329,15 @@ def J(self):
sage: JJ = Sym.jack().J()
sage: JP = Sym.jack().P()
sage: JJ(sum(JP(p) for p in Partitions(3)))
1/6*JackJ[1, 1, 1] + (1/(t+2))*JackJ[2, 1] + (1/(2*t^2+3*t+1))*JackJ[3]
1/6*JackJ[1, 1, 1] + (1/(t+2))*JackJ[2, 1] + (1/2/(t^2+3/2*t+1/2))*JackJ[3]
::
sage: s = Sym.schur()
sage: JJ(s([3])) # indirect doctest
((t^2-3*t+2)/(6*t^2+18*t+12))*JackJ[1, 1, 1] + ((2*t-2)/(2*t^2+5*t+2))*JackJ[2, 1] + (1/(2*t^2+3*t+1))*JackJ[3]
((1/6*t^2-1/2*t+1/3)/(t^2+3*t+2))*JackJ[1, 1, 1] + ((t-1)/(t^2+5/2*t+1))*JackJ[2, 1] + (1/2/(t^2+3/2*t+1/2))*JackJ[3]
sage: JJ(s([2,1]))
((t-1)/(3*t+6))*JackJ[1, 1, 1] + (1/(t+2))*JackJ[2, 1]
((1/3*t-1/3)/(t+2))*JackJ[1, 1, 1] + (1/(t+2))*JackJ[2, 1]
sage: JJ(s([1,1,1]))
1/6*JackJ[1, 1, 1]
"""
Expand Down Expand Up @@ -715,12 +715,12 @@ def _multiply(self, left, right):
sage: JJ([1])^2 # indirect doctest
(t/(t+1))*JackJ[1, 1] + (1/(t+1))*JackJ[2]
sage: JJ([2])^2
(2*t^2/(2*t^2+3*t+1))*JackJ[2, 2] + (4*t/(3*t^2+4*t+1))*JackJ[3, 1] + ((t+1)/(6*t^2+5*t+1))*JackJ[4]
(t^2/(t^2+3/2*t+1/2))*JackJ[2, 2] + (4/3*t/(t^2+4/3*t+1/3))*JackJ[3, 1] + ((1/6*t+1/6)/(t^2+5/6*t+1/6))*JackJ[4]
sage: JQ = SymmetricFunctions(FractionField(QQ['t'])).jack().Q()
sage: JQ([1])^2 # indirect doctest
JackQ[1, 1] + (2/(t+1))*JackQ[2]
sage: JQ([2])^2
JackQ[2, 2] + (2/(t+1))*JackQ[3, 1] + ((6*t+6)/(6*t^2+5*t+1))*JackQ[4]
JackQ[2, 2] + (2/(t+1))*JackQ[3, 1] + ((t+1)/(t^2+5/6*t+1/6))*JackQ[4]
"""
return self( self._P(left)*self._P(right) )

Expand Down Expand Up @@ -889,11 +889,12 @@ def _m_cache(self, n):
sage: l(JP._m_to_self_cache[3])
[([1, 1, 1], [([1, 1, 1], 1)]),
([2, 1], [([1, 1, 1], -6/(t + 2)), ([2, 1], 1)]),
([3], [([1, 1, 1], 6/(t^2 + 3*t + 2)), ([2, 1], -3/(2*t + 1)), ([3], 1)])]
([3], [([1, 1, 1], 6/(t^2 + 3*t + 2)), ([2, 1], -3/2/(t + 1/2)), ([3], 1)])]
sage: l(JP._self_to_m_cache[3])
[([1, 1, 1], [([1, 1, 1], 1)]),
([2, 1], [([1, 1, 1], 6/(t + 2)), ([2, 1], 1)]),
([3], [([1, 1, 1], 6/(2*t^2 + 3*t + 1)), ([2, 1], 3/(2*t + 1)), ([3], 1)])]
([3],
[([1, 1, 1], 3/(t^2 + 3/2*t + 1/2)), ([2, 1], 3/2/(t + 1/2)), ([3], 1)])]
"""
if n in self._self_to_m_cache:
return
Expand Down Expand Up @@ -1002,9 +1003,9 @@ def scalar_jack_basis(self, part1, part2 = None):
sage: JP.scalar_jack_basis(Partition([2,1]), Partition([1,1,1]))
0
sage: JP._normalize_coefficients(JP.scalar_jack_basis(Partition([3,2,1]), Partition([3,2,1])))
(12*t^6 + 20*t^5 + 11*t^4 + 2*t^3)/(2*t^3 + 11*t^2 + 20*t + 12)
(6*t^6 + 10*t^5 + 11/2*t^4 + t^3)/(t^3 + 11/2*t^2 + 10*t + 6)
sage: JJ(JP[3,2,1]).scalar_jack(JP[3,2,1])
(12*t^6 + 20*t^5 + 11*t^4 + 2*t^3)/(2*t^3 + 11*t^2 + 20*t + 12)
(6*t^6 + 10*t^5 + 11/2*t^4 + t^3)/(t^3 + 11/2*t^2 + 10*t + 6)
With a single argument, takes `part2 = part1`::
Expand Down Expand Up @@ -1035,7 +1036,7 @@ def scalar_jack(self, x, t=None):
sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P()
sage: l = [JP(p) for p in Partitions(3)]
sage: matrix([[a.scalar_jack(b) for a in l] for b in l])
[ 6*t^3/(2*t^2 + 3*t + 1) 0 0]
[3*t^3/(t^2 + 3/2*t + 1/2) 0 0]
[ 0 (2*t^3 + t^2)/(t + 2) 0]
[ 0 0 1/6*t^3 + 1/2*t^2 + 1/3*t]
"""
Expand Down Expand Up @@ -1195,9 +1196,14 @@ def _h_cache(self, n):
[([1, 1], [([1, 1], 1), ([2], 2/(t + 1))]), ([2], [([2], 1)])]
sage: JQp._h_cache(3)
sage: l(JQp._h_to_self_cache[3])
[([1, 1, 1], [([1, 1, 1], 1), ([2, 1], 6/(t + 2)), ([3], 6/(2*t^2 + 3*t + 1))]), ([2, 1], [([2, 1], 1), ([3], 3/(2*t + 1))]), ([3], [([3], 1)])]
[([1, 1, 1],
[([1, 1, 1], 1), ([2, 1], 6/(t + 2)), ([3], 3/(t^2 + 3/2*t + 1/2))]),
([2, 1], [([2, 1], 1), ([3], 3/2/(t + 1/2))]),
([3], [([3], 1)])]
sage: l(JQp._self_to_h_cache[3])
[([1, 1, 1], [([1, 1, 1], 1), ([2, 1], -6/(t + 2)), ([3], 6/(t^2 + 3*t + 2))]), ([2, 1], [([2, 1], 1), ([3], -3/(2*t + 1))]), ([3], [([3], 1)])]
[([1, 1, 1], [([1, 1, 1], 1), ([2, 1], -6/(t + 2)), ([3], 6/(t^2 + 3*t + 2))]),
([2, 1], [([2, 1], 1), ([3], -3/2/(t + 1/2))]),
([3], [([3], 1)])]
"""
if n in self._self_to_h_cache:
return
Expand Down Expand Up @@ -1291,7 +1297,7 @@ def coproduct_by_coercion( self, elt ):
sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
sage: JQp = Sym.jack().Qp()
sage: JQp[2,2].coproduct() #indirect doctest
JackQp[] # JackQp[2, 2] + (2*t/(t+1))*JackQp[1] # JackQp[2, 1] + JackQp[1, 1] # JackQp[1, 1] + ((4*t^3+8*t^2)/(2*t^3+5*t^2+4*t+1))*JackQp[2] # JackQp[2] + (2*t/(t+1))*JackQp[2, 1] # JackQp[1] + JackQp[2, 2] # JackQp[]
JackQp[] # JackQp[2, 2] + (2*t/(t+1))*JackQp[1] # JackQp[2, 1] + JackQp[1, 1] # JackQp[1, 1] + ((2*t^3+4*t^2)/(t^3+5/2*t^2+2*t+1/2))*JackQp[2] # JackQp[2] + (2*t/(t+1))*JackQp[2, 1] # JackQp[1] + JackQp[2, 2] # JackQp[]
"""
h = elt.parent().realization_of().h()
parent = elt.parent()
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/sf/macdonald.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,12 +782,12 @@ def _s_to_self(self, x):
sage: J = Sym.macdonald(t=2).J()
sage: s = Sym.schur()
sage: J._s_to_self(s[2,1])
((-q+2)/(28*q-7))*McdJ[1, 1, 1] + (1/(-4*q+1))*McdJ[2, 1]
((-1/28*q+1/14)/(q-1/4))*McdJ[1, 1, 1] - (1/4/(q-1/4))*McdJ[2, 1]
This is for internal use only. Please use instead::
sage: J(s[2,1])
((-q+2)/(28*q-7))*McdJ[1, 1, 1] + (1/(-4*q+1))*McdJ[2, 1]
((-1/28*q+1/14)/(q-1/4))*McdJ[1, 1, 1] - (1/4/(q-1/4))*McdJ[2, 1]
"""
return self._from_cache(x, self._s_cache, self._s_to_self_cache, q = self.q, t = self.t)

Expand Down
6 changes: 3 additions & 3 deletions src/sage/combinat/sf/sfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -4468,9 +4468,9 @@ def scalar_jack(self, x, t=None):
[ 0 0 0 0 384]
sage: JQ = SymmetricFunctions(QQ['t'].fraction_field()).jack().Q()
sage: matrix([[JQ(mu).scalar_jack(JQ(nu)) for nu in Partitions(3)] for mu in Partitions(3)])
[(2*t^2 + 3*t + 1)/(6*t^3) 0 0]
[ 0 (t + 2)/(2*t^3 + t^2) 0]
[ 0 0 6/(t^3 + 3*t^2 + 2*t)]
[(1/3*t^2 + 1/2*t + 1/6)/t^3 0 0]
[ 0 (1/2*t + 1)/(t^3 + 1/2*t^2) 0]
[ 0 0 6/(t^3 + 3*t^2 + 2*t)]
"""
parent = self.parent()
if t is None:
Expand Down
7 changes: 4 additions & 3 deletions src/sage/dynamics/arithmetic_dynamics/affine_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,10 @@ def orbit(self, P, n):
sage: A.<x,y> = AffineSpace(FractionField(R), 2)
sage: f = DynamicalSystem_affine([(x-t*y^2)/x, t*x*y])
sage: f.orbit(A(1, t), 3)
[(1, t), (-t^3 + 1, t^2), ((-t^5 - t^3 + 1)/(-t^3 + 1), -t^6 + t^3),
((-t^16 + 3*t^13 - 3*t^10 + t^7 + t^5 + t^3 - 1)/(t^5 + t^3 - 1), -t^9 -
t^7 + t^4)]
[(1, t),
(-t^3 + 1, t^2),
((t^5 + t^3 - 1)/(t^3 - 1), -t^6 + t^3),
((-t^16 + 3*t^13 - 3*t^10 + t^7 + t^5 + t^3 - 1)/(t^5 + t^3 - 1), -t^9 - t^7 + t^4)]
"""
Q = P
if isinstance(n, list) or isinstance(n, tuple):
Expand Down
26 changes: 14 additions & 12 deletions src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False,
sage: rational_function = (z^2 - 2*z - 2)/(-2*z^2 - 2*z + 1)
sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import automorphism_group_QQ_fixedpoints
sage: automorphism_group_QQ_fixedpoints(rational_function, True)
[z, 2/(2*z), -z - 1, -2*z/(2*z + 2), (-z - 1)/z, -1/(z + 1)]
[z, 1/z, -z - 1, -z/(z + 1), (-z - 1)/z, -1/(z + 1)]
::
Expand Down Expand Up @@ -342,8 +342,8 @@ def PGL_repn(rational_function):
sage: f = ((2*z-1)/(3-z))
sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import PGL_repn
sage: PGL_repn(f)
[ 2 -1]
[-1 3]
[-2 1]
[ 1 -3]
"""
if is_Matrix(rational_function):
return rational_function
Expand Down Expand Up @@ -1083,7 +1083,7 @@ def three_stable_points(rational_function, invariant_list):
sage: L = [[0,1],[4,1],[1,1],[1,0]]
sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import three_stable_points
sage: three_stable_points(f,L)
[z, 4*z, 2/(2*z), 3/(2*z)]
[z, 4*z, 1/z, 4/z]
"""
# define ground field and ambient function field
if rational_function.parent().is_field():
Expand Down Expand Up @@ -1151,19 +1151,21 @@ def automorphism_group_FF_alg2(rational_function):
sage: f = (3*z^3 - z^2)/(z-1)
sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import automorphism_group_FF_alg2
sage: automorphism_group_FF_alg2(f)
[Univariate Polynomial Ring in w over Finite Field in b of size 7^2, [w, (3*b + 2)/((2*b + 6)*w)]]
[Univariate Polynomial Ring in w over Finite Field in b of size 7^2, [w, 5/w]]
::
sage: R.<z> = PolynomialRing(GF(5^3,'t'))
sage: f = (3456*z^(4))
sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import automorphism_group_FF_alg2
sage: automorphism_group_FF_alg2(f)
[Univariate Polynomial Ring in w over Finite Field in b of size 5^6, [w,
(3*b^5 + 4*b^4 + 3*b^2 + 2*b + 1)*w, (2*b^5 + b^4 + 2*b^2 + 3*b + 3)*w,
(3*b^5 + 4*b^4 + 3*b^2 + 2*b)/((3*b^5 + 4*b^4 + 3*b^2 + 2*b)*w), (4*b^5
+ 2*b^4 + 4*b^2 + b + 2)/((3*b^5 + 4*b^4 + 3*b^2 + 2*b)*w), (3*b^5 +
4*b^4 + 3*b^2 + 2*b + 3)/((3*b^5 + 4*b^4 + 3*b^2 + 2*b)*w)]]
[Univariate Polynomial Ring in w over Finite Field in b of size 5^6,
[w,
(3*b^5 + 4*b^4 + 3*b^2 + 2*b + 1)*w,
(2*b^5 + b^4 + 2*b^2 + 3*b + 3)*w,
1/w,
(3*b^5 + 4*b^4 + 3*b^2 + 2*b + 1)/w,
(2*b^5 + b^4 + 2*b^2 + 3*b + 3)/w]]
"""
# define ground field and ambient function field
if rational_function.parent().is_field():
Expand Down Expand Up @@ -1452,7 +1454,7 @@ def automorphisms_fixing_pair(rational_function, pair, quad):
sage: L = [[4, 1], [2, 1]]
sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import automorphisms_fixing_pair
sage: automorphisms_fixing_pair(f, L, False)
[(6*z + 6)/z, 4/(3*z + 3)]
[(6*z + 6)/z, 6/(z + 1)]
"""
# define ground field and ambient function field
if rational_function.parent().is_field():
Expand Down Expand Up @@ -1526,7 +1528,7 @@ def automorphism_group_FF_alg3(rational_function):
sage: f = (3456*z^4)
sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import automorphism_group_FF_alg3
sage: automorphism_group_FF_alg3(f)
[z, 3/(3*z)]
[z, 1/z]
"""
# define ground field and ambient function field
if rational_function.parent().is_field():
Expand Down
33 changes: 26 additions & 7 deletions src/sage/dynamics/arithmetic_dynamics/projective_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -2787,7 +2787,7 @@ def automorphism_group(self, **kwds):
sage: R.<x,y> = ProjectiveSpace(QQ,1)
sage: f = DynamicalSystem_projective([x^2-2*x*y-2*y^2, -2*x^2-2*x*y+y^2])
sage: f.automorphism_group(return_functions=True)
[x, 2/(2*x), -x - 1, -2*x/(2*x + 2), (-x - 1)/x, -1/(x + 1)]
[x, 1/x, -x - 1, -x/(x + 1), (-x - 1)/x, -1/(x + 1)]
::
Expand Down Expand Up @@ -5736,12 +5736,31 @@ def automorphism_group(self, absolute=False, iso_type=False, return_functions=Fa
sage: R.<x,y> = ProjectiveSpace(GF(3^2,'t'),1)
sage: f = DynamicalSystem_projective([x^3,y^3])
sage: f.automorphism_group(return_functions=True, iso_type=True) # long time
([x, x/(x + 1), x/(2*x + 1), 2/(x + 2), (2*x + 1)/(2*x), (2*x + 2)/x,
1/(2*x + 2), x + 1, x + 2, x/(x + 2), 2*x/(x + 1), 2*x, 1/x, 2*x + 1,
2*x + 2, ((t + 2)*x + t + 2)/((2*t + 1)*x + t + 2), (t*x + 2*t)/(t*x +
t), 2/x, (x + 1)/(x + 2), (2*t*x + t)/(t*x), (2*t + 1)/((2*t + 1)*x +
2*t + 1), ((2*t + 1)*x + 2*t + 1)/((2*t + 1)*x), t/(t*x + 2*t), (2*x +
1)/(x + 1)], 'PGL(2,3)')
([x,
x/(x + 1),
2*x/(x + 2),
2/(x + 2),
(x + 2)/x,
(2*x + 2)/x,
2/(x + 1),
x + 1,
x + 2,
x/(x + 2),
2*x/(x + 1),
2*x,
1/x,
2*x + 1,
2*x + 2,
(x + 2)/(x + 1),
2/x,
(2*x + 2)/(x + 2),
(x + 1)/(x + 2),
(2*x + 1)/x,
1/(x + 1),
1/(x + 2),
(2*x + 1)/(x + 1),
(x + 1)/x],
'PGL(2,3)')
::
Expand Down
6 changes: 3 additions & 3 deletions src/sage/groups/perm_gps/permgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4132,10 +4132,10 @@ def molien_series(self):
sage: G = SymmetricGroup(5)
sage: G.molien_series()
1/(-x^15 + x^14 + x^13 - x^10 - x^9 - x^8 + x^7 + x^6 + x^5 - x^2 - x + 1)
-1/(x^15 - x^14 - x^13 + x^10 + x^9 + x^8 - x^7 - x^6 - x^5 + x^2 + x - 1)
sage: G = SymmetricGroup(3)
sage: G.molien_series()
1/(-x^6 + x^5 + x^4 - x^2 - x + 1)
-1/(x^6 - x^5 - x^4 + x^2 + x - 1)
Some further tests (after :trac:`15817`)::
Expand Down Expand Up @@ -4212,7 +4212,7 @@ def poincare_series(self, p=2, n=10):
(x^2 + 1)/(x^4 - x^3 - x + 1)
sage: G = SymmetricGroup(3)
sage: G.poincare_series(2,10) # optional - gap_packages
1/(-x + 1)
-1/(x - 1)
AUTHORS:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matrix/matrix2.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ cdef class Matrix(Matrix1):
sage: v = vector([3,4*x - 2])
sage: X = A \ v
sage: X
((-8*x^2 + 4*x + 9)/(10*x^3 + x), (19*x^2 - 2*x - 3)/(10*x^3 + x))
((-4/5*x^2 + 2/5*x + 9/10)/(x^3 + 1/10*x), (19/10*x^2 - 1/5*x - 3/10)/(x^3 + 1/10*x))
sage: A * X == v
True

Expand Down
Loading

0 comments on commit f60348f

Please sign in to comment.