rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
sage: W = Words('012') sage: W('012012012').is_cube() True sage: W('01010101').is_cube() False sage: W().is_cube() True sage: W('012012').is_cube()
sage: Word('012012012').is_cube() True sage: Word('01010101').is_cube() False sage: Word().is_cube() True sage: Word('012012').is_cube()
def is_cube(self): r""" Returns True if self is a cube, and False otherwise. EXAMPLES:: sage: W = Words('012') sage: W('012012012').is_cube() True sage: W('01010101').is_cube() False sage: W().is_cube() True sage: W('012012').is_cube() False """ if self.length() % 3 != 0: return False l = self.length() / 3 return sel...
sage: W = Words('123') sage: W('12312').is_cube_free() True sage: W('32221').is_cube_free() False sage: W().is_cube_free() True """ l = self.length() if l < 3:
sage: Word('12312').is_cube_free() True sage: Word('32221').is_cube_free() False sage: Word().is_cube_free() True TESTS: We make sure that sage: Word('111').is_cube_free() False sage: Word('2111').is_cube_free() False sage: Word('32111').is_cube_free() False """ L = self.length() if L < 3:
def is_cube_free(self): r""" Returns True if self does not contain cubes, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_cube_free() True sage: W('32221').is_cube_free() False sage: W().is_cube_free() True """ l = self.length() if l < 3: return True suff = self for i in xrange(0, l - 3): f...
suff = self for i in xrange(0, l - 3): for ll in xrange(3, l-i+1, 3): if suff[:ll].is_cube():
for start in xrange(0, L - 2): for end in xrange(start+3, L+1, 3): if self[start:end].is_cube():
def is_cube_free(self): r""" Returns True if self does not contain cubes, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_cube_free() True sage: W('32221').is_cube_free() False sage: W().is_cube_free() True """ l = self.length() if l < 3: return True suff = self for i in xrange(0, l - 3): f...
suff = suff[1:]
def is_cube_free(self): r""" Returns True if self does not contain cubes, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_cube_free() True sage: W('32221').is_cube_free() False sage: W().is_cube_free() True """ l = self.length() if l < 3: return True suff = self for i in xrange(0, l - 3): f...
return CRT_list(vec,mod)
return tuple(CRT_vectors(vec,mod))
def basiclemmavec(self,M): """ Finds a vector where the value of the quadratic form is coprime to M. EXAMPLES: sage: Q = QuadraticForm(ZZ, 2, [2, 1, 5]) sage: Q.basiclemmavec(10) (6, 5) sage: Q(_) 227 """ V=FreeModule(self.base_ring(),self.dim()) mat = self.matrix() vec = [] mod = [] M0 = abs(M) if M0 == 1: return V(...
p.add_constraint(v[x] + b[x][y] - v[y], min=0, max=0)
p.add_constraint(v[x] + b[x][y] - v[y], min=0)
def edge_cut(self, s, t, value_only=True, use_edge_labels=False, vertices=False, solver=None, verbose=0): r""" Returns a minimum edge cut between vertices `s` and `t` represented by a list of edges.
- ``catch` - a boolean (default: True)
- ``catch`` - a boolean (default: True)
def run(self, category = None, skip = [], catch = True, raise_on_failure = False, **options): """ Run all the tests from this test suite:
sage: ZZ._tester() Testing utilities for Integer Ring
sage: QQ._tester() Testing utilities for Rational Field
def instance_tester(instance, tester = None, **options): """ Returns a gadget attached to ``instance`` providing testing utilities. EXAMPLES:: sage: from sage.misc.sage_unittest import instance_tester sage: tester = instance_tester(ZZ) sage: tester.assert_(1 == 1) sage: tester.assert_(1 == 0) Traceback (most recent ...
sage: ZZ._tester() Testing utilities for Integer Ring
sage: QQ._tester() Testing utilities for Rational Field
def __init__(self, instance, elements = None, verbose = False, prefix = "", **options): """ A gadget attached to an instance providing it with testing utilities.
sage: for lset in polytopes.cross_polytope(2).face_lattice().level_sets(): print lset[0] (None, (0, 1, 2, 3)) ((1,), (2, 3)) ((1, 2), (3,)) ((0, 1, 2, 3), None)
sage: level_sets = polytopes.cross_polytope(2).face_lattice().level_sets() sage: print level_sets[0], level_sets[-1] [(None, (0, 1, 2, 3))] [((0, 1, 2, 3), None)]
def face_lattice(self): """ Computes the face-lattice poset. Elements are tuples of (vertices, facets) - i.e. this keeps track of both the vertices in each face, and all the facets containing them.
""" Enumerates projective, rational points on scheme X of height up to bound B.
r""" Enumerates projective, rational points on scheme ``X`` of height up to bound ``B``.
def enum_projective_rational_field(X,B): """ Enumerates projective, rational points on scheme X of height up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme. - ``B`` - a positive integer bound OUTPUT: - a list containing the projective points of X of height up to B, sorted. E...
- ``X`` - a scheme or set of abstract rational points of a scheme. - ``B`` - a positive integer bound
- ``X`` - a scheme or set of abstract rational points of a scheme; - ``B`` - a positive integer bound.
def enum_projective_rational_field(X,B): """ Enumerates projective, rational points on scheme X of height up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme. - ``B`` - a positive integer bound OUTPUT: - a list containing the projective points of X of height up to B, sorted. E...
- a list containing the projective points of X of height up to B, sorted.
- a list containing the projective points of ``X`` of height up to ``B``, sorted.
def enum_projective_rational_field(X,B): """ Enumerates projective, rational points on scheme X of height up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme. - ``B`` - a positive integer bound OUTPUT: - a list containing the projective points of X of height up to B, sorted. E...
of projective space to see if they lie on X.
of projective space to see if they lie on ``X``.
def enum_projective_rational_field(X,B): """ Enumerates projective, rational points on scheme X of height up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme. - ``B`` - a positive integer bound OUTPUT: - a list containing the projective points of X of height up to B, sorted. E...
John Cremona and Charlie Turner (06-2010)
- John Cremona and Charlie Turner (06-2010)
def enum_projective_rational_field(X,B): """ Enumerates projective, rational points on scheme X of height up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme. - ``B`` - a positive integer bound OUTPUT: - a list containing the projective points of X of height up to B, sorted. E...
n = X.codomain().ambient_space().ngens()-1 zero=tuple([0 for _ in range(n+1)]) pts =[] for c in cartesian_product_iterator([srange(-B,B+1) for _ in range(n+1)]): if gcd(c)==1 and c>zero:
n = X.codomain().ambient_space().ngens() zero = (0,) * n pts = [] for c in cartesian_product_iterator([srange(-B,B+1) for _ in range(n)]): if gcd(c) == 1 and c > zero:
def enum_projective_rational_field(X,B): """ Enumerates projective, rational points on scheme X of height up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme. - ``B`` - a positive integer bound OUTPUT: - a list containing the projective points of X of height up to B, sorted. E...
except:
except TypeError:
def enum_projective_rational_field(X,B): """ Enumerates projective, rational points on scheme X of height up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme. - ``B`` - a positive integer bound OUTPUT: - a list containing the projective points of X of height up to B, sorted. E...
Enumerates affine rational points on scheme X (defined over `\QQ`) up to bound B.
Enumerates affine rational points on scheme ``X`` (defined over `\QQ`) up to bound ``B``.
def enum_affine_rational_field(X,B): """ Enumerates affine rational points on scheme X (defined over `\QQ`) up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme - ``B`` - a positive integer bound OUTPUT: - a list containing the affine points of X of height up to B, sorted. EXAM...
- ``X`` - a scheme or set of abstract rational points of a scheme - ``B`` - a positive integer bound
- ``X`` - a scheme or set of abstract rational points of a scheme; - ``B`` - a positive integer bound.
def enum_affine_rational_field(X,B): """ Enumerates affine rational points on scheme X (defined over `\QQ`) up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme - ``B`` - a positive integer bound OUTPUT: - a list containing the affine points of X of height up to B, sorted. EXAM...
- a list containing the affine points of X of height up to B, sorted.
- a list containing the affine points of ``X`` of height up to ``B``, sorted.
def enum_affine_rational_field(X,B): """ Enumerates affine rational points on scheme X (defined over `\QQ`) up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme - ``B`` - a positive integer bound OUTPUT: - a list containing the affine points of X of height up to B, sorted. EXAM...
AUTHOR: David R. Kohel <kohel@maths.usyd.edu.au> (small adjustments by Charlie Turner 06-2010)
AUTHORS: - David R. Kohel <kohel@maths.usyd.edu.au>: original version. - Charlie Turner (06-2010): small adjustments.
def enum_affine_rational_field(X,B): """ Enumerates affine rational points on scheme X (defined over `\QQ`) up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme - ``B`` - a positive integer bound OUTPUT: - a list containing the affine points of X of height up to B, sorted. EXAM...
Q = [ k+1 for k in range(B) ] R = [ 0 ] + [ s*k for k in range(1,B+1) for s in [1,-1] ]
Q = range(1, B + 1) R = [ 0 ] + [ s*k for k in range(1, B+1) for s in [1, -1] ]
def enum_affine_rational_field(X,B): """ Enumerates affine rational points on scheme X (defined over `\QQ`) up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme - ``B`` - a positive integer bound OUTPUT: - a list containing the affine points of X of height up to B, sorted. EXAM...
P = [ 0 for _ in range(n) ]
P = [0] * n
def enum_affine_rational_field(X,B): """ Enumerates affine rational points on scheme X (defined over `\QQ`) up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme - ``B`` - a positive integer bound OUTPUT: - a list containing the affine points of X of height up to B, sorted. EXAM...
except:
except TypeError:
def enum_affine_rational_field(X,B): """ Enumerates affine rational points on scheme X (defined over `\QQ`) up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme - ``B`` - a positive integer bound OUTPUT: - a list containing the affine points of X of height up to B, sorted. EXAM...
[ iters[j].next() for j in range(n) ]
for it in iters: it.next()
def enum_affine_rational_field(X,B): """ Enumerates affine rational points on scheme X (defined over `\QQ`) up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme - ``B`` - a positive integer bound OUTPUT: - a list containing the affine points of X of height up to B, sorted. EXAM...
m = m.gcd(a) P[i] = a for b in Q: if m.gcd(b) == 1: try: pts.append(X([ num/b for num in P ])) except: pass i = 0 m = ZZ(0)
def enum_affine_rational_field(X,B): """ Enumerates affine rational points on scheme X (defined over `\QQ`) up to bound B. INPUT: - ``X`` - a scheme or set of abstract rational points of a scheme - ``B`` - a positive integer bound OUTPUT: - a list containing the affine points of X of height up to B, sorted. EXAM...
Enumerates projective points on scheme X defined over a finite field
Enumerates projective points on scheme ``X`` defined over a finite field.
def enum_projective_finite_field(X): """ Enumerates projective points on scheme X defined over a finite field INPUT: - ``X`` - a scheme defined over a finite field or set of abstract rational points of such a scheme OUTPUT: - a list containing the projective points of X over the finite field, sorted EXAMPLES:: s...
- ``X`` - a scheme defined over a finite field or set of abstract rational points of such a scheme
- ``X`` - a scheme defined over a finite field or a set of abstract rational points of such a scheme.
def enum_projective_finite_field(X): """ Enumerates projective points on scheme X defined over a finite field INPUT: - ``X`` - a scheme defined over a finite field or set of abstract rational points of such a scheme OUTPUT: - a list containing the projective points of X over the finite field, sorted EXAMPLES:: s...
- a list containing the projective points of X over the finite field, sorted
- a list containing the projective points of ``X`` over the finite field, sorted.
def enum_projective_finite_field(X): """ Enumerates projective points on scheme X defined over a finite field INPUT: - ``X`` - a scheme defined over a finite field or set of abstract rational points of such a scheme OUTPUT: - a list containing the projective points of X over the finite field, sorted EXAMPLES:: s...
NOTE: Warning:if X given as input is defined over an infinite field then this code will not finish! AUTHORS: John Cremona and Charlie Turner (06-2010)
.. WARNING:: If ``X`` is defined over an infinite field, this code will not finish! AUTHORS: - John Cremona and Charlie Turner (06-2010).
def enum_projective_finite_field(X): """ Enumerates projective points on scheme X defined over a finite field INPUT: - ``X`` - a scheme defined over a finite field or set of abstract rational points of such a scheme OUTPUT: - a list containing the projective points of X over the finite field, sorted EXAMPLES:: s...
except:
except TypeError:
def enum_projective_finite_field(X): """ Enumerates projective points on scheme X defined over a finite field INPUT: - ``X`` - a scheme defined over a finite field or set of abstract rational points of such a scheme OUTPUT: - a list containing the projective points of X over the finite field, sorted EXAMPLES:: s...
sage: cmp(N3, 3) -1
sage: abs( cmp(N3, 3) ) 1
def __cmp__(self, right): r""" Compare ``self`` and ``right``.
``obj``, return a list of those names. If
``obj``, return a sorted list of those names. If
def sage_getvariablename(obj, omit_underscore_names=True): """ Attempt to get the name of a Sage object. INPUT: - ``obj`` - an object - ``omit_underscore_names`` (optional, default True) If the user has assigned an object ``obj`` to a variable name, then return that variable name. If several variables point to ``ob...
return result
return sorted(result)
def sage_getvariablename(obj, omit_underscore_names=True): """ Attempt to get the name of a Sage object. INPUT: - ``obj`` - an object - ``omit_underscore_names`` (optional, default True) If the user has assigned an object ``obj`` to a variable name, then return that variable name. If several variables point to ``ob...
sage: M=E.modular_symbol()
def modular_symbol(self, sign=1, use_eclib = False, normalize = "L_ratio"): r""" Return the modular symbol associated to this elliptic curve, with given sign and base ring. This is the map that sends `r/s` to a fixed multiple of the integral of `2 \pi i f(z) dz` from `\infty` to `r/s`, normalized so that all values of...
1/5
2/5
def modular_symbol(self, sign=1, use_eclib = False, normalize = "L_ratio"): r""" Return the modular symbol associated to this elliptic curve, with given sign and base ring. This is the map that sends `r/s` to a fixed multiple of the integral of `2 \pi i f(z) dz` from `\infty` to `r/s`, normalized so that all values of...
Returns the Duursama data `v` and `m` of this formally s.d. code `C`
Returns the Duursma data `v` and `m` of this formally s.d. code `C`
def sd_duursma_data(C, i): r""" Returns the Duursama data `v` and `m` of this formally s.d. code `C` and the type number `i` in (1,2,3,4). Does *not* check if this code is actually sd. INPUT: - ``i`` - Type number OUTPUT: - Pair ``(v, m)`` as in Duursama [D]_ REFERENCES: - [D] - I. Duursma, "Extremal weight enum...
- Pair ``(v, m)`` as in Duursama [D]_
- Pair ``(v, m)`` as in Duursma [D]_
def sd_duursma_data(C, i): r""" Returns the Duursama data `v` and `m` of this formally s.d. code `C` and the type number `i` in (1,2,3,4). Does *not* check if this code is actually sd. INPUT: - ``i`` - Type number OUTPUT: - Pair ``(v, m)`` as in Duursama [D]_ REFERENCES: - [D] - I. Duursma, "Extremal weight enum...
- [D] - I. Duursma, "Extremal weight enumerators and ultraspherical polynomials"
.. [D] I. Duursma, "Extremal weight enumerators and ultraspherical polynomials"
def sd_duursma_data(C, i): r""" Returns the Duursama data `v` and `m` of this formally s.d. code `C` and the type number `i` in (1,2,3,4). Does *not* check if this code is actually sd. INPUT: - ``i`` - Type number OUTPUT: - Pair ``(v, m)`` as in Duursama [D]_ REFERENCES: - [D] - I. Duursma, "Extremal weight enum...
- Coefficients `q_0, q_1, ...` of `q(T)` as in Duursama [D]_
- Coefficients `q_0, q_1, ...` of `q(T)` as in Duursma [D]_
def sd_duursma_q(C,i,d0): r""" INPUT: - ``C`` - sd code; does *not* check if `C` is actually an sd code - ``i`` - Type number, one of 1,2,3,4 - ``d0`` - Divisor, the smallest integer such that each `A_i > 0` iff `i` is divisible by `d0` OUTPUT: - Coefficients `q_0, q_1, ...` of `q(T)` as in Duursama [D]_ REFEREN...
img = self(letter)
img = self.image(letter)
def is_identity(self): r""" Returns ``True`` if ``self`` is the identity morphism. EXAMPLES::
gens = [ "()" ]
k = max(self.entries()) gens = [range(1,k+1)]
def row_stabilizer(self): """ Return the PermutationGroup corresponding to the row stabilizer of self. EXAMPLES:: sage: rs = Tableau([[1,2,3],[4,5]]).row_stabilizer() sage: rs.order() == factorial(3)*factorial(2) True sage: PermutationGroupElement([(1,3,2),(4,5)]) in rs True sage: PermutationGroupElement([(1,4)]) in ...
- ``algorithm`` - string (default: 'recursive') specifying which algorithm to be used when computing the iterated palindromic closure. It must be one of the two following values: - ``'definition'`` means that the iterated right palindromic closure is computed using the definition. - ``'recursive'`` is based on an eff...
- ``algorithm`` - string (default: ``'recursive'``) specifying which algorithm to be used when computing the iterated palindromic closure. It must be one of the two following values: - ``'definition'`` - computed using the definition - ``'recursive'`` - computation based on an efficient formula that recursively compu...
def iterated_right_palindromic_closure(self, f=None, algorithm='recursive'): r""" Returns the iterated (`f`-)palindromic closure of self. INPUT:
l = len(sub)
L = len(sub)
def find(self, sub, start=0, end=None): r""" Returns the index of the first occurrence of sub in self, such that sub is contained within self[start:end]. Returns -1 on failure. INPUT:
i = len(self) - l
i = len(self) - L
def find(self, sub, start=0, end=None): r""" Returns the index of the first occurrence of sub in self, such that sub is contained within self[start:end]. Returns -1 on failure. INPUT:
i = start - l
i = start - L
def find(self, sub, start=0, end=None): r""" Returns the index of the first occurrence of sub in self, such that sub is contained within self[start:end]. Returns -1 on failure. INPUT:
if self[i:i+l] == sub: return i
if self[i:i+L] == sub: return i
def find(self, sub, start=0, end=None): r""" Returns the index of the first occurrence of sub in self, such that sub is contained within self[start:end]. Returns -1 on failure. INPUT:
l = len(sub)
L = len(sub)
def rfind(self, sub, start=0, end=None): r""" Returns the index of the last occurrence of sub in self, such that sub is contained within self[start:end]. Returns -1 on failure. INPUT:
i = len(self) - l
i = len(self) - L
def rfind(self, sub, start=0, end=None): r""" Returns the index of the last occurrence of sub in self, such that sub is contained within self[start:end]. Returns -1 on failure. INPUT:
i = end - l
i = end - L
def rfind(self, sub, start=0, end=None): r""" Returns the index of the last occurrence of sub in self, such that sub is contained within self[start:end]. Returns -1 on failure. INPUT:
if self[i:i+l] == sub: return i
if self[i:i+L] == sub: return i
def rfind(self, sub, start=0, end=None): r""" Returns the index of the last occurrence of sub in self, such that sub is contained within self[start:end]. Returns -1 on failure. INPUT:
""" qE = self._q
sage: T = EllipticCurve('14').tate_curve(7) sage: T.E2(30) 2 + 4*7 + 7^2 + 3*7^3 + 6*7^4 + 5*7^5 + 2*7^6 + 7^7 + 5*7^8 + 6*7^9 + 5*7^10 + 2*7^11 + 6*7^12 + 4*7^13 + 3*7^15 + 5*7^16 + 4*7^17 + 4*7^18 + 2*7^20 + 7^21 + 5*7^22 + 4*7^23 + 4*7^24 + 3*7^25 + 6*7^26 + 3*7^27 + 6*7^28 + O(7^30) """
def E2(self,prec=20): r""" Returns the value of the `p`-adic Eisenstein series of weight 2 evaluated on the elliptic curve having split multiplicative reduction.
Some cases that check on the negative twists::
Some harder cases fail::
def _find_scaling_L_ratio(self): r""" This function is use to set ``_scaling``, the factor used to adjust the scalar multiple of the modular symbol. If `[0]`, the modular symbol evaluated at 0, is non-zero, we can just scale it with respect to the approximation of the L-value. It is known that the quotient is a rationa...
-2
1
def _find_scaling_L_ratio(self): r""" This function is use to set ``_scaling``, the factor used to adjust the scalar multiple of the modular symbol. If `[0]`, the modular symbol evaluated at 0, is non-zero, we can just scale it with respect to the approximation of the L-value. It is known that the quotient is a rationa...
Dlist = [5,8,12,13,17,21,24,28,29]
Dlist = [5,8,12,13,17,21,24,28,29, 33, 37, 40, 41, 44, 53, 56, 57, 60, 61, 65, 69, 73, 76, 77, 85, 88, 89, 92, 93, 97]
def _find_scaling_L_ratio(self): r""" This function is use to set ``_scaling``, the factor used to adjust the scalar multiple of the modular symbol. If `[0]`, the modular symbol evaluated at 0, is non-zero, we can just scale it with respect to the approximation of the L-value. It is known that the quotient is a rationa...
while j < 9 and at0 == 0 :
while j < 30 and at0 == 0 :
def _find_scaling_L_ratio(self): r""" This function is use to set ``_scaling``, the factor used to adjust the scalar multiple of the modular symbol. If `[0]`, the modular symbol evaluated at 0, is non-zero, we can just scale it with respect to the approximation of the L-value. It is known that the quotient is a rationa...
chtw = True for ell in prime_divisors(D): chtw = chtw and ( valuation(E.conductor(),ell)<= valuation(D,ell) ) if chtw :
if all( valuation(E.conductor(),ell)<= valuation(D,ell) for ell in prime_divisors(D) ) :
def _find_scaling_L_ratio(self): r""" This function is use to set ``_scaling``, the factor used to adjust the scalar multiple of the modular symbol. If `[0]`, the modular symbol evaluated at 0, is non-zero, we can just scale it with respect to the approximation of the L-value. It is known that the quotient is a rationa...
if j == 9 and at0 == 0: sc = 1 if not self._use_eclib : msn = ModularSymbolSage(self._E,sign = -1,normalize = "L_ratio") sc = msn._scaling if sc == 0 or self._use_eclib : self.__scale_by_periods_only__() else : self._scaling = sc
if j == 30 and at0 == 0: self.__scale_by_periods_only__()
def _find_scaling_L_ratio(self): r""" This function is use to set ``_scaling``, the factor used to adjust the scalar multiple of the modular symbol. If `[0]`, the modular symbol evaluated at 0, is non-zero, we can just scale it with respect to the approximation of the L-value. It is known that the quotient is a rationa...
verbose('scale modular symbols by %s'%(l1/at0))
verbose('scale modular symbols by %s found at D=%s '%(l1/at0,D), level=2)
def _find_scaling_L_ratio(self): r""" This function is use to set ``_scaling``, the factor used to adjust the scalar multiple of the modular symbol. If `[0]`, the modular symbol evaluated at 0, is non-zero, we can just scale it with respect to the approximation of the L-value. It is known that the quotient is a rationa...
Dlist = [-3,-4,-7,-8,-11,-15,-19,-20,-23,-24]
Dlist = [-3,-4,-7,-8,-11,-15,-19,-20,-23,-24, -31, -35, -39, -40, -43, -47, -51, -52, -55, -56, -59, -67, -68, -71, -79, -83, -84, -87, -88, -91]
def _find_scaling_L_ratio(self): r""" This function is use to set ``_scaling``, the factor used to adjust the scalar multiple of the modular symbol. If `[0]`, the modular symbol evaluated at 0, is non-zero, we can just scale it with respect to the approximation of the L-value. It is known that the quotient is a rationa...
if j == 9 and at0 == 0:
if j == 30 and at0 == 0:
def _find_scaling_L_ratio(self): r""" This function is use to set ``_scaling``, the factor used to adjust the scalar multiple of the modular symbol. If `[0]`, the modular symbol evaluated at 0, is non-zero, we can just scale it with respect to the approximation of the L-value. It is known that the quotient is a rationa...
self._option["pdflatex"] = False
self._option["engine"] = "latex" self._option["engine_name"] = "LaTeX"
def __init__(self, bb=False, delimiters=["(", ")"]): """ Define an object that holds LaTeX global preferences. """ self._option = {} self._option["blackboard_bold"] = bb self._option["matrix_delimiters"] = list(delimiters) self._option["vector_delimiters"] = list(delimiters) self._option["macros"] = "" self._option["pr...
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False):
def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_in_background=False):
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
"filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't convert the dvi file to png (because of postscript specials or other issues), then dvips is called, and the PS file is converted to a png file.
"filename.dvi" (or "filename.pdf"` if engine is either ``pdflatex`` or ``xelatex'') and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't convert the dvi file to png (because of postscript specials or other issues), then dvips is called, and the PS file is converted to a png file.
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
- ``pdflatex`` - bool (optional, default False): whether to use pdflatex.
- ``engine`` - string: latex engine to use.
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
``pdflatex`` is False, then a dvi file is created, but if there
engine is latex or None, then a dvi file is created, but if there
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
returned.) If ``pdflatex`` is True and there are no errors, then
returned.) If engine is pdflatex or xelatex and there are no errors, then
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
pdflatex, you must have 'convert' installed.
pdflatex or xelatex, you must have 'convert' installed.
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] if not pdflatex and not have_latex():
if engine is None: engine = _Latex_prefs._option["engine"] if not engine and not have_latex():
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
if pdflatex and not have_pdflatex(): print "Error: PDFLaTeX does not seem to be installed. Download it from"
if engine and not have_pdflatex() and not have_xelatex(): print "Error: %s does not seem to be installed. Download it from" % _Latex_prefs._option["engine_name"]
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
if not pdflatex and not (have_dvipng() or have_convert()):
if (not engine or engine == "latex") and not (have_dvipng() or have_convert()):
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
print "appear to be installed. Displaying LaTeX or PDFLaTeX output"
print "appear to be installed. Displaying LaTeX, PDFLaTeX output"
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
elif pdflatex and not have_convert():
elif engine == "pdflatex" and not have_convert():
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
if pdflatex:
if not engine or engine == "latex": command = "latex" suffix = "ps" return_suffix = "dvi" elif engine == "pdflatex":
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
command = "latex" suffix = "ps" return_suffix = "dvi"
raise ValueError, "Unsupported LaTeX engine."
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
if pdflatex:
if engine == "pdflatex" or engine == "xelatex":
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve...
def __init__(self, debug=False, slide=False, density=150, pdflatex=None):
def __init__(self, debug=False, slide=False, density=150, pdflatex=None, engine=None):
def __init__(self, debug=False, slide=False, density=150, pdflatex=None): self.__debug = debug self.__slide = slide self.__pdflatex = pdflatex self.__density = density
density=None, pdflatex=None, locals={}):
density=None, pdflatex=None, engine=None, locals={}):
def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT:
- ``pdflatex`` - whether to use pdflatex.
- ``pdflatex`` - whether to use pdflatex. This is deprecated. Use ``engine`` option instead. - ``engine`` - latex engine to use. Currently latex, pdflatex, and xelatex are supported.
def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT:
or this command won't work. When using pdflatex, you must
or this command won't work. When using pdflatex or xelatex, you must
def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT:
if pdflatex is None: if self.__pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"]
if engine is None: if self.__engine is None: engine = _Latex_prefs._option["engine"]
def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT:
pdflatex = bool(self.__pdflatex)
engine = self.__engine
def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT:
density=density, pdflatex=pdflatex, png=True)
density=density, engine=engine, png=True)
def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT:
def pdflatex(self, t = None): """
def pdflatex(self, t = None): """ This is deprecated. Use engine("pdflatex") instead.
def pdflatex(self, t = None): """ Controls whether Sage uses PDFLaTeX or LaTeX when typesetting with :func:`view`, in ``%latex`` cells, etc. INPUT: - ``t`` -- boolean or None
sage: latex.pdflatex()
sage: latex.pdflatex() doctest:...: DeprecationWarning: Use engine() instead.
def pdflatex(self, t = None): """ Controls whether Sage uses PDFLaTeX or LaTeX when typesetting with :func:`view`, in ``%latex`` cells, etc. INPUT: - ``t`` -- boolean or None
sage: latex.pdflatex(False)
sage: latex.pdflatex(False) doctest:...: DeprecationWarning: Use engine("latex") instead.
def pdflatex(self, t = None): """ Controls whether Sage uses PDFLaTeX or LaTeX when typesetting with :func:`view`, in ``%latex`` cells, etc. INPUT: - ``t`` -- boolean or None
return _Latex_prefs._option["pdflatex"] _Latex_prefs._option["pdflatex"] = bool(t)
from sage.misc.misc import deprecation deprecation('Use engine() instead.') return _Latex_prefs._option["engine"] == "pdflatex" elif t: from sage.misc.misc import deprecation deprecation('Use engine("pdflatex") instead.') self.engine("pdflatex") else: from sage.misc.misc import deprecation deprecation('Use engine("late...
def pdflatex(self, t = None): """ Controls whether Sage uses PDFLaTeX or LaTeX when typesetting with :func:`view`, in ``%latex`` cells, etc. INPUT: - ``t`` -- boolean or None
def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds):
def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, engine=None, viewer = None, tightpage = None, mode='inline', **kwds):
def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - `...
- ``pdflatex`` - bool (default: False): use pdflatex.
- ``pdflatex`` - bool (default: False): use pdflatex. This is deprecated. Use 'engine' option instead. - ``engine`` - 'latex', 'pdflatex', or 'xelatex'
def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - `...
If ``pdflatex`` is ``True``, then this produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is
If ``pdflatex`` is ``True``, then the latex engine is set to pdflatex. If the engine is either pdflatex or xelatex, it produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is
def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - `...
viewer, even in notebook mode. This also sets ``pdflatex`` to ``True``.
viewer, even in notebook mode. This also sets the latex engine to be ``pdflatex`` if the current engine is latex.
def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - `...
debug=debug, do_in_background=False, pdflatex=pdflatex)
debug=debug, do_in_background=False, engine=engine)
def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - `...
if viewer == "pdf": pdflatex = True if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"]
if pdflatex: engine = "pdflatex" else: engine = _Latex_prefs._option["engine"] if viewer == "pdf" and engine == "latex": engine = "pdflatex"
def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - `...
suffix = _run_latex_(tex_file, debug=debug, pdflatex=pdflatex, png=False)
suffix = _run_latex_(tex_file, debug=debug, engine=engine, png=False)
def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - `...
do_in_background=False, tiny=False, pdflatex=True):
do_in_background=False, tiny=False, pdflatex=True, engine='pdflatex'):
def png(x, filename, density=150, debug=False, do_in_background=False, tiny=False, pdflatex=True): """ Create a png image representation of ``x`` and save to the given filename. INPUT: - ``x`` - object to be displayed - ``filename`` - file in which to save the image - ``density`` - integer (default: 150) - ``d...
- ``pdflatex`` - bool (default: False): use pdflatex.
- ``pdflatex`` - bool (default: True): use pdflatex. This option is deprecated. Use ``engine`` option instead. See below. - ``engine`` - 'latex', 'pdflatex', or 'xelatex' (default: 'pdflatex')
def png(x, filename, density=150, debug=False, do_in_background=False, tiny=False, pdflatex=True): """ Create a png image representation of ``x`` and save to the given filename. INPUT: - ``x`` - object to be displayed - ``filename`` - file in which to save the image - ``density`` - integer (default: 150) - ``d...
pdflatex=pdflatex)
engine=engine)
def png(x, filename, density=150, debug=False, do_in_background=False, tiny=False, pdflatex=True): """ Create a png image representation of ``x`` and save to the given filename. INPUT: - ``x`` - object to be displayed - ``filename`` - file in which to save the image - ``density`` - integer (default: 150) - ``d...
"""
r"""
def FuzzyBallGraph(self, partition, q): """ Construct a Fuzzy Ball graph with the integer partition ``partition`` and ``q`` extra vertices.
Let q be an integer and let m_1,m_2,...m_k be a set of positive integers. Let n=q+m_1+...+m_k. The Fuzzy Ball graph with partition m_1,m_2,...,m_k and q extra vertices is the graph constructed from the graph G=K_n by attaching, for each i=1,2,...,k, a new vertex a_i to m_i distinct vertices of G. For given positive ...
Let `q` be an integer and let `m_1,m_2,...,m_k` be a set of positive integers. Let `n=q+m_1+...+m_k`. The Fuzzy Ball graph with partition `m_1,m_2,...,m_k` and `q` extra vertices is the graph constructed from the graph `G=K_n` by attaching, for each `i=1,2,...,k`, a new vertex `a_i` to `m_i` distinct vertices of `G`....
def FuzzyBallGraph(self, partition, q): """ Construct a Fuzzy Ball graph with the integer partition ``partition`` and ``q`` extra vertices.
Pick positive integers m and k and a nonnegative integer q. All the FuzzyBallGraphs constructed from partitions of m with k parts should be cospectral with respect to the normalized
Pick positive integers `m` and `k` and a nonnegative integer `q`. All the FuzzyBallGraphs constructed from partitions of `m` with `k` parts should be cospectral with respect to the normalized
def FuzzyBallGraph(self, partition, q): """ Construct a Fuzzy Ball graph with the integer partition ``partition`` and ``q`` extra vertices.