code stringlengths 17 6.64M |
|---|
def is_linearly_dependent(polys) -> bool:
'\n Decide whether the polynomials of ``polys`` are linearly dependent.\n\n Here ``polys`` is a collection of polynomials.\n\n The algorithm creates a matrix of coefficients of the monomials of\n ``polys``. It computes the echelon form of the matrix, then chec... |
def linear_representation(p, polys):
'\n Assuming that ``p`` is a linear combination of ``polys``,\n determine coefficients that describe the linear combination.\n\n This probably does not work for any inputs except ``p``, a polynomial,\n and ``polys``, a sequence of polynomials.\n If ``p`` is not ... |
def triangular_factorization(B, n=(- 1)):
'\n Compute the triangular factorization of the Groebner basis ``B`` of an ideal.\n\n This will not work properly if ``B`` is not a Groebner basis!\n\n The algorithm used is that described in a 1992 paper by Daniel Lazard [Laz1992]_.\n It is not necessary for ... |
def elim_pol(B, n=(- 1)):
'\n Find the unique monic polynomial of lowest degree and lowest variable\n in the ideal described by ``B``.\n\n For the purposes of the triangularization algorithm, it is necessary to\n preserve the ring, so ``n`` specifies which variable to check.\n By default, we check ... |
def PowerSeriesRing(base_ring, name=None, arg2=None, names=None, sparse=False, default_prec=None, order='negdeglex', num_gens=None, implementation=None):
"\n Create a univariate or multivariate power series ring over a given\n (commutative) base ring.\n\n INPUT:\n\n\n - ``base_ring`` -- a commutative... |
def _multi_variate(base_ring, num_gens=None, names=None, order='negdeglex', default_prec=None, sparse=False):
'\n Construct multivariate power series ring.\n '
if (names is None):
raise TypeError('you must specify a variable name or names')
if (num_gens is None):
if isinstance(names,... |
def _single_variate():
pass
|
def is_PowerSeriesRing(R):
"\n Return ``True`` if this is a *univariate* power series ring. This is in\n keeping with the behavior of ``is_PolynomialRing``\n versus ``is_MPolynomialRing``.\n\n EXAMPLES::\n\n sage: from sage.rings.power_series_ring import is_PowerSeriesRing\n sage: is_Po... |
class PowerSeriesRing_generic(UniqueRepresentation, ring.CommutativeRing, Nonexact):
'\n A power series ring.\n '
def __init__(self, base_ring, name=None, default_prec=None, sparse=False, implementation=None, category=None):
"\n Initializes a power series ring.\n\n INPUT:\n\n\n ... |
class PowerSeriesRing_domain(PowerSeriesRing_generic, ring.IntegralDomain):
def fraction_field(self):
'\n Return the Laurent series ring over the fraction field of the base\n ring.\n\n This is actually *not* the fraction field of this ring, but its\n completion with respect to... |
class PowerSeriesRing_over_field(PowerSeriesRing_domain):
_default_category = CompleteDiscreteValuationRings()
def fraction_field(self):
'\n Return the fraction field of this power series ring, which is\n defined since this is over a field.\n\n This fraction field is just the Lau... |
def unpickle_power_series_ring_v0(base_ring, name, default_prec, sparse):
'\n Unpickle (deserialize) a univariate power series ring according to\n the given inputs.\n\n EXAMPLES::\n\n sage: P.<x> = PowerSeriesRing(QQ)\n sage: loads(dumps(P)) == P # indirect doctest\n True\n '
... |
class PuiseuxSeriesRing(UniqueRepresentation, CommutativeRing):
"\n Rings of Puiseux series.\n\n EXAMPLES::\n\n sage: P = PuiseuxSeriesRing(QQ, 'y')\n sage: y = P.gen()\n sage: f = y**(4/3) + y**(-5/6); f\n y^(-5/6) + y^(4/3)\n sage: f.add_bigoh(2)\n y^(-5/6) + y^(4... |
class AlgebraicField_common(sage.rings.abc.AlgebraicField_common):
'\n Common base class for the classes :class:`~AlgebraicRealField` and\n :class:`~AlgebraicField`.\n\n TESTS::\n\n sage: AA.is_finite()\n False\n sage: QQbar.is_finite()\n False\n '
class options(Global... |
class AlgebraicRealField(Singleton, AlgebraicField_common, sage.rings.abc.AlgebraicRealField):
'\n The field of algebraic reals.\n\n TESTS::\n\n sage: AA == loads(dumps(AA))\n True\n '
def __new__(cls):
'\n This method is there to ensure that pickles created before this ... |
def is_AlgebraicRealField(F):
'\n Check whether ``F`` is an :class:`~AlgebraicRealField` instance. For internal use.\n\n This function is deprecated. Use :func:`isinstance` with\n :class:`~sage.rings.abc.AlgebraicRealField` instead.\n\n EXAMPLES::\n\n sage: from sage.rings.qqbar import is_Algeb... |
class AlgebraicField(Singleton, AlgebraicField_common, sage.rings.abc.AlgebraicField):
'\n The field of all algebraic complex numbers.\n '
def __new__(cls):
'\n This method is there to ensure that pickles created before this class\n was made a :class:`~sage.misc.fast_methods.Singl... |
def is_AlgebraicField(F):
'\n Check whether ``F`` is an :class:`~AlgebraicField` instance.\n\n This function is deprecated. Use :func:`isinstance` with\n :class:`~sage.rings.abc.AlgebraicField` instead.\n\n EXAMPLES::\n\n sage: from sage.rings.qqbar import is_AlgebraicField\n sage: [is_A... |
def prec_seq():
'\n Return a generator object which iterates over an infinite increasing\n sequence of precisions to be tried in various numerical computations.\n\n Currently just returns powers of 2 starting at 64.\n\n EXAMPLES::\n\n sage: g = sage.rings.qqbar.prec_seq()\n sage: [next(g... |
def short_prec_seq():
'\n Return a sequence of precisions to try in cases when an infinite-precision\n computation is possible: returns a couple of small powers of 2 and then\n ``None``.\n\n EXAMPLES::\n\n sage: from sage.rings.qqbar import short_prec_seq\n sage: short_prec_seq()\n ... |
def tail_prec_seq():
'\n A generator over precisions larger than those in :func:`~short_prec_seq`.\n\n EXAMPLES::\n\n sage: from sage.rings.qqbar import tail_prec_seq\n sage: g = tail_prec_seq()\n sage: [next(g), next(g), next(g)]\n [256, 512, 1024]\n '
bits = 256
whil... |
def rational_exact_root(r, d):
"\n Check whether the rational `r` is an exact `d`'th power.\n\n If so, this returns the `d`'th root of `r`; otherwise, this returns ``None``.\n\n EXAMPLES::\n\n sage: from sage.rings.qqbar import rational_exact_root\n sage: rational_exact_root(16/81, 4)\n ... |
def clear_denominators(poly):
'\n Take a monic polynomial and rescale the variable to get a monic\n polynomial with "integral" coefficients.\n\n This works on any univariate\n polynomial whose base ring has a ``denominator()`` method that returns\n integers; for example, the base ring might be `\\Q... |
def do_polred(poly, threshold=32):
"\n Find a polynomial of reasonably small discriminant that generates\n the same number field as ``poly``, using the PARI ``polredbest``\n function.\n\n INPUT:\n\n - ``poly`` - a monic irreducible polynomial with integer coefficients\n - ``threshold`` - an inte... |
def isolating_interval(intv_fn, pol):
"\n ``intv_fn`` is a function that takes a precision and returns an\n interval of that precision containing some particular root of pol.\n (It must return better approximations as the precision increases.)\n pol is an irreducible polynomial with rational coefficie... |
def find_zero_result(fn, l):
"\n ``l`` is a list of some sort. ``fn`` is a function which maps an element of\n ``l`` and a precision into an interval (either real or complex) of that\n precision, such that for sufficient precision, exactly one element of ``l``\n results in an interval containing 0. Re... |
def conjugate_expand(v):
"\n If the interval ``v`` (which may be real or complex) includes some\n purely real numbers, return ``v'`` containing ``v`` such that\n ``v' == v'.conjugate()``. Otherwise return ``v`` unchanged. (Note that if\n ``v' == v'.conjugate()``, and ``v'`` includes one non-real root ... |
def conjugate_shrink(v):
"\n If the interval ``v`` includes some purely real numbers, return\n a real interval containing only those real numbers. Otherwise\n return ``v`` unchanged.\n\n If ``v`` includes exactly one root of a real polynomial, and ``v`` was\n returned by ``conjugate_expand()``, the... |
def number_field_elements_from_algebraics(numbers, minimal=False, same_field=False, embedded=False, name='a', prec=53):
"\n Given a sequence of elements of either ``AA`` or ``QQbar``\n (or a mixture), computes a number field containing all of these\n elements, these elements as members of that number fie... |
def cmp_elements_with_same_minpoly(a, b, p):
'\n Compare the algebraic elements ``a`` and ``b`` knowing that they have the\n same minimal polynomial ``p``.\n\n This is a helper function for comparison of algebraic elements (i.e. the\n methods :meth:`AlgebraicNumber._richcmp_` and\n :meth:`Algebraic... |
class AlgebraicGeneratorRelation(SageObject):
'\n A simple class for maintaining relations in the lattice of algebraic\n extensions.\n '
def __init__(self, child1, child1_poly, child2, child2_poly, parent):
'\n EXAMPLES::\n\n sage: from sage.rings.qqbar import AlgebraicGene... |
@richcmp_method
class AlgebraicGenerator(SageObject):
'\n An ``AlgebraicGenerator`` represents both an algebraic number `\\alpha` and\n the number field `\\QQ[\\alpha]`. There is a single ``AlgebraicGenerator``\n representing `\\QQ` (with `\\alpha=0`).\n\n The ``AlgebraicGenerator`` class is private, ... |
class ANDescr(SageObject):
'\n An ``AlgebraicNumber`` or ``AlgebraicReal`` is a wrapper around an\n ``ANDescr`` object. ``ANDescr`` is an abstract base class, which should\n never be directly instantiated; its concrete subclasses are ``ANRational``,\n ``ANBinaryExpr``, ``ANUnaryExpr``, ``ANRoot``, and... |
class AlgebraicNumber_base(sage.structure.element.FieldElement):
'\n This is the common base class for algebraic numbers (complex\n numbers which are the zero of a polynomial in `\\ZZ[x]`) and algebraic\n reals (algebraic numbers which happen to be real).\n\n ``AlgebraicNumber`` objects can be created... |
class AlgebraicNumber(AlgebraicNumber_base):
'\n The class for algebraic numbers (complex numbers which are the roots\n of a polynomial with integer coefficients). Much of its functionality\n is inherited from :class:`AlgebraicNumber_base`.\n\n .. automethod:: _richcmp_\n '
def __init__(self, ... |
class AlgebraicReal(AlgebraicNumber_base):
'\n A real algebraic number.\n\n .. automethod:: _richcmp_\n '
def __init__(self, x):
'\n Create an algebraic real from x, possibly taking the real part of x.\n\n TESTS:\n\n Both of the following examples, from :trac:`11728`, tr... |
class AlgebraicNumberPowQQAction(Action):
"\n Implement powering of an algebraic number (an element of ``QQbar``\n or ``AA``) by a rational.\n\n This is always a right action.\n\n INPUT:\n\n - ``G`` -- must be ``QQ``\n\n - ``S`` -- the parent on which to act, either ``AA`` or ``QQbar``.\n\n .... |
class ANRational(ANDescr):
'\n The subclass of :class:`ANDescr` that represents an arbitrary\n rational. This class is private, and should not be used directly.\n '
def __init__(self, x):
'\n TESTS::\n\n sage: polygen(QQbar) / int(3)\n 1/3*x\n '
if... |
def is_AlgebraicReal(x):
'\n Test if ``x`` is an instance of :class:`~AlgebraicReal`. For internal use.\n\n EXAMPLES::\n\n sage: from sage.rings.qqbar import is_AlgebraicReal\n sage: is_AlgebraicReal(AA(sqrt(2))) # needs sage.symbolic\n True\n... |
def is_AlgebraicNumber(x):
'\n Test if ``x`` is an instance of :class:`~AlgebraicNumber`. For internal use.\n\n EXAMPLES::\n\n sage: from sage.rings.qqbar import is_AlgebraicNumber\n sage: is_AlgebraicNumber(AA(sqrt(2))) # needs sage.symbolic\n ... |
class AlgebraicPolynomialTracker(SageObject):
'\n Keeps track of a polynomial used for algebraic numbers.\n\n If multiple algebraic numbers are created as roots of a single\n polynomial, this allows the polynomial and information about\n the polynomial to be shared. This reduces work if the polynomial... |
class ANRoot(ANDescr):
'\n The subclass of :class:`ANDescr` that represents a particular\n root of a polynomial with algebraic coefficients.\n This class is private, and should not be used directly.\n '
def __init__(self, poly, interval, multiplicity=1):
"\n Initialize this ``ANRoo... |
class ANExtensionElement(ANDescr):
'\n The subclass of :class:`ANDescr` that represents a number field\n element in terms of a specific generator. Consists of a polynomial\n with rational coefficients in terms of the generator, and the\n generator itself, an :class:`AlgebraicGenerator`.\n '
de... |
class ANUnaryExpr(ANDescr):
def __init__(self, arg, op):
"\n Initialize this ANUnaryExpr.\n\n EXAMPLES::\n\n sage: t = ~QQbar(sqrt(2)); type(t._descr) # indirect doctest # needs sage.symbolic\n <class 'sage.rings.qqbar.ANUnaryExpr'>\n "
se... |
class ANBinaryExpr(ANDescr):
def __init__(self, left, right, op):
"\n Initialize this ANBinaryExpr.\n\n EXAMPLES::\n\n sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)); type(t._descr) # indirect doctest # needs sage.symbolic\n <class 'sage.rings.qqbar.ANBinaryExpr'... |
def an_binop_rational(a, b, op):
"\n Used to add, subtract, multiply or divide algebraic numbers.\n\n Used when both are actually rational.\n\n EXAMPLES::\n\n sage: from sage.rings.qqbar import an_binop_rational\n sage: f = an_binop_rational(QQbar(2), QQbar(3/7), operator.add)\n sage... |
def an_binop_expr(a, b, op):
"\n Add, subtract, multiply or divide algebraic numbers represented as\n binary expressions.\n\n INPUT:\n\n - ``a``, ``b`` -- two elements\n\n - ``op`` -- an operator\n\n EXAMPLES::\n\n sage: # needs sage.symbolic\n sage: a = QQbar(sqrt(2)) + QQbar(sqrt... |
def an_binop_element(a, b, op):
"\n Add, subtract, multiply or divide two elements represented as elements of\n number fields.\n\n EXAMPLES::\n\n sage: sqrt2 = QQbar(2).sqrt()\n sage: sqrt3 = QQbar(3).sqrt()\n sage: sqrt5 = QQbar(5).sqrt()\n\n sage: a = sqrt2 + sqrt3; a.exacti... |
def _init_qqbar():
'\n This code indirectly uses a huge amount of sage, despite the fact\n that qqbar is imported rather early on in the sage loading. This function\n is called at the end of sage.all.\n\n EXAMPLES::\n\n sage: sage.rings.qqbar.QQbar_I_generator # indirect doctest\n Number... |
def get_AA_golden_ratio():
'\n Return the golden ratio as an element of the algebraic real field. Used by\n :meth:`sage.symbolic.constants.golden_ratio._algebraic_`.\n\n EXAMPLES::\n\n sage: AA(golden_ratio) # indirect doctest # needs sage.symbolic\n 1.... |
@decorator_keywords
def handle_AA_and_QQbar(func):
"\n Decorator to call a function that only accepts arguments in number fields.\n\n The argument list is scanned for ideals and/or polynomials over algebraic\n fields (``QQbar`` or ``AA``). If any exist, they are converted to a common\n number field b... |
def QuotientRing(R, I, names=None, **kwds):
"\n Creates a quotient ring of the ring `R` by the twosided ideal `I`.\n\n Variables are labeled by ``names`` (if the quotient ring is a quotient\n of a polynomial ring). If ``names`` isn't given, 'bar' will be appended\n to the variable names in `R`.\n\n ... |
def is_QuotientRing(x):
"\n Tests whether or not ``x`` inherits from :class:`QuotientRing_nc`.\n\n EXAMPLES::\n\n sage: from sage.rings.quotient_ring import is_QuotientRing\n sage: R.<x> = PolynomialRing(ZZ,'x')\n sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2])\n sage: S = R.quotient... |
@richcmp_method
class QuotientRing_nc(ring.Ring, sage.structure.parent_gens.ParentWithGens):
"\n The quotient ring of `R` by a twosided ideal `I`.\n\n This class is for rings that do not inherit from\n :class:`~sage.rings.ring.CommutativeRing`.\n\n EXAMPLES:\n\n Here is a quotient of a free algebra... |
class QuotientRing_generic(QuotientRing_nc, ring.CommutativeRing):
'\n Creates a quotient ring of a *commutative* ring `R` by the ideal `I`.\n\n EXAMPLES::\n\n sage: R.<x> = PolynomialRing(ZZ)\n sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2])\n sage: S = R.quotient_ring(I); S\n Quoti... |
class QuotientRingIdeal_generic(ideal.Ideal_generic):
'\n Specialized class for quotient-ring ideals.\n\n EXAMPLES::\n\n sage: Zmod(9).ideal([-6,9])\n Ideal (3, 0) of Ring of integers modulo 9\n '
def _contains_(self, other):
'\n Check whether this ideal contains the giv... |
class QuotientRingIdeal_principal(ideal.Ideal_principal, QuotientRingIdeal_generic):
'\n Specialized class for principal quotient-ring ideals.\n\n EXAMPLES::\n\n sage: Zmod(9).ideal(-33)\n Principal ideal (3) of Ring of integers modulo 9\n '
|
class QuotientRingElement(RingElement):
'\n An element of a quotient ring `R/I`.\n\n INPUT:\n\n - ``parent`` - the ring `R/I`\n\n - ``rep`` - a representative of the element in `R`; this is used\n as the internal representation of the element\n\n - ``reduce`` - bool (optional, default: True) -... |
class RationalField(Singleton, number_field_base.NumberField):
"\n The class ``RationalField`` represents the field `\\QQ` of rational numbers.\n\n EXAMPLES::\n\n sage: a = 901824309821093821093812093810928309183091832091\n sage: b = QQ(a); b\n 901824309821093821093812093810928309183091... |
def is_RationalField(x) -> bool:
'\n Check to see if ``x`` is the rational field.\n\n EXAMPLES::\n\n sage: from sage.rings.rational_field import is_RationalField as is_RF\n sage: is_RF(QQ)\n True\n sage: is_RF(ZZ)\n False\n '
return isinstance(x, RationalField)
|
def frac(n, d):
'\n Return the fraction ``n/d``.\n\n EXAMPLES::\n\n sage: from sage.rings.rational_field import frac\n sage: frac(1,2)\n 1/2\n '
return (Rational(n) / Rational(d))
|
def create_RealField(prec=53, type='MPFR', rnd='RNDN', sci_not=0):
"\n Create a real field with given precision, type, rounding mode and\n scientific notation.\n\n Some options are ignored for certain types (RDF for example).\n\n INPUT:\n\n - ``prec`` -- a positive integer\n\n - ``type`` -- type... |
class RingExtensionHomset(RingHomset_generic):
"\n A generic class for homsets between ring extensions.\n\n TESTS::\n\n sage: K = GF(5^2).over()\n sage: L = GF(5^8).over(K)\n sage: H = Hom(K,L)\n sage: H\n Set of Homomorphisms\n from Field in z2 with defining polyn... |
class NonNegativeIntegerSemiring(NonNegativeIntegers):
'\n A class for the semiring of the non negative integers\n\n This parent inherits from the infinite enumerated set of non\n negative integers and endows it with its natural semiring\n structure.\n\n EXAMPLES::\n\n sage: NonNegativeInteg... |
class TateAlgebraFactory(UniqueFactory):
"\n Construct a Tate algebra over a `p`-adic field.\n\n Given a `p`-adic field `K`, variables `X_1,\\dots,X_k`\n and convergence log radii `v_1, \\dots, v_n` in `\\RR`, the corresponding\n Tate algebra `K{X_1,\\dots,X_k}` consists of power series with\n coef... |
class TateTermMonoid(Monoid_class, UniqueRepresentation):
'\n A base class for Tate algebra terms\n\n A term in a Tate algebra `K\\{X_1,\\dots,X_n\\}` (resp. in its ring of\n integers) is a monomial in this ring.\n\n Those terms form a pre-ordered monoid, with term multiplication and the\n term ord... |
class TateAlgebra_generic(Parent):
def __init__(self, field, prec, log_radii, names, order, integral=False):
'\n Initialize the Tate algebra\n\n TESTS::\n\n sage: A.<x,y> = TateAlgebra(Zp(2), log_radii=1)\n sage: TestSuite(A).run()\n\n We check that univariate T... |
def prime_finite_field():
'\n Create a random prime finite field with cardinality at most 10^20.\n\n OUTPUT: a prime finite field\n\n EXAMPLES::\n\n sage: import sage.rings.tests\n sage: K = sage.rings.tests.prime_finite_field(); K # needs sage.rings.finite_ring... |
def finite_field():
'\n Create a random finite field with degree at most 20 and prime at most 10^6.\n\n OUTPUT: a finite field\n\n EXAMPLES::\n\n sage: import sage.rings.tests\n sage: K = sage.rings.tests.finite_field(); K # needs sage.rings.finite_rings\n... |
def small_finite_field():
'\n Create a random finite field with cardinality at most 2^16.\n\n OUTPUT: a finite field\n\n EXAMPLES::\n\n sage: # needs sage.rings.finite_rings\n sage: import sage.rings.tests\n sage: K = sage.rings.tests.small_finite_field(); K\n Finite Field...o... |
def integer_mod_ring():
'\n Return a random ring of integers modulo n with n at most 50000.\n\n EXAMPLES::\n\n sage: import sage.rings.tests\n sage: R = sage.rings.tests.integer_mod_ring(); R\n Ring of integers modulo ...\n sage: R.cardinality() <= 50000\n True\n '
... |
def padic_field():
'\n Return a random p-adic field modulo n with p at most 10000\n and precision between 10 and 100.\n\n EXAMPLES::\n\n sage: import sage.rings.tests\n sage: sage.rings.tests.padic_field() # needs sage.rings.padics\n ...-adi... |
def quadratic_number_field():
'\n Return a quadratic extension of QQ.\n\n EXAMPLES::\n\n sage: import sage.rings.tests\n sage: K = sage.rings.tests.quadratic_number_field(); K # needs sage.rings.number_field\n Number Field in a with defining polynomial x^2 ... w... |
def absolute_number_field(maxdeg=10):
'\n Return an absolute extension of QQ of degree at most 10.\n\n EXAMPLES::\n\n sage: import sage.rings.tests\n sage: K = sage.rings.tests.absolute_number_field(); K # needs sage.rings.number_field\n Number Field in a with ... |
def relative_number_field(n=2, maxdeg=2):
'\n Return a tower of at most n extensions each of degree at most maxdeg.\n\n EXAMPLES::\n\n sage: # needs sage.rings.number_field\n sage: import sage.rings.tests\n sage: K = sage.rings.tests.relative_number_field(3); K\n Number Field in ... |
def rings0():
"\n Return a list of pairs (f, desc), where f is a function that when\n called creates a random ring of a certain representative type\n described by desc.\n\n RINGS:\n\n - ZZ\n - QQ\n - ZZ/nZZ\n - GF(p)\n - GF(q)\n - p-adic fields\n - quadratic number fields\n - a... |
def rings1():
"\n Return an iterator over random rings.\n\n Return a list of pairs (f, desc), where f is a function that\n outputs a random ring that takes a ring and possibly\n some other data as constructor.\n\n RINGS:\n\n - polynomial ring in one variable over a rings0() ring.\n - polynomi... |
def random_rings(level=MAX_LEVEL):
'\n Return an iterator over random rings up to the given "level" of complexity.\n\n EXAMPLES::\n\n sage: import sage.rings.tests\n sage: type(sage.rings.tests.random_rings())\n <... \'generator\'>\n '
v = rings0()
if (level >= 1):
v ... |
@random_testing
def test_random_elements(level=MAX_LEVEL, trials=1):
'\n Create random elements of random rings until a crash occurs, in\n which case an exception is raised. Defaults to running a single\n trial, but more can be specified. To run tests in an infinite\n loop, you could use::\n\n ... |
@random_testing
def test_random_arith(level=MAX_LEVEL, trials=1):
'\n Create random elements of random rings and do some arithmetic with them.\n\n Repeats until a crash occurs, in which case an exception is\n raised. Defaults to running a single trial, but more can be\n specified. To run tests in an... |
@random_testing
def test_karatsuba_multiplication(base_ring, maxdeg1, maxdeg2, ref_mul=(lambda f, g: f._mul_generic(g)), base_ring_random_elt_args=[], numtests=10, verbose=False):
"\n Test univariate Karatsuba multiplication against other multiplication algorithms.\n\n EXAMPLES:\n\n First check that rand... |
def late_import():
'\n This function avoids importing libgap on startup. It is called once through\n the constructor of :class:`UniversalCyclotomicField`.\n\n EXAMPLES::\n\n sage: import sage.rings.universal_cyclotomic_field as ucf\n sage: _ = UniversalCyclotomicField() # indirect doctest... |
def UCF_sqrt_int(N, UCF):
'\n Return the square root of the integer ``N``.\n\n EXAMPLES::\n\n sage: from sage.rings.universal_cyclotomic_field import UCF_sqrt_int\n sage: UCF = UniversalCyclotomicField()\n sage: UCF_sqrt_int(0, UCF)\n 0\n sage: UCF_sqrt_int(1, UCF)\n ... |
class UCFtoQQbar(Morphism):
'\n Conversion to ``QQbar``.\n\n EXAMPLES::\n\n sage: UCF = UniversalCyclotomicField()\n sage: QQbar(UCF.gen(3))\n -0.500000000000000? + 0.866025403784439?*I\n\n sage: CC(UCF.gen(7,2) + UCF.gen(7,6))\n 0.400968867902419 + 0.193096429713793*I\n\n... |
class UniversalCyclotomicFieldElement(FieldElement):
def __init__(self, parent, obj):
'\n INPUT:\n\n - ``parent`` -- a universal cyclotomic field\n\n - ``obj`` -- a libgap element (either an integer, a rational or a\n cyclotomic)\n\n TESTS::\n\n sage: UCF =... |
class UniversalCyclotomicField(UniqueRepresentation, sage.rings.abc.UniversalCyclotomicField):
'\n The universal cyclotomic field.\n\n The universal cyclotomic field is the infinite algebraic extension of `\\QQ`\n generated by the roots of unity. It is also the maximal Abelian extension of\n `\\QQ` in... |
def E(n, k=1):
'\n Return the ``n``-th root of unity as an element of the universal cyclotomic\n field.\n\n EXAMPLES::\n\n sage: E(3)\n E(3)\n sage: E(3) + E(5)\n -E(15)^2 - 2*E(15)^8 - E(15)^11 - E(15)^13 - E(15)^14\n '
return UniversalCyclotomicField().gen(n, k)
|
class AugmentedValuationFactory(UniqueFactory):
'\n Factory for augmented valuations.\n\n EXAMPLES:\n\n This factory is not meant to be called directly. Instead,\n :meth:`~sage.rings.valuation.inductive_valuation.NonFinalInductiveValuation.augmentation`\n of a valuation should be called::\n\n ... |
class AugmentedValuation_base(InductiveValuation):
'\n An augmented valuation is a discrete valuation on a polynomial ring. It\n extends another discrete valuation `v` by setting the valuation of a\n polynomial `f` to the minimum of `v(f_i)i\\mu` when writing `f=\\sum_i\n f_i\\phi^i`.\n\n INPUT:\n\... |
class FinalAugmentedValuation(AugmentedValuation_base, FinalInductiveValuation):
'\n An augmented valuation which can not be augmented anymore, either because\n it augments a trivial valuation or because it is infinite.\n\n EXAMPLES::\n\n sage: R.<x> = QQ[]\n sage: v = GaussValuation(R, val... |
class NonFinalAugmentedValuation(AugmentedValuation_base, NonFinalInductiveValuation):
'\n An augmented valuation which can be augmented further.\n\n EXAMPLES::\n\n sage: R.<x> = QQ[]\n sage: v = GaussValuation(R, QQ.valuation(2))\n sage: w = v.augmentation(x^2 + x + 1, 1)\n\n '
... |
class FiniteAugmentedValuation(AugmentedValuation_base, FiniteInductiveValuation):
'\n A finite augmented valuation, i.e., an augmented valuation which is\n discrete, or equivalently an augmented valuation which assigns to its last\n key polynomial a finite valuation.\n\n EXAMPLES::\n\n sage: #... |
class FinalFiniteAugmentedValuation(FiniteAugmentedValuation, FinalAugmentedValuation):
'\n An augmented valuation which is discrete, i.e., which assigns a finite\n valuation to its last key polynomial, but which can not be further\n augmented.\n\n EXAMPLES::\n\n sage: R.<x> = QQ[]\n sag... |
class NonFinalFiniteAugmentedValuation(FiniteAugmentedValuation, NonFinalAugmentedValuation):
'\n An augmented valuation which is discrete, i.e., which assigns a finite\n valuation to its last key polynomial, and which can be augmented further.\n\n EXAMPLES::\n\n sage: R.<x> = QQ[]\n sage: ... |
class InfiniteAugmentedValuation(FinalAugmentedValuation, InfiniteInductiveValuation):
'\n An augmented valuation which is infinite, i.e., which assigns valuation\n infinity to its last key polynomial (and which can therefore not be\n augmented further.)\n\n EXAMPLES::\n\n sage: R.<x> = QQ[]\n ... |
class DevelopingValuation(DiscretePseudoValuation):
'\n Abstract base class for a discrete valuation of polynomials defined over\n the polynomial ring ``domain`` by the `\\phi`-adic development.\n\n EXAMPLES::\n\n sage: R.<x> = QQ[]\n sage: v = GaussValuation(R, QQ.valuation(7))\n\n TEST... |
class GaussValuationFactory(UniqueFactory):
'\n Create a Gauss valuation on ``domain``.\n\n INPUT:\n\n - ``domain`` -- a univariate polynomial ring\n\n - ``v`` -- a valuation on the base ring of ``domain``, the underlying\n valuation on the constants of the polynomial ring (if unspecified take\n ... |
class GaussValuation_generic(NonFinalInductiveValuation):
'\n A Gauss valuation on a polynomial ring ``domain``.\n\n INPUT:\n\n - ``domain`` -- a univariate polynomial ring over a valued ring `R`\n\n - ``v`` -- a discrete valuation on `R`\n\n EXAMPLES::\n\n sage: R = Zp(3,5)\n sage: S... |
class InductiveValuation(DevelopingValuation):
'\n Abstract base class for iterated :mod:`augmented valuations <sage.rings.valuation.augmented_valuation>` on top of a :mod:`Gauss valuation <sage.rings.valuation.gauss_valuation>`.\n\n EXAMPLES::\n\n sage: R.<x> = QQ[]\n sage: v = GaussValuation... |
class FiniteInductiveValuation(InductiveValuation, DiscreteValuation):
'\n Abstract base class for iterated :mod:`augmented valuations <sage.rings.valuation.augmented_valuation>`\n on top of a :mod:`Gauss valuation <sage.rings.valuation.gauss_valuation>` which is a discrete valuation,\n i.e., the last ke... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.