@@ -382,7 +382,7 @@ cdef class SkewPolynomial_finite_order_dense(SkewPolynomial_generic_dense):
382
382
polynomial is ``x`` and the name of central variable is usually ``z``
383
383
( see :meth:`~sage. rings. polynomial. skew_polynomial_ring. SkewPolynomialRing_finite_order. center`
384
384
for more details about this) .
385
- The user can speciify different names if desired::
385
+ The user can specify different names if desired::
386
386
387
387
sage: a. reduced_charpoly( var='T') # variable name for the caracteristic polynomial
388
388
T^ 3 + ( 2* z + 1) * T^ 2 + ( 3* z^ 2 + 4* z) * T + 4* z^ 3 + z^ 2 + 1
@@ -393,15 +393,30 @@ cdef class SkewPolynomial_finite_order_dense(SkewPolynomial_generic_dense):
393
393
.. SEEALSO::
394
394
395
395
:meth:`reduced_trace`, :meth:`reduced_norm`
396
+
397
+ TESTS:
398
+
399
+ We test that the cache works correctly::
400
+
401
+ sage: f = u^ 5 + t* u^ 4 + t^ 2* u^ 3 + t^ 3* u^ 2 + t^ 4* u + t^ 5
402
+ sage: f. reduced_norm( )
403
+ z^ 5 + 2* z^ 4 + 4* z^ 3 + z^ 2 + 4* z + 2
404
+ sage: f. reduced_charpoly( )
405
+ x^ 3 + z* x^ 2 + ( 2* z + 3) * x + 4* z^ 5 + 3* z^ 4 + z^ 3 + 4* z^ 2 + z + 3
406
+ sage: f. reduced_norm( )
407
+ z^ 5 + 2* z^ 4 + 4* z^ 3 + z^ 2 + 4* z + 2
396
408
"""
397
409
if self ._charpoly is None :
398
410
parent = self ._parent
399
411
section = parent._embed_constants.section()
400
412
M = self ._matmul_c()
401
413
chi = M.charpoly()
402
414
self ._charpoly = [tuple (c.list()) for c in chi.list()]
403
- if self ._norm is not None :
404
- self ._norm = self ._charpoly[- 1 ]
415
+ if self ._norm is None :
416
+ if len (self ._charpoly) % 2 :
417
+ self ._norm = self ._charpoly[0 ]
418
+ else :
419
+ self ._norm = tuple ((- chi[0 ]).list())
405
420
varcenter = None
406
421
if var is None :
407
422
varcharpoly = ' x'
0 commit comments