rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
through `(x - a)^n`. | through `(x - a)^n`. Functions in more variables are also supported. | def taylor(f, v, a, n): """ Expands self in a truncated Taylor or Laurent series in the variable `v` around the point `a`, containing terms through `(x - a)^n`. INPUT: - ``v`` - variable - ``a`` - number - ``n`` - integer EXAMPLES:: sage: var('x,k,n') (x, k, n) sage: taylor (sqrt (1 - k^2*sin(x)^2), x, 0, 6)... |
- ``v`` - variable - ``a`` - number - ``n`` - integer | - ``*args`` - the following notation is supported - ``x, a, n`` - variable, point, degree - ``(x, a), (y, b), ..., n`` - variables with points, degree of polynomial | def taylor(f, v, a, n): """ Expands self in a truncated Taylor or Laurent series in the variable `v` around the point `a`, containing terms through `(x - a)^n`. INPUT: - ``v`` - variable - ``a`` - number - ``n`` - integer EXAMPLES:: sage: var('x,k,n') (x, k, n) sage: taylor (sqrt (1 - k^2*sin(x)^2), x, 0, 6)... |
return f.taylor(v=v,a=a,n=n) | return f.taylor(*args) | def taylor(f, v, a, n): """ Expands self in a truncated Taylor or Laurent series in the variable `v` around the point `a`, containing terms through `(x - a)^n`. INPUT: - ``v`` - variable - ``a`` - number - ``n`` - integer EXAMPLES:: sage: var('x,k,n') (x, k, n) sage: taylor (sqrt (1 - k^2*sin(x)^2), x, 0, 6)... |
return QuotientRingElement(self.parent(), self.__rep + right.__rep) | return self.parent()(self.__rep + right.__rep) | def _add_(self, right): """ Add quotient ring element ``self`` to another quotient ring element, ``right``. If the quotient is `R/I`, the addition is carried out in `R` and then reduced to `R/I`. |
return QuotientRingElement(self.parent(), self.__rep - right.__rep) | return self.parent()(self.__rep - right.__rep) | def _sub_(self, right): """ Subtract quotient ring element ``right`` from quotient ring element ``self``. If the quotient is `R/I`, the subtraction is carried out in `R` and then reduced to `R/I`. |
return QuotientRingElement(self.parent(), self.__rep * right.__rep) | return self.parent()(self.__rep * right.__rep) | def _mul_(self, right): """ Multiply quotient ring element ``self`` by another quotient ring element, ``right``. If the quotient is `R/I`, the multiplication is carried out in `R` and then reduced to `R/I`. |
return QuotientRingElement(self.parent(), -self.__rep) | return self.parent()(-self.__rep) | def __neg__(self): """ EXAMPLES:: sage: R.<x,y> = QQ[]; S.<a,b> = R.quo(x^2 + y^2); type(a) <class 'sage.rings.quotient_ring_element.QuotientRingElement'> sage: -a # indirect doctest -a sage: -(a+b) -a - b """ return QuotientRingElement(self.parent(), -self.__rep) |
return QuotientRingElement(self.parent(), inv) | return self.parent()(inv) | def __invert__(self): """ EXAMPLES:: sage: R.<x,y> = QQ[]; S.<a,b> = R.quo(x^2 + y^2); type(a) <class 'sage.rings.quotient_ring_element.QuotientRingElement'> sage: ~S(2/3) 3/2 |
return QuotientRingElement(self.parent(),self.__rep.lt()) | return self.parent()(self.__rep.lt()) | def lt(self): """ Return the leading term of this quotient ring element. EXAMPLE:: sage: R.<x,y,z>=PolynomialRing(GF(7),3,order='lex') sage: I = sage.rings.ideal.FieldIdeal(R) sage: Q = R.quo( I ) sage: f = Q( z*y + 2*x ) sage: f.lt() 2*xbar |
return QuotientRingElement(self.parent(),self.__rep.lm()) | return self.parent()(self.__rep.lm()) | def lm(self): """ Return the leading monomial of this quotient ring element. EXAMPLE:: sage: R.<x,y,z>=PolynomialRing(GF(7),3,order='lex') sage: I = sage.rings.ideal.FieldIdeal(R) sage: Q = R.quo( I ) sage: f = Q( z*y + 2*x ) sage: f.lm() xbar TESTS:: sage: R.<x,y> = QQ[]; S.<a,b> = R.quo(x^2 + y^2); type(a) <class... |
return tuple([QuotientRingElement(self.parent(),v) for v in self.__rep.variables()]) | return tuple([self.parent()(v) for v in self.__rep.variables()]) | def variables(self): """ EXAMPLES:: sage: R.<x,y> = QQ[]; S.<a,b> = R.quo(x^2 + y^2); type(a) <class 'sage.rings.quotient_ring_element.QuotientRingElement'> sage: a.variables() (a,) sage: b.variables() (b,) sage: s = a^2 + b^2 + 1; s 1 sage: s.variables() () sage: (a+b).variables() (a, b) """ return tuple([QuotientRin... |
return [QuotientRingElement(self.parent(),m) for m in self.__rep.monomials()] | return [self.parent()(m) for m in self.__rep.monomials()] | def monomials(self): """ EXAMPLES:: sage: R.<x,y> = QQ[]; S.<a,b> = R.quo(x^2 + y^2); type(a) <class 'sage.rings.quotient_ring_element.QuotientRingElement'> sage: a.monomials() [a] sage: (a+a*b).monomials() [a*b, a] """ return [QuotientRingElement(self.parent(),m) for m in self.__rep.monomials()] |
sage: cmp(c1, 1) | sage: cmp(c1, 1) * cmp(1, c1) | def __cmp__(self, right): r""" Compare ``self`` and ``right``. INPUT: - ``right`` -- anything. OUTPUT: - 0 if ``right`` is of the same type as ``self`` and their rays are the same and listed in the same order. 1 or -1 otherwise. TESTS:: sage: c1 = Cone([(1,0), (0,1)]) sage: c2 = Cone([(0,1), (1,0)]) sage: c3 = Co... |
def _limit_latex_(*args): | def _limit_latex_(self, f, x, a): | def _limit_latex_(*args): r""" Return latex expression for limit of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _limit_latex_ sage: var('x,a') (x, a) sage: f(x) = function('f',x) sage: _limit_latex_(f(x), x, a) '\\lim_{x \\to a}\\, f\\left(x\\right)' AUTHORS: - Golam Mortuza Hossain (20... |
sage: f(x) = function('f',x) sage: _limit_latex_(f(x), x, a) | sage: f = function('f',x) sage: _limit_latex_(0, f, x, a) | def _limit_latex_(*args): r""" Return latex expression for limit of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _limit_latex_ sage: var('x,a') (x, a) sage: f(x) = function('f',x) sage: _limit_latex_(f(x), x, a) '\\lim_{x \\to a}\\, f\\left(x\\right)' AUTHORS: - Golam Mortuza Hossain (20... |
f = args[0] x = args[1] a = args[2] | def _limit_latex_(*args): r""" Return latex expression for limit of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _limit_latex_ sage: var('x,a') (x, a) sage: f(x) = function('f',x) sage: _limit_latex_(f(x), x, a) '\\lim_{x \\to a}\\, f\\left(x\\right)' AUTHORS: - Golam Mortuza Hossain (20... | |
def _integrate_latex_(*args): | def _integrate_latex_(self, f, x, *args): | def _integrate_latex_(*args): r""" Return LaTeX expression for integration of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _integrate_latex_ sage: var('x,a,b') (x, a, b) sage: f(x) = function('f',x) sage: _integrate_latex_(f(x),x) '\\int f\\left(x\\right)\\,{d x}' sage: _integrate_latex_(f... |
sage: f(x) = function('f',x) sage: _integrate_latex_(f(x),x) | sage: f = function('f',x) sage: _integrate_latex_(0,f,x) | def _integrate_latex_(*args): r""" Return LaTeX expression for integration of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _integrate_latex_ sage: var('x,a,b') (x, a, b) sage: f(x) = function('f',x) sage: _integrate_latex_(f(x),x) '\\int f\\left(x\\right)\\,{d x}' sage: _integrate_latex_(f... |
sage: _integrate_latex_(f(x),x,a,b) | sage: _integrate_latex_(0,f,x,a,b) | def _integrate_latex_(*args): r""" Return LaTeX expression for integration of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _integrate_latex_ sage: var('x,a,b') (x, a, b) sage: f(x) = function('f',x) sage: _integrate_latex_(f(x),x) '\\int f\\left(x\\right)\\,{d x}' sage: _integrate_latex_(f... |
f = args[0] x = args[1] | def _integrate_latex_(*args): r""" Return LaTeX expression for integration of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _integrate_latex_ sage: var('x,a,b') (x, a, b) sage: f(x) = function('f',x) sage: _integrate_latex_(f(x),x) '\\int f\\left(x\\right)\\,{d x}' sage: _integrate_latex_(f... | |
if len(args) == 4: a = args[2] b = args[3] | if len(args) == 2: a, b = args | def _integrate_latex_(*args): r""" Return LaTeX expression for integration of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _integrate_latex_ sage: var('x,a,b') (x, a, b) sage: f(x) = function('f',x) sage: _integrate_latex_(f(x),x) '\\int f\\left(x\\right)\\,{d x}' sage: _integrate_latex_(f... |
def _laplace_latex_(*args): | def _laplace_latex_(self, *args): | def _laplace_latex_(*args): r""" Return LaTeX expression for Laplace transform of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _laplace_latex_ sage: var('s,t') (s, t) sage: f(t) = function('f',t) sage: _laplace_latex_(f(t),t,s) '\\mathcal{L}\\left(f\\left(t\\right), t, s\\right)' AUTHORS:... |
sage: f(t) = function('f',t) sage: _laplace_latex_(f(t),t,s) | sage: f = function('f',t) sage: _laplace_latex_(0,f,t,s) | def _laplace_latex_(*args): r""" Return LaTeX expression for Laplace transform of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _laplace_latex_ sage: var('s,t') (s, t) sage: f(t) = function('f',t) sage: _laplace_latex_(f(t),t,s) '\\mathcal{L}\\left(f\\left(t\\right), t, s\\right)' AUTHORS:... |
def _inverse_laplace_latex_(*args): | def _inverse_laplace_latex_(self, *args): | def _inverse_laplace_latex_(*args): r""" Return LaTeX expression for inverse Laplace transform of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _inverse_laplace_latex_ sage: var('s,t') (s, t) sage: F(s) = function('F',s) sage: _inverse_laplace_latex_(F(s),s,t) '\\mathcal{L}^{-1}\\left(F\\le... |
sage: F(s) = function('F',s) sage: _inverse_laplace_latex_(F(s),s,t) | sage: F = function('F',s) sage: _inverse_laplace_latex_(0,F,s,t) | def _inverse_laplace_latex_(*args): r""" Return LaTeX expression for inverse Laplace transform of a symbolic function. EXAMPLES:: sage: from sage.calculus.calculus import _inverse_laplace_latex_ sage: var('s,t') (s, t) sage: F(s) = function('F',s) sage: _inverse_laplace_latex_(F(s),s,t) '\\mathcal{L}^{-1}\\left(F\\le... |
TypeError, "No lookup table provided." | raise TypeError("No lookup table provided.") | def __init__(self, *args, **kwargs): """ Construct a substitution box (S-box) for a given lookup table `S`. |
if not ZZ(len(S)).is_power_of(2): raise TypeError("Lookup table length is not a power of 2.") | def __init__(self, *args, **kwargs): """ Construct a substitution box (S-box) for a given lookup table `S`. | |
length = ZZ(len(S)).exact_log(2) if length != int(length): TypeError, "lookup table length is not a power of 2." self.m = int(length) | self.m = ZZ(len(S)).exact_log(2) | def __init__(self, *args, **kwargs): """ Construct a substitution box (S-box) for a given lookup table `S`. |
def random_element(self, prec, bound=None): | def random_element(self, prec=None, *args, **kwds): | def random_element(self, prec, bound=None): r""" Return a random power series. INPUT: - ``prec`` - an integer - ``bound`` - an integer (default: None, which tries to spread choice across ring, if implemented) OUTPUT: - ``power series`` - a power series such that the coefficient of `x^i`, for `i` up to ``degr... |
- ``prec`` - an integer - ``bound`` - an integer (default: None, which tries to spread choice across ring, if implemented) | - ``prec`` - Integer specifying precision of output (default: default precision of self) - ``*args, **kwds`` - Passed on to the ``random_element`` method for the base ring | def random_element(self, prec, bound=None): r""" Return a random power series. INPUT: - ``prec`` - an integer - ``bound`` - an integer (default: None, which tries to spread choice across ring, if implemented) OUTPUT: - ``power series`` - a power series such that the coefficient of `x^i`, for `i` up to ``degr... |
- ``power series`` - a power series such that the coefficient of `x^i`, for `i` up to ``degree``, are coercions to the base ring of random integers between -``bound`` and ``bound``. IMPLEMENTATION: Call the random_element method on the underlying | - Power series with precision ``prec`` whose coefficients are random elements from the base ring, randomized subject to the arguments ``*args`` and ``**kwds`` IMPLEMENTATION:: Call the ``random_element`` method on the underlying | def random_element(self, prec, bound=None): r""" Return a random power series. INPUT: - ``prec`` - an integer - ``bound`` - an integer (default: None, which tries to spread choice across ring, if implemented) OUTPUT: - ``power series`` - a power series such that the coefficient of `x^i`, for `i` up to ``degr... |
sage: R.random_element(5,20) 1/15 + 19/17*t + 10/3*t^2 + 5/2*t^3 + 1/2*t^4 + O(t^5) """ return self(self.__poly_ring.random_element(prec, bound), prec) | sage: R.random_element(10) -1/2 + 2*t - 2/7*t^2 - 25*t^3 - t^4 + 2*t^5 - 4*t^7 - 1/3*t^8 - t^9 + O(t^10) If given no argument, random_element uses default precision of self:: sage: T = PowerSeriesRing(ZZ,'t') sage: T.default_prec() 20 sage: T.random_element() 4 + 2*t - t^2 - t^3 + 2*t^4 + t^5 + t^6 - 2*t^7 - t^8 - t^... | def random_element(self, prec, bound=None): r""" Return a random power series. INPUT: - ``prec`` - an integer - ``bound`` - an integer (default: None, which tries to spread choice across ring, if implemented) OUTPUT: - ``power series`` - a power series such that the coefficient of `x^i`, for `i` up to ``degr... |
sage: phi,theta=var('phi theta') sage: Y=spherical_harmonic(2,1,theta,phi) sage: rea=spherical_plot3d(abs(real(Y)),(phi,0,2*pi),(theta,0,pi),color='blue',opacity=0.6) sage: ima=spherical_plot3d(abs(imag(Y)),(phi,0,2*pi),(theta,0,pi),color='red' ,opacity=0.6) sage: (rea+ima).show(aspect_ratio=1) | sage: phi, theta = var('phi, theta') sage: Y = spherical_harmonic(2, 1, theta, phi) sage: rea = spherical_plot3d(abs(real(Y)), (phi,0,2*pi), (theta,0,pi), color='blue', opacity=0.6) sage: ima = spherical_plot3d(abs(imag(Y)), (phi,0,2*pi), (theta,0,pi), color='red', opacity=0.6) sage: (rea + ima).show(aspect_ratio=1) | def spherical_plot3d(f, urange, vrange, **kwds): """ Plots a function in spherical coordinates. This function is equivalent to:: sage: r,u,v=var('r,u,v') sage: f=u*v; urange=(u,0,pi); vrange=(v,0,pi) sage: T = (r*cos(u)*sin(v), r*sin(u)*sin(v), r*cos(v), [u,v]) sage: plot3d(f, urange, vrange, transformation=T) or eq... |
sage: m = matrix(3, lambda i,j: i-j) | sage: m = matrix(3, lambda i,j: i-j); m | def matrix(*args, **kwds): """ Create a matrix. INPUT: The matrix command takes the entries of a matrix, optionally preceded by a ring and the dimensions of the matrix, and returns a matrix. The entries of a matrix can be specified as a flat list of elements, a list of lists (i.e., a list of rows), a list of Sage vec... |
if self.ambient_vector_space() != other.ambient_vector_space(): return False if other == other.ambient_vector_space(): return True | try: if self.ambient_vector_space() != other.ambient_vector_space(): return False if other == other.ambient_vector_space(): return True except AttributeError: pass | def is_submodule(self, other): """ Return True if self is a submodule of other. EXAMPLES:: sage: M = FreeModule(ZZ,3) sage: V = M.ambient_vector_space() sage: X = V.span([[1/2,1/2,0],[1/2,0,1/2]], ZZ) sage: Y = V.span([[1,1,1]], ZZ) sage: N = X + Y sage: M.is_submodule(X) False sage: M.is_submodule(Y) False sage: Y.i... |
""" | Multi-edged and looped graphs are partially supported:: sage: G = Graph({0:[1,1]}, multiedges=True) sage: G.is_planar() True sage: G.is_planar(on_embedding={}) Traceback (most recent call last): ... NotImplementedError: Cannot compute with embeddings of multiple-edged or looped graphs. sage: G.is_planar(set_pos=True) ... | def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, set_pos=False): """ Returns True if the graph is planar, and False otherwise. This wraps the reference implementation provided by John Boyer of the linear time planarity algorithm by edge addition due to Boyer Myrvold. (See reference code in ... |
def rational_points(self, algorithm="enum", sort=True): | def rational_points_iterator(self): | def rational_points(self, algorithm="enum", sort=True): r""" Return the rational points on this curve computed via enumeration. |
Return the rational points on this curve computed via enumeration. INPUT: - ``algorithm`` (string, default: 'enum') -- the algorithm to use. Currently this is ignored. - ``sort`` (boolean, default ``True``) -- whether the output points should be sorted. If False, the order of the output is non-deterministic. | Return a generator object for the rational points on this curve. INPUT: - ``self`` -- a projective curve | def rational_points(self, algorithm="enum", sort=True): r""" Return the rational points on this curve computed via enumeration. |
A list of all the rational points on the curve defined over its base field, possibly sorted. .. note:: This is a slow Python-level implementation. EXAMPLES:: sage: F = GF(5) | A generator of all the rational points on the curve defined over its base field. EXAMPLE:: sage: F = GF(37) sage: P2.<X,Y,Z> = ProjectiveSpace(F,2) sage: C = Curve(X^7+Y*X*Z^5*55+Y^7*12) sage: len(list(C.rational_points_iterator())) 37 :: sage: F = GF(2) | def rational_points(self, algorithm="enum", sort=True): r""" Return the rational points on this curve computed via enumeration. |
sage: C = Curve(X^3+Y^3-Z^3) sage: C.rational_points() [(0 : 1 : 1), (1 : 0 : 1), (2 : 2 : 1), (3 : 4 : 1), (4 : 1 : 0), (4 : 3 : 1)] sage: C.rational_points(sort=False) [(4 : 1 : 0), (1 : 0 : 1), (0 : 1 : 1), (2 : 2 : 1), (4 : 3 : 1), (3 : 4 : 1)] :: sage: F = GF(1009) sage: P2.<X,Y,Z> = ProjectiveSpace(F,2) sage: C... | sage: C = Curve(X*Y*Z) sage: a = C.rational_points_iterator() sage: a.next() (1 : 0 : 0) sage: a.next() (0 : 1 : 0) sage: a.next() (1 : 1 : 0) sage: a.next() (0 : 0 : 1) sage: a.next() (1 : 0 : 1) sage: a.next() (0 : 1 : 1) sage: a.next() Traceback (most recent call last): ... StopIteration | def rational_points(self, algorithm="enum", sort=True): r""" Return the rational points on this curve computed via enumeration. |
sage: F = GF(2^6,'a') sage: P2.<X,Y,Z> = ProjectiveSpace(F,2) sage: C = Curve(X^5+11*X*Y*Z^3 + X^2*Y^3 - 13*Y^2*Z^3) sage: len(C.rational_points()) 104 :: sage: R.<x,y,z> = GF(2)[] sage: f = x^3*y + y^3*z + x*z^3 sage: C = Curve(f); pts = C.rational_points() sage: pts [(0 : 0 : 1), (0 : 1 : 0), (1 : 0 : 0)] | sage: F = GF(3^2,'a') sage: P2.<X,Y,Z> = ProjectiveSpace(F,2) sage: C = Curve(X^3+5*Y^2*Z-33*X*Y*X) sage: b = C.rational_points_iterator() sage: b.next() (0 : 1 : 0) sage: b.next() (0 : 0 : 1) sage: b.next() (2*a + 2 : 2*a : 1) sage: b.next() (2 : a + 1 : 1) sage: b.next() (a + 1 : a + 2 : 1) sage: b.next() (1 : 2 : 1)... | def rational_points(self, algorithm="enum", sort=True): r""" Return the rational points on this curve computed via enumeration. |
points = [] | def rational_points(self, algorithm="enum", sort=True): r""" Return the rational points on this curve computed via enumeration. | |
points.append(self.point([one,zero,zero])) except TypeError: | t = self.point([one,zero,zero]) yield(t) except TypeError: | def rational_points(self, algorithm="enum", sort=True): r""" Return the rational points on this curve computed via enumeration. |
for x in R(g((X,one,zero))).roots(multiplicities=False): points.append(self.point([x,one,zero])) | g10 = R(g(X,one,zero)) if g10.is_zero(): for x in K: yield(self.point([x,one,zero])) else: for x in g10.roots(multiplicities=False): yield(self.point([x,one,zero])) | def rational_points(self, algorithm="enum", sort=True): r""" Return the rational points on this curve computed via enumeration. |
for x in R(g((X,y,one))).roots(multiplicities=False): points.append(self.point([x,y,one])) | gy1 = R(g(X,y,one)) if gy1.is_zero(): for x in K: yield(self.point([x,y,one])) else: for x in gy1.roots(multiplicities=False): yield(self.point([x,y,one])) def rational_points(self, algorithm="enum", sort=True): r""" Return the rational points on this curve computed via enumeration. INPUT: - ``algorithm`` (string, ... | def rational_points(self, algorithm="enum", sort=True): r""" Return the rational points on this curve computed via enumeration. |
THEOREM (Kato): Suppose `p \geq 5` is a prime so the `p`-adic representation `\rho_{E,p}` is surjective and `L(E,1) \neq 0`. Then `{ord}_p(\ | THEOREM (Kato): Suppose `L(E,1) \neq 0` and `p \neq 2, 3` is a prime such that - `E` does not have additive reduction at `p`, - the mod-`p` representation is surjective. Then `{ord}_p(\ | def bound_kato(self): r""" Returns a list `p` of primes such that the theorems of Kato's [Ka] and others (e.g., as explained in a paper/thesis of Grigor Grigorov [Gri]) imply that if `p` divides the order of Sha(E) then `p` is in the list. |
[2, 3, 5] | [2, 3, 5, 23] | def bound_kato(self): r""" Returns a list `p` of primes such that the theorems of Kato's [Ka] and others (e.g., as explained in a paper/thesis of Grigor Grigorov [Gri]) imply that if `p` divides the order of Sha(E) then `p` is in the list. |
[2, 3, 7] | [2, 3, 7, 29] | def bound_kato(self): r""" Returns a list `p` of primes such that the theorems of Kato's [Ka] and others (e.g., as explained in a paper/thesis of Grigor Grigorov [Gri]) imply that if `p` divides the order of Sha(E) then `p` is in the list. |
variables x,y:: | variables `x`, `y`:: | def contour_plot(f, xrange, yrange, **options): r""" ``contour_plot`` takes a function of two variables, `f(x,y)` and plots contour lines of the function over the specified ``xrange`` and ``yrange`` as demonstrated below. ``contour_plot(f, (xmin, xmax), (ymin, ymax), ...)`` INPUT: - ``f`` -- a function of two variab... |
sage: contour_plot(x^2-y^2,(x,-3,3),(y,-3,3),contours=[0,1,2,3,4],linewidths=[1,5],linestyles=['solid','dashed'],fill=False) sage: contour_plot(x^2-y^2,(x,-3,3),(y,-3,3),contours=[0,1,2,3,4],linewidths=[1,5],linestyles=['solid','dashed']) | :: sage: P=contour_plot(x^2-y^2,(x,-3,3),(y,-3,3),contours=[0,1,2,3,4],\ ... linewidths=[1,5],linestyles=['solid','dashed'],fill=False) sage: P :: sage: P=contour_plot(x^2-y^2,(x,-3,3),(y,-3,3),contours=[0,1,2,3,4],\ ... linewidths=[1,5],linestyles=['solid','dashed']) sage: P | def contour_plot(f, xrange, yrange, **options): r""" ``contour_plot`` takes a function of two variables, `f(x,y)` and plots contour lines of the function over the specified ``xrange`` and ``yrange`` as demonstrated below. ``contour_plot(f, (xmin, xmax), (ymin, ymax), ...)`` INPUT: - ``f`` -- a function of two variab... |
sage: contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='hsv', labels=True) sage: contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='hsv', labels=True, label_fmt="%1.0f", label_colors='black') sage: contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='h... | sage: contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='hsv', labels=True) :: sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='hsv',\ ... labels=True, label_fmt="%1.0f", label_colors='black') sage: P :: sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi),... | def contour_plot(f, xrange, yrange, **options): r""" ``contour_plot`` takes a function of two variables, `f(x,y)` and plots contour lines of the function over the specified ``xrange`` and ``yrange`` as demonstrated below. ``contour_plot(f, (xmin, xmax), (ymin, ymax), ...)`` INPUT: - ``f`` -- a function of two variab... |
This function is an automatic generated pexpect wrapper around the Singular | This function is an automatically generated pexpect wrapper around the Singular | def _sage_doc_(self): """ EXAMPLES:: sage: 'groebner' in singular.groebner._sage_doc_() True """ if not nodes: generate_docstring_dictionary() |
sage: F = e.formal_group().group_law(5); F t1 + O(t1^5) + (1 - 2*t1^4 + O(t1^5))*t2 + (-4*t1^3 + O(t1^5))*t2^2 + (-4*t1^2 - 30*t1^4 + O(t1^5))*t2^3 + (-2*t1 - 30*t1^3 + O(t1^5))*t2^4 + O(t2^5) sage: i = e.formal_group().inverse(5) | sage: e.formal_group().group_law(5) t1 + O(t1^5) + (1 - 2*t1^4 + O(t1^5))*t2 + (-4*t1^3 + O(t1^5))*t2^2 + (-4*t1^2 - 30*t1^4 + O(t1^5))*t2^3 + (-2*t1 - 30*t1^3 + O(t1^5))*t2^4 + O(t2^5) sage: e = EllipticCurve('14a1') sage: ehat = e.formal() sage: ehat.group_law(3) t1 + O(t1^3) + (1 - t1 - 4*t1^2 + O(t1^3))*t2 + (-4*t... | def group_law(self, prec=10): r""" The formal group law. INPUT: - ``prec`` - integer (default 10) OUTPUT: a power series with given precision in ZZ[[ ZZ[['t1']],'t2']] DETAILS: Return the formal power series .. math:: F(t_1, t_2) = t_1 + t_2 - a_1 t_1 t_2 - \cdots to precision `O(t^{prec})` of page 115 of [S... |
O(t^5) | O(t^7) | def group_law(self, prec=10): r""" The formal group law. INPUT: - ``prec`` - integer (default 10) OUTPUT: a power series with given precision in ZZ[[ ZZ[['t1']],'t2']] DETAILS: Return the formal power series .. math:: F(t_1, t_2) = t_1 + t_2 - a_1 t_1 t_2 - \cdots to precision `O(t^{prec})` of page 115 of [S... |
t1 + O(t1^4) + (1 + O(t1^4))*t2 + (-4*t1^3 + O(t1^4))*t2^2 + (-4*t1^2 + O(t1^4))*t2^3 + O(t2^4) | t1 + O(t1^4) + (1 + O(t1^4))*t2 + (2*t1^3 + O(t1^4))*t2^2 + (2*t1^2 + O(t1^4))*t2^3 + O(t2^4) Test for trac ticket 9646:: sage: P.<a1, a2, a3, a4, a6> = PolynomialRing(ZZ, 5) sage: E = EllipticCurve(list(P.gens())) sage: F = E.formal().group_law(prec = 4) sage: t2 = F.parent().gen() sage: t1 = F.parent().base_ring().... | def group_law(self, prec=10): r""" The formal group law. INPUT: - ``prec`` - integer (default 10) OUTPUT: a power series with given precision in ZZ[[ ZZ[['t1']],'t2']] DETAILS: Return the formal power series .. math:: F(t_1, t_2) = t_1 + t_2 - a_1 t_1 t_2 - \cdots to precision `O(t^{prec})` of page 115 of [S... |
if prec == 1: return R2(O(t2)) elif prec == 2: return R2(t1+t2 - self.curve().a1()*t1*t2) | def group_law(self, prec=10): r""" The formal group law. INPUT: - ``prec`` - integer (default 10) OUTPUT: a power series with given precision in ZZ[[ ZZ[['t1']],'t2']] DETAILS: Return the formal power series .. math:: F(t_1, t_2) = t_1 + t_2 - a_1 t_1 t_2 - \cdots to precision `O(t^{prec})` of page 115 of [S... | |
w = self.w(prec) | w = self.w(prec+1) | def group_law(self, prec=10): r""" The formal group law. INPUT: - ``prec`` - integer (default 10) OUTPUT: a power series with given precision in ZZ[[ ZZ[['t1']],'t2']] DETAILS: Return the formal power series .. math:: F(t_1, t_2) = t_1 + t_2 - a_1 t_1 t_2 - \cdots to precision `O(t^{prec})` of page 115 of [S... |
lam = sum([tsum(n)*w[n] for n in range(3,prec)]) w1 = R1(w, prec) | lam = sum([tsum(n)*w[n] for n in range(3,prec+1)]) w1 = R1(w, prec+1) | def group_law(self, prec=10): r""" The formal group law. INPUT: - ``prec`` - integer (default 10) OUTPUT: a power series with given precision in ZZ[[ ZZ[['t1']],'t2']] DETAILS: Return the formal power series .. math:: F(t_1, t_2) = t_1 + t_2 - a_1 t_1 t_2 - \cdots to precision `O(t^{prec})` of page 115 of [S... |
occured. Please put there the version of sageq at the time of deprecation. | occurred. Please put there the version of sage at the time of deprecation. | def deprecation(message, version=None): r""" Issue a deprecation warning. INPUT: - ``message`` - an explanation why things are deprecated and by what it should be replaced. - ``version`` - (optional) on which version and when the deprecation occured. Please put there the version of sageq at the time of deprecation. ... |
A wrapper around methods or functions wich automatically print the correct | A wrapper around methods or functions which automatically print the correct | sage: def bar(): |
Please note that for more extensive use of R's plotting capabilities (such as the lattices package), it is advisable to either use an interactive plotting device or to use the notebook. The following examples are not tested, because they differ depending on operating system. | Please note that for more extensive use of R's plotting capabilities (such as the lattices package), it is advisable to either use an interactive plotting device or to use the notebook. The following examples are not tested, because they differ depending on operating system:: | def plot(self, *args, **kwds): """ The R plot function. Type r.help('plot') for much more extensive documentation about this function. See also below for a brief introduction to more plotting with R. |
In the notebook, one can use r.png() to open the device, but would need to use the following since R lattice graphics do not automatically print away from the command line. | In the notebook, one can use r.png() to open the device, but would need to use the following since R lattice graphics do not automatically print away from the command line:: | def plot(self, *args, **kwds): """ The R plot function. Type r.help('plot') for much more extensive documentation about this function. See also below for a brief introduction to more plotting with R. |
sage: @interacts.decorator.library_interact | sage: @interacts.library.library_interact | def library_interact(f): """ This is a decorator for using interacts in the Sage library. EXAMPLES:: sage: @interacts.decorator.library_interact ... def f(n=5): print n ... sage: f() # an interact appears <html>...</html> """ @sage_wraps(f) def library_wrapper(): # Maybe program around bug (?) in the notebook: html(... |
sage: interacts.decorator.demo() | sage: interacts.library.demo() | def demo(n=tuple(range(10)), m=tuple(range(10))): """ This is a demo interact that sums two numbers. INPUT: - `n` -- integer slider - `m` -- integer slider EXAMPLES:: sage: interacts.decorator.demo() <html>...</html> """ print n+m |
return [] | return | def upgrade(): """ Download and build the latest version of Sage. You must have an internet connection. Also, you will have to restart Sage for the changes to take affect. This upgrades to the latest version of core packages (optional packages are not automatically upgraded). This will not work on systems that don't... |
if n == 1: return 1 for p in [2, 3, 5]: if n%p == 0: return p if bound == None: bound = n dif = [6, 4, 2, 4, 2, 4, 6, 2] m = 7; i = 1 while m <= bound and m*m <= n: if n%m == 0: return m m += dif[i%8] i += 1 return n | if bound is None: return ZZ(n).trial_division() else: return ZZ(n).trial_division(bound) | def trial_division(n, bound=None): """ Return the smallest prime divisor <= bound of the positive integer n, or n if there is no such prime. If the optional argument bound is omitted, then bound <= n. INPUT: - ``n`` - a positive integer - ``bound`` - (optional) a positive integer OUTPUT: - ``int`` - a prime p=bo... |
if n < 10000000000000: return factorization.Factorization(__factor_using_trial_division(n), unit) | def factor(n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds): """ Returns the factorization of n. The result depends on the type of n. If n is an integer, factor returns the factorization of the integer n as an object of type Factorization. If n is not an integer, ``n.factor(proof=proof, **kwds)`` gets ... | |
Returns the canonical label with respect to the partition. If no partition is given, uses the unit partition. | Returns the unique graph on \{0,1,...,n-1\} ( n = self.order() ) which - is isomorphic to self, - has canonical vertex labels, - allows only permutations of vertices respecting the input set partition (if given). Canonical here means that all graphs isomorphic to self (and respecting the input set partition) have the ... | def canonical_label(self, partition=None, certify=False, verbosity=0, edge_labels=False): """ Returns the canonical label with respect to the partition. If no partition is given, uses the unit partition. INPUT: - ``partition`` - if given, the canonical label with respect to this partition will be computed. The defa... |
respect to this partition will be computed. The default is the unit partition. | respect to this set partition will be computed. The default is the unit set partition. | def canonical_label(self, partition=None, certify=False, verbosity=0, edge_labels=False): """ Returns the canonical label with respect to the partition. If no partition is given, uses the unit partition. INPUT: - ``partition`` - if given, the canonical label with respect to this partition will be computed. The defa... |
b_new = {} | c_new = {} | def canonical_label(self, partition=None, certify=False, verbosity=0, edge_labels=False): """ Returns the canonical label with respect to the partition. If no partition is given, uses the unit partition. INPUT: - ``partition`` - if given, the canonical label with respect to this partition will be computed. The defa... |
b_new[v] = c[G_to[('o',v)]] H.relabel(b_new) | c_new[v] = c[G_to[('o',v)]] H.relabel(c_new) | def canonical_label(self, partition=None, certify=False, verbosity=0, edge_labels=False): """ Returns the canonical label with respect to the partition. If no partition is given, uses the unit partition. INPUT: - ``partition`` - if given, the canonical label with respect to this partition will be computed. The defa... |
return H, relabeling | return H, c_new | def canonical_label(self, partition=None, certify=False, verbosity=0, edge_labels=False): """ Returns the canonical label with respect to the partition. If no partition is given, uses the unit partition. INPUT: - ``partition`` - if given, the canonical label with respect to this partition will be computed. The defa... |
Return the number of the `n`-th partial convergent, computed | Return the numerator of the `n`-th partial convergent, computed | def pn(self, n): """ Return the number of the `n`-th partial convergent, computed using the recurrence. EXAMPLES:: sage: c = continued_fraction(pi); c [3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 3] sage: c.pn(0), c.qn(0) (3, 1) sage: len(c) 14 sage: c.pn(13), c.qn(13) (245850922, 78256779) """ if n < -2: raise ValueE... |
Return the (unique) field of all contiued fractions. | Return the (unique) field of all continued fractions. | def ContinuedFractionField(): """ Return the (unique) field of all contiued fractions. EXAMPLES:: sage: ContinuedFractionField() Field of all continued fractions """ return CFF |
Return a list of the edges of the graph as triples (u,v,l) where u and v are vertices and l is a label. | Return a list of edges. Each edge is a triple (u,v,l) where u and v are vertices and l is a label. If the parameter ``labels`` is False then a list of couple (u,v) is returned where u and v are vertices. | def edges(self, labels=True, sort=True, key=None): r""" Return a list of the edges of the graph as triples (u,v,l) where u and v are vertices and l is a label. |
def edge_boundary(self, vertices1, vertices2=None, labels=True): | def edge_boundary(self, vertices1, vertices2=None, labels=True, sort=True): | def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``. In a digraph, the external boundary of a vertex `v` are those vertices `u` with an ... |
sage: G = graphs.PetersenGraph() | def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``. In a digraph, the external boundary of a vertex `v` are those vertices `u` with an ... | |
""" vertices1 = [v for v in vertices1 if v in self] output = [] | sage: G.edge_boundary([2], [0]) [(0, 2, {})] """ vertices1 = set([v for v in vertices1 if v in self]) | def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``. In a digraph, the external boundary of a vertex `v` are those vertices `u` with an ... |
output.extend(self.outgoing_edge_iterator(vertices1,labels=labels)) | def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``. In a digraph, the external boundary of a vertex `v` are those vertices `u` with an ... | |
output = [e for e in output if e[1] in vertices2] | vertices2 = set([v for v in vertices2 if v in self]) output = [e for e in self.outgoing_edge_iterator(vertices1,labels=labels) if e[1] in vertices2] | def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``. In a digraph, the external boundary of a vertex `v` are those vertices `u` with an ... |
output = [e for e in output if e[1] not in vertices1] return output | output = [e for e in self.outgoing_edge_iterator(vertices1,labels=labels) if e[1] not in vertices1] | def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``. In a digraph, the external boundary of a vertex `v` are those vertices `u` with an ... |
output.extend(self.edge_iterator(vertices1,labels=labels)) output2 = [] | def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``. In a digraph, the external boundary of a vertex `v` are those vertices `u` with an ... | |
for e in output: if e[0] in vertices1: if e[1] in vertices2: output2.append(e) elif e[0] in vertices2: output2.append(e) | vertices2 = set([v for v in vertices2 if v in self]) output = [e for e in self.edge_iterator(vertices1,labels=labels) if (e[0] in vertices1 and e[1] in vertices2) or (e[1] in vertices1 and e[0] in vertices2)] | def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``. In a digraph, the external boundary of a vertex `v` are those vertices `u` with an ... |
for e in output: if e[0] in vertices1: if e[1] not in vertices1: output2.append(e) elif e[0] not in vertices1: output2.append(e) return output2 | output = [e for e in self.edge_iterator(vertices1,labels=labels) if e[1] not in vertices1 or e[0] not in vertices1] if sort: output.sort() return output | def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``. In a digraph, the external boundary of a vertex `v` are those vertices `u` with an ... |
Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only. | Returns an iterator over edges. The iterator returned is over the edges incident with any vertex given in the parameter ``vertices``. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only. | def edge_iterator(self, vertices=None, labels=True, ignore_direction=False): """ Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only... |
- ``vertices`` - (default: None) a vertex, a list of vertices or None | def edge_iterator(self, vertices=None, labels=True, ignore_direction=False): """ Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only... | |
- ``ignore_direction`` - (default False) only applies | - ``ignore_direction`` - bool (default: False) - only applies | def edge_iterator(self, vertices=None, labels=True, ignore_direction=False): """ Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only... |
for e in self._backend.iterator_out_edges(vertices, labels): yield e for e in self._backend.iterator_in_edges(vertices, labels): yield e | from itertools import chain return chain(self._backend.iterator_out_edges(vertices, labels), self._backend.iterator_in_edges(vertices, labels)) | def edge_iterator(self, vertices=None, labels=True, ignore_direction=False): """ Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only... |
for e in self._backend.iterator_out_edges(vertices, labels): yield e | return self._backend.iterator_out_edges(vertices, labels) | def edge_iterator(self, vertices=None, labels=True, ignore_direction=False): """ Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only... |
for e in self._backend.iterator_edges(vertices, labels): yield e def edges_incident(self, vertices=None, labels=True): """ Returns a list of edges incident with any vertex given. If vertices | return self._backend.iterator_edges(vertices, labels) def edges_incident(self, vertices=None, labels=True, sort=True): """ Returns incident edges to some vertices. If ``vertices` is a vertex, then it returns the list of edges incident to that vertex. If ``vertices`` is a list of vertices then it returns the list of a... | def edge_iterator(self, vertices=None, labels=True, ignore_direction=False): """ Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only... |
- ``label`` - if False, each edge is a tuple (u,v) of vertices. | - ``vertices`` - object (default: None) - a vertex, a list of vertices or None. - ``labels`` - bool (default: True) - if False, each edge is a tuple (u,v) of vertices. - ``sort`` - bool (default: True) - if True the returned list is sorted. | def edges_incident(self, vertices=None, labels=True): """ Returns a list of edges incident with any vertex given. If vertices is None, returns a list of all edges in graph. For digraphs, only lists outward edges. INPUT: - ``label`` - if False, each edge is a tuple (u,v) of vertices. EXAMPLES:: sage: graphs.Peter... |
v = list(self.edge_boundary(vertices, labels=labels)) v.sort() return v | if sort: return sorted(self.edge_iterator(vertices=vertices,labels=labels)) return list(self.edge_iterator(vertices=vertices,labels=labels)) | def edges_incident(self, vertices=None, labels=True): """ Returns a list of edges incident with any vertex given. If vertices is None, returns a list of all edges in graph. For digraphs, only lists outward edges. INPUT: - ``label`` - if False, each edge is a tuple (u,v) of vertices. EXAMPLES:: sage: graphs.Peter... |
if polynomial not in self.coordinate_ring(): | S = self.coordinate_ring() try: polynomial = S(polynomial) except TypeError: | def is_homogeneous(self, polynomial): r""" Check if ``polynomial`` is homogeneous. |
polynomial = polynomial.lift() | polynomial = S(polynomial.lift()) | def is_homogeneous(self, polynomial): r""" Check if ``polynomial`` is homogeneous. |
pass | def cycle_index(self, parent = None): r""" INPUT: - ``self`` - a permutation group `G` - ``parent`` -- a free module with basis indexed by partitions, or behave as such, with a ``term`` and ``sum`` method (default: the symmetric functions over the rational field in the p basis) Returns the *cycle index* of `G`, which... | def example(self): """ Returns an example of finite permutation group, as per :meth:`Category.example`. |
-0.530637530952518 + 1.11851787964371*I | 0.530637530952518 - 1.11851787964371*I | def __init__(self): r""" The inverse of the hyperbolic secant function. |
sage: W = Words('123') sage: W('1212').is_square() True sage: W('1213').is_square() False sage: W('12123').is_square() False sage: W().is_square() | sage: Word('1212').is_square() True sage: Word('1213').is_square() False sage: Word('12123').is_square() False sage: Word().is_square() | def is_square(self): r""" Returns True if self is a square, and False otherwise. EXAMPLES:: sage: Word([1,0,0,1]).is_square() False sage: W = Words('123') sage: W('1212').is_square() True sage: W('1213').is_square() False sage: W('12123').is_square() False sage: W().is_square() True """ if self.length() % 2 != 0: ret... |
sage: W = Words('123') sage: W('12312').is_square_free() True sage: W('31212').is_square_free() False sage: W().is_square_free() True TESTS:: sage: W = Words('123') sage: W('11').is_square_free() False sage: W('211').is_square_free() False sage: W('3211').is_square_free() False """ l = self.length() if l < 2: | sage: Word('12312').is_square_free() True sage: Word('31212').is_square_free() False sage: Word().is_square_free() True TESTS: We make sure that sage: Word('11').is_square_free() False sage: Word('211').is_square_free() False sage: Word('3211').is_square_free() False """ L = self.length() if L < 2: | def is_square_free(self): r""" Returns True if self does not contain squares, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_square_free() True sage: W('31212').is_square_free() False sage: W().is_square_free() True |
suff = self for i in xrange(0, l-1): for ll in xrange(2, l-i+1, 2): if suff[:ll].is_square(): | for start in xrange(0, L-1): for end in xrange(start+2, L+1, 2): if self[start:end].is_square(): | def is_square_free(self): r""" Returns True if self does not contain squares, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_square_free() True sage: W('31212').is_square_free() False sage: W().is_square_free() True |
suff = suff[1:] | def is_square_free(self): r""" Returns True if self does not contain squares, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_square_free() True sage: W('31212').is_square_free() False sage: W().is_square_free() True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.