diff --git a/src/sage/categories/finite_complex_reflection_groups.py b/src/sage/categories/finite_complex_reflection_groups.py index f1897267140..83db9835f51 100644 --- a/src/sage/categories/finite_complex_reflection_groups.py +++ b/src/sage/categories/finite_complex_reflection_groups.py @@ -16,7 +16,6 @@ from sage.misc.cachefunc import cached_method from sage.categories.category_with_axiom import CategoryWithAxiom from sage.categories.coxeter_groups import CoxeterGroups -from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet class FiniteComplexReflectionGroups(CategoryWithAxiom): @@ -758,6 +757,8 @@ def absolute_order_ideal(self, gens=None, [1] 1 [] 0 """ + from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet + if gens is None: seeds = [(self.coxeter_element(), self.rank())] else: diff --git a/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py b/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py index bfe0de224b2..487924b5748 100644 --- a/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py +++ b/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py @@ -24,9 +24,7 @@ from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring from sage.categories.lie_algebras import LieAlgebras from sage.categories.subobjects import SubobjectsCategory -from sage.algebras.free_algebra import FreeAlgebra from sage.sets.family import Family -from sage.matrix.constructor import matrix class FiniteDimensionalLieAlgebrasWithBasis(CategoryWithAxiom_over_base_ring): @@ -97,6 +95,8 @@ def _construct_UEA(self): The 6-Witt Lie algebra over Ring of integers modulo 6 in the Poincare-Birkhoff-Witt basis """ + from sage.algebras.free_algebra import FreeAlgebra + # Create the UEA relations # We need to get names for the basis elements, not just the generators I = self._basis_ordering @@ -321,6 +321,8 @@ def killing_form_matrix(self): sage: parent(m) Full MatrixSpace of 0 by 0 dense matrices over Rational Field """ + from sage.matrix.constructor import matrix + B = self.basis() m = matrix(self.base_ring(), [[self.killing_form(x, y) for x in B] for y in B]) @@ -420,6 +422,8 @@ def centralizer_basis(self, S): D{1} + D{1, 2} + D{2, 3} + D{3}, D{1, 2, 3} + D{1, 3} + D{2}) """ + from sage.matrix.constructor import matrix + #from sage.algebras.lie_algebras.subalgebra import LieSubalgebra #if isinstance(S, LieSubalgebra) or S is self: if S is self: @@ -541,6 +545,7 @@ def derivations_basis(self): :wikipedia:`Derivation_(differential_algebra)` """ from sage.matrix.constructor import matrix + R = self.base_ring() B = self.basis() keys = list(B.keys()) @@ -581,6 +586,8 @@ def inner_derivations_basis(self): [1 0 0], [0 1 0] ) """ + from sage.matrix.constructor import matrix + R = self.base_ring() IDer = matrix(R, [b.adjoint_matrix().list() for b in self.basis()]) N = self.dimension() @@ -691,6 +698,9 @@ def is_ideal(self, A): if A not in LieAlgebras(self.base_ring()).FiniteDimensional().WithBasis(): raise NotImplementedError("A must be a finite dimensional" " Lie algebra with basis") + + from sage.matrix.constructor import matrix + B = self.basis() AB = A.basis() try: @@ -798,6 +808,8 @@ def product_space(self, L, submodule=False): Subalgebra generated of Lie algebra on 2 generators (x, y) over Rational Field with basis: () """ + from sage.matrix.constructor import matrix + # Make sure we lift everything to the ambient space if self in LieAlgebras(self.base_ring()).Subobjects(): A = self.ambient() @@ -1373,6 +1385,8 @@ def as_finite_dimensional_algebra(self): sage: X * Y Z """ + from sage.matrix.constructor import matrix + K = self._basis_ordering mats = [] R = self.base_ring() @@ -1606,6 +1620,8 @@ def adjoint_matrix(self, sparse=False): # In #11111 (more or less) by using matr sage: E1 * E2 - E2 * E1 == e12.adjoint_matrix() True """ + from sage.matrix.constructor import matrix + P = self.parent() basis = P.basis() return matrix(self.base_ring(), diff --git a/src/sage/categories/loop_crystals.py b/src/sage/categories/loop_crystals.py index e065b7ef4f6..415d8c308f7 100644 --- a/src/sage/categories/loop_crystals.py +++ b/src/sage/categories/loop_crystals.py @@ -19,8 +19,7 @@ from sage.categories.regular_crystals import RegularCrystals from sage.categories.tensor import TensorProductsCategory from sage.categories.map import Map -from sage.graphs.dot2tex_utils import have_dot2tex -from sage.functions.other import ceil + class LoopCrystals(Category_singleton): r""" @@ -117,6 +116,8 @@ def digraph(self, subset=None, index_set=None): {...'edge_options': ...} sage: view(G, tightpage=True) # optional - dot2tex graphviz, not tested (opens external window) """ + from sage.graphs.dot2tex_utils import have_dot2tex + G = Crystals().parent_class.digraph(self, subset, index_set) if have_dot2tex(): def eopt(u_v_label): @@ -959,6 +960,8 @@ def energy_function(self, algorithm=None): ....: for b in hw) True """ + from sage.functions.other import ceil + C = self.parent().crystals[0] ell = ceil(C.s()/C.cartan_type().c()[C.r()]) is_perfect = all(ell == K.s()/K.cartan_type().c()[K.r()] @@ -1090,6 +1093,8 @@ def e_string_to_ground_state(self): ....: for elt in hw) True """ + from sage.functions.other import ceil + ell = max(ceil(K.s()/K.cartan_type().c()[K.r()]) for K in self.parent().crystals) if self.cartan_type().dual().type() == 'BC': diff --git a/src/sage/categories/pushout.py b/src/sage/categories/pushout.py index 6c5b08e003a..cbeb1f30cb0 100644 --- a/src/sage/categories/pushout.py +++ b/src/sage/categories/pushout.py @@ -3462,8 +3462,8 @@ def merge(self, other): # nothing else helps, hence, we move to the pushout of the codomains of the embeddings try: P = pushout(self.embeddings[0].parent(), other.embeddings[0].parent()) - from sage.rings.number_field.number_field import is_NumberField - if is_NumberField(P): + from sage.rings.number_field.number_field_base import NumberField + if isinstance(P, NumberField): return P.construction()[0] except CoercionException: return None diff --git a/src/sage/categories/rings.py b/src/sage/categories/rings.py index 6a7589bb109..50dba914250 100644 --- a/src/sage/categories/rings.py +++ b/src/sage/categories/rings.py @@ -1159,7 +1159,10 @@ def normalize_arg(arg): if isinstance(arg, tuple): from sage.categories.morphism import Morphism - from sage.rings.derivation import RingDerivation + try: + from sage.rings.derivation import RingDerivation + except ImportError: + RingDerivation = () if len(arg) == 2 and isinstance(arg[1], (Morphism, RingDerivation)): from sage.rings.polynomial.ore_polynomial_ring import OrePolynomialRing return OrePolynomialRing(self, arg[1], names=arg[0])