rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
sage: latex(maxima(derivative(ceil(x*y*d), d,x,x,y))) d^3\,\left({{{\it \partial}^4}\over{{\it \partial}\,d^4}}\, {\it ceil}\left(d , x , y\right)\right)\,x^2\,y^3+5\,d^2\,\left({{ {\it \partial}^3}\over{{\it \partial}\,d^3}}\,{\it ceil}\left(d , x , y\right)\right)\,x\,y^2+4\,d\,\left({{{\it \partial}^2}\over{ {\...
sage: f = function('f') sage: latex(maxima(derivative(f(x*y*d), d,x,x,y))) Traceback (most recent call last): ... NotImplementedError: arguments must be distinct variables sage: latex(maxima(derivative(f(x,y,d), d,x,x,y))) {{{\it \partial}^4}\over{{\it \partial}\,d\,{\it \partial}\,x^2\, {\it \partial}\,y}}\,f\left(x ...
def _latex_(self): """ Return Latex representation of this Maxima object. This calls the tex command in Maxima, then does a little post-processing to fix bugs in the resulting Maxima output. EXAMPLES:: sage: maxima('sqrt(2) + 1/3 + asin(5)')._latex_() '\\sin^{-1}\\cdot5+\\sqrt{2}+{{1}\\over{3}}'
3df11428618c5c580d8336f4e3959d5d28cedbee /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/3df11428618c5c580d8336f4e3959d5d28cedbee/maxima.py
Computes the matching polynomial of the graph G. The algorithm used is a recursive one, based on the following observation: - If e is an edge of G, G' is the result of deleting the edge e, and G'' is the result of deleting each vertex in e, then the matching polynomial of G is equal to that of G' minus that of G''.
Computes the matching polynomial of the graph `G`. If `p(G, k)` denotes the number of `k`-matchings (matchings with `k` edges) in `G`, then the matching polynomial is defined as [Godsil93]_: .. MATH:: \mu(x)=\sum_{k \geq 0} (-1)^k p(G,k) x^{n-2k}
def matching_polynomial(self, complement=True, name=None): """ Computes the matching polynomial of the graph G. The algorithm used is a recursive one, based on the following observation: - If e is an edge of G, G' is the result of deleting the edge e, and G'' is the result of deleting each vertex in e, then the match...
a96fca76b88679923495c25a8f7038fc0a87134b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/a96fca76b88679923495c25a8f7038fc0a87134b/graph.py
- ``complement`` - (default: True) whether to use a simple formula to compute the matching polynomial from that of the graphs complement
- ``complement`` - (default: ``True``) whether to use Godsil's duality theorem to compute the matching polynomial from that of the graphs complement (see ALGORITHM).
def matching_polynomial(self, complement=True, name=None): """ Computes the matching polynomial of the graph G. The algorithm used is a recursive one, based on the following observation: - If e is an edge of G, G' is the result of deleting the edge e, and G'' is the result of deleting each vertex in e, then the match...
a96fca76b88679923495c25a8f7038fc0a87134b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/a96fca76b88679923495c25a8f7038fc0a87134b/graph.py
NOTE: The ``complement`` option uses matching polynomials of complete graphs, which are cached. So if you are crazy enough to try computing the matching polynomial on a graph with millions of vertices, you might not want to use this option, since it will end up caching millions of polynomials of degree in the million...
def matching_polynomial(self, complement=True, name=None): """ Computes the matching polynomial of the graph G. The algorithm used is a recursive one, based on the following observation: - If e is an edge of G, G' is the result of deleting the edge e, and G'' is the result of deleting each vertex in e, then the match...
a96fca76b88679923495c25a8f7038fc0a87134b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/a96fca76b88679923495c25a8f7038fc0a87134b/graph.py
([0], [0])
([0], [])
def blocks_and_cut_vertices(self): """ Computes the blocks and cut vertices of the graph. In the case of a digraph, this computation is done on the underlying graph. A cut vertex is one whose deletion increases the number of connected components. A block is a maximal induced subgraph which itself has no cut vertices. ...
5a7f28a3590f4b03c94c306627d5375e72ad5e6c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/5a7f28a3590f4b03c94c306627d5375e72ad5e6c/generic_graph.py
return [s],[s]
return [s],[]
def blocks_and_cut_vertices(self): """ Computes the blocks and cut vertices of the graph. In the case of a digraph, this computation is done on the underlying graph. A cut vertex is one whose deletion increases the number of connected components. A block is a maximal induced subgraph which itself has no cut vertices. ...
5a7f28a3590f4b03c94c306627d5375e72ad5e6c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/5a7f28a3590f4b03c94c306627d5375e72ad5e6c/generic_graph.py
Check if a sage object belongs to self. This methods is a helper for
Check if a Sage object belongs to self. This methods is a helper for
def _is_a(self, x): """ Check if a sage object belongs to self. This methods is a helper for :meth:`__contains__` and the constructor :meth:`_element_constructor_`.
d9d83f5a9c9ea111709e31b91865d69dbf57b943 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/d9d83f5a9c9ea111709e31b91865d69dbf57b943/disjoint_union_enumerated_sets.py
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 ...
91d27e66f177ab5b528f11b1d770546675589ac4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/91d27e66f177ab5b528f11b1d770546675589ac4/tableau.py
Returns a list of the immediate super categories of self.
Returns a list of the immediate super categories of ``self``.
def super_categories(self): """ Returns a list of the immediate super categories of self.
139ef2d2c34f2c0f726f57270b73cfee9e6b37cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/139ef2d2c34f2c0f726f57270b73cfee9e6b37cd/monoids.py
- often uses self.one().
- often uses ``self.one()``.
def one(self): r""" Returns the one of the monoid, that is the unique neutral element for `*`.
139ef2d2c34f2c0f726f57270b73cfee9e6b37cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/139ef2d2c34f2c0f726f57270b73cfee9e6b37cd/monoids.py
Backward compatibility alias for :meth:`self.one()`.
Backward compatibility alias for :meth:`one`.
def one_element(self): r""" Backward compatibility alias for :meth:`self.one()`.
139ef2d2c34f2c0f726f57270b73cfee9e6b37cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/139ef2d2c34f2c0f726f57270b73cfee9e6b37cd/monoids.py
Returns the product of the elements in `args`, as an element of `self`. EXAMPLES:
Returns the product of the elements in ``args``, as an element of ``self``. EXAMPLES::
def prod(self, args): r""" n-ary product
139ef2d2c34f2c0f726f57270b73cfee9e6b37cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/139ef2d2c34f2c0f726f57270b73cfee9e6b37cd/monoids.py
def prod(self, args): r""" n-ary product
139ef2d2c34f2c0f726f57270b73cfee9e6b37cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/139ef2d2c34f2c0f726f57270b73cfee9e6b37cd/monoids.py
Returns whether self is the one of the monoid
Returns whether ``self`` is the one of the monoid
def is_one(self): r""" Returns whether self is the one of the monoid
139ef2d2c34f2c0f726f57270b73cfee9e6b37cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/139ef2d2c34f2c0f726f57270b73cfee9e6b37cd/monoids.py
- n: a non negative integer
- ``n``: a non negative integer
def __pow__(self, n): r""" INPUTS: - n: a non negative integer
139ef2d2c34f2c0f726f57270b73cfee9e6b37cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/139ef2d2c34f2c0f726f57270b73cfee9e6b37cd/monoids.py
A naive implementation of __pow__
A naive implementation of ``__pow__``
def _pow_naive(self, n): r""" A naive implementation of __pow__
139ef2d2c34f2c0f726f57270b73cfee9e6b37cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/139ef2d2c34f2c0f726f57270b73cfee9e6b37cd/monoids.py
- n: a non negative integer
- ``n``: a non negative integer
def _pow_naive(self, n): r""" A naive implementation of __pow__
139ef2d2c34f2c0f726f57270b73cfee9e6b37cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/139ef2d2c34f2c0f726f57270b73cfee9e6b37cd/monoids.py
faster du to size explotion).
faster due to size explosion).
def _pow_naive(self, n): r""" A naive implementation of __pow__
139ef2d2c34f2c0f726f57270b73cfee9e6b37cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/139ef2d2c34f2c0f726f57270b73cfee9e6b37cd/monoids.py
def is_cyclic_ordered(x1,x2,x3): return ( (x1 < x2 and x2 < x3) or (x2 < x3 and x3 < x1) or (x3 < x1 and x1 < x2))
def is_cyclic_ordered(x1,x2,x3): return ( (x1 < x2 and x2 < x3) or (x2 < x3 and x3 < x1) or (x3 < x1 and x1 < x2))
7644ef2f3a036f34c4729b1b94ea5317c23e6ab4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7644ef2f3a036f34c4729b1b94ea5317c23e6ab4/arc.py
Primitive class for the Arc graphics type. See arc? for information
Primitive class for the Arc graphics type. See ``arc?`` for information
def is_cyclic_ordered(x1,x2,x3): return ( (x1 < x2 and x2 < x3) or (x2 < x3 and x3 < x1) or (x3 < x1 and x1 < x2))
7644ef2f3a036f34c4729b1b94ea5317c23e6ab4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7644ef2f3a036f34c4729b1b94ea5317c23e6ab4/arc.py
Note that the construction should be done using arc::
Note that the construction should be done using ``arc``::
def is_cyclic_ordered(x1,x2,x3): return ( (x1 < x2 and x2 < x3) or (x2 < x3 and x3 < x1) or (x3 < x1 and x1 < x2))
7644ef2f3a036f34c4729b1b94ea5317c23e6ab4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7644ef2f3a036f34c4729b1b94ea5317c23e6ab4/arc.py
Initializes base class Arc.
Initializes base class ``Arc``.
def __init__(self, x, y, r1, r2, angle, s1, s2, options): """ Initializes base class Arc.
7644ef2f3a036f34c4729b1b94ea5317c23e6ab4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7644ef2f3a036f34c4729b1b94ea5317c23e6ab4/arc.py
The same example with a rotation of angle pi/2::
The same example with a rotation of angle `\pi/2`::
def get_minmax_data(self): """ Returns a dictionary with the bounding box data.
7644ef2f3a036f34c4729b1b94ea5317c23e6ab4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7644ef2f3a036f34c4729b1b94ea5317c23e6ab4/arc.py
Return the allowed options for the Arc class.
Return the allowed options for the ``Arc`` class.
def _allowed_options(self): """ Return the allowed options for the Arc class.
7644ef2f3a036f34c4729b1b94ea5317c23e6ab4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7644ef2f3a036f34c4729b1b94ea5317c23e6ab4/arc.py
String representation of Arc primitive.
String representation of ``Arc`` primitive.
def _repr_(self): """ String representation of Arc primitive.
7644ef2f3a036f34c4729b1b94ea5317c23e6ab4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7644ef2f3a036f34c4729b1b94ea5317c23e6ab4/arc.py
TESTS:
TESTS::
def plot3d(self): r""" TESTS:
7644ef2f3a036f34c4729b1b94ea5317c23e6ab4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7644ef2f3a036f34c4729b1b94ea5317c23e6ab4/arc.py
def __init__(self, *args, **kwargs): """ Construct a substitution box (S-box) for a given lookup table `S`.
8f5105cd01350d52874cc358488bd0c99c78a7d1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8f5105cd01350d52874cc358488bd0c99c78a7d1/sbox.py
def __init__(self, *args, **kwargs): """ Construct a substitution box (S-box) for a given lookup table `S`.
8f5105cd01350d52874cc358488bd0c99c78a7d1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8f5105cd01350d52874cc358488bd0c99c78a7d1/sbox.py
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`.
8f5105cd01350d52874cc358488bd0c99c78a7d1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8f5105cd01350d52874cc358488bd0c99c78a7d1/sbox.py
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`.
8f5105cd01350d52874cc358488bd0c99c78a7d1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8f5105cd01350d52874cc358488bd0c99c78a7d1/sbox.py
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`.
8f5105cd01350d52874cc358488bd0c99c78a7d1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8f5105cd01350d52874cc358488bd0c99c78a7d1/sbox.py
raise ValueError, "n must be greater than lbound: %s"%(lbound)
raise ValueError, "n must be at least lbound: %s"%(lbound)
def random_prime(n, proof=None, lbound=2): """ Returns a random prime p between `lbound` and n (i.e. `lbound <= p <= n`). The returned prime is chosen uniformly at random from the set of prime numbers less than or equal to n. INPUT: - ``n`` - an integer >= 2. - ``proof`` - bool or None (default: None) If False, th...
e56ef82a014bda22549bb55cc0a82b2c1df29cdd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/e56ef82a014bda22549bb55cc0a82b2c1df29cdd/arith.py
return ZZ(n)
return n lbound = max(2, lbound) if lbound > 2: if lbound == 3 or n <= 2*lbound - 2: if lbound < 25 or n <= 6*lbound/5: if lbound < 2010760 or n <= 16598*lbound/16597: if proof: smallest_prime = ZZ(lbound-1).next_prime() else: smallest_prime = ZZ(lbound-1).next_probable_prime() if smallest_prime > n: raise ValueErro...
def random_prime(n, proof=None, lbound=2): """ Returns a random prime p between `lbound` and n (i.e. `lbound <= p <= n`). The returned prime is chosen uniformly at random from the set of prime numbers less than or equal to n. INPUT: - ``n`` - an integer >= 2. - ``proof`` - bool or None (default: None) If False, th...
e56ef82a014bda22549bb55cc0a82b2c1df29cdd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/e56ef82a014bda22549bb55cc0a82b2c1df29cdd/arith.py
if not proof: prime_test = is_pseudoprime else: prime_test = is_prime randint = current_randstate().python_random().randint while(1): p = randint(lbound,n) if prime_test(p): return ZZ(p)
prime_test = is_pseudoprime randint = current_randstate().python_random().randint while True: p = randint(lbound, n) if prime_test(p): return ZZ(p)
def random_prime(n, proof=None, lbound=2): """ Returns a random prime p between `lbound` and n (i.e. `lbound <= p <= n`). The returned prime is chosen uniformly at random from the set of prime numbers less than or equal to n. INPUT: - ``n`` - an integer >= 2. - ``proof`` - bool or None (default: None) If False, th...
e56ef82a014bda22549bb55cc0a82b2c1df29cdd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/e56ef82a014bda22549bb55cc0a82b2c1df29cdd/arith.py
Return a new Weierstrass model of self under the standard transformation `(u,r,s,,t)`
Return a new Weierstrass model of self under the standard transformation `(u,r,s,t)`
def change_weierstrass_model(self, *urst): r""" Return a new Weierstrass model of self under the standard transformation `(u,r,s,,t)` .. math:: (x,y) \mapsto (x',y') = (u^2xr , u^3y + su^2x' + t). EXAMPLES:: sage: E = EllipticCurve('15a') sage: F1 = E.change_weierstrass_model([1/2,0,0,0]); F1 Elliptic Curve define...
66b6ac7655e127a96d30bc4ef76eb990fe9acbba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/66b6ac7655e127a96d30bc4ef76eb990fe9acbba/ell_generic.py
(x,y) \mapsto (x',y') = (u^2xr , u^3y + su^2x' + t).
(x,y) \mapsto (x',y') = (u^2x + r , u^3y + su^2x + t).
def change_weierstrass_model(self, *urst): r""" Return a new Weierstrass model of self under the standard transformation `(u,r,s,,t)` .. math:: (x,y) \mapsto (x',y') = (u^2xr , u^3y + su^2x' + t). EXAMPLES:: sage: E = EllipticCurve('15a') sage: F1 = E.change_weierstrass_model([1/2,0,0,0]); F1 Elliptic Curve define...
66b6ac7655e127a96d30bc4ef76eb990fe9acbba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/66b6ac7655e127a96d30bc4ef76eb990fe9acbba/ell_generic.py
Construct a module with basis from the data in ``x``
Construct a module with basis from the data in ``x``.
def _call_(self, x): """ Construct a module with basis from the data in ``x``
8132f76a188ef7cf8b33392c6491b9677e5523ca /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8132f76a188ef7cf8b33392c6491b9677e5523ca/modules_with_basis.py
Returns whether this category is abelian
Returns whether this category is abelian.
def is_abelian(self): """ Returns whether this category is abelian
8132f76a188ef7cf8b33392c6491b9677e5523ca /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8132f76a188ef7cf8b33392c6491b9677e5523ca/modules_with_basis.py
With the ``zero`` argument, one can define affine morphisms:
With the ``zero`` argument, one can define affine morphisms::
def module_morphism(self, on_basis = None, diagonal = None, triangular = None, **keywords): r""" Constructs morphisms by linearity
8132f76a188ef7cf8b33392c6491b9677e5523ca /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8132f76a188ef7cf8b33392c6491b9677e5523ca/modules_with_basis.py
Or more generaly any ring admitting a coercion map from the base ring:
Or more generaly any ring admitting a coercion map from the base ring::
def module_morphism(self, on_basis = None, diagonal = None, triangular = None, **keywords): r""" Constructs morphisms by linearity
8132f76a188ef7cf8b33392c6491b9677e5523ca /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8132f76a188ef7cf8b33392c6491b9677e5523ca/modules_with_basis.py
Return a list of primary ideals (and their associated primes) such that their intersection is `I` = ``self``.
Return a list of the associated primes of primary ideals of which the intersection is `I` = ``self``.
def associated_primes(self, algorithm='sy'): r""" Return a list of primary ideals (and their associated primes) such that their intersection is `I` = ``self``. An ideal `Q` is called primary if it is a proper ideal of the ring `R` and if whenever `ab \in Q` and `a \not\in Q` then `b^n \in Q` for some `n \in \ZZ`. If ...
fea89909599e97cb2dd40bdd0830390795cbcf35 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/fea89909599e97cb2dd40bdd0830390795cbcf35/multi_polynomial_ideal.py
def associated_primes(self, algorithm='sy'): r""" Return a list of primary ideals (and their associated primes) such that their intersection is `I` = ``self``. An ideal `Q` is called primary if it is a proper ideal of the ring `R` and if whenever `ab \in Q` and `a \not\in Q` then `b^n \in Q` for some `n \in \ZZ`. If ...
fea89909599e97cb2dd40bdd0830390795cbcf35 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/fea89909599e97cb2dd40bdd0830390795cbcf35/multi_polynomial_ideal.py
- ``list`` - a list of primary ideals and their associated primes [(primary ideal, associated prime), ...]
- ``list`` - a list of associated primes
def associated_primes(self, algorithm='sy'): r""" Return a list of primary ideals (and their associated primes) such that their intersection is `I` = ``self``. An ideal `Q` is called primary if it is a proper ideal of the ring `R` and if whenever `ab \in Q` and `a \not\in Q` then `b^n \in Q` for some `n \in \ZZ`. If ...
fea89909599e97cb2dd40bdd0830390795cbcf35 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/fea89909599e97cb2dd40bdd0830390795cbcf35/multi_polynomial_ideal.py
def ChainPoset(self, n): """ Returns a chain (a totally ordered poset) containing ``n`` elements.
b032b0345bd293a97a5c2d704129f7946f61a4de /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/b032b0345bd293a97a5c2d704129f7946f61a4de/poset_examples.py
""" c = [[x+1] for x in range(n)] c[n-1] = [] return LatticePoset(c)
TESTS: Check that sage: Posets.ChainPoset(0) Finite lattice containing 0 elements sage: C = Posets.ChainPoset(1); C Finite lattice containing 1 elements sage: C.cover_relations() [] sage: C = Posets.ChainPoset(2); C Finite lattice containing 2 elements sage: C.cover_relations() [[0, 1]] """ return LatticePoset((rang...
def ChainPoset(self, n): """ Returns a chain (a totally ordered poset) containing ``n`` elements.
b032b0345bd293a97a5c2d704129f7946f61a4de /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/b032b0345bd293a97a5c2d704129f7946f61a4de/poset_examples.py
def AntichainPoset(self, n): """ Returns an antichain (a poset with no comparable elements) containing ``n`` elements.
b032b0345bd293a97a5c2d704129f7946f61a4de /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/b032b0345bd293a97a5c2d704129f7946f61a4de/poset_examples.py
""" c = [[] for x in range(n)] return Poset(c)
TESTS: Check that sage: Posets.AntichainPoset(0) Finite poset containing 0 elements sage: C = Posets.AntichainPoset(1); C Finite poset containing 1 elements sage: C.cover_relations() [] sage: C = Posets.AntichainPoset(2); C Finite poset containing 2 elements sage: C.cover_relations() [] """ return Poset((range(n), [...
def AntichainPoset(self, n): """ Returns an antichain (a poset with no comparable elements) containing ``n`` elements.
b032b0345bd293a97a5c2d704129f7946f61a4de /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/b032b0345bd293a97a5c2d704129f7946f61a4de/poset_examples.py
""" return Vobj.evaluated_on(self)
If you pass a vector, it is assumed to be the coordinate vector of a point:: sage: ineq.eval( vector(ZZ, [3,2]) ) -4 """ try: return Vobj.evaluated_on(self) except AttributeError: return self.A() * Vobj + self.b()
def eval(self, Vobj): r""" Evaluates the left hand side `A\vec{x}+b` on the given vertex/ray/line. NOTES: * Evaluating on a vertex returns `A\vec{x}+b` * Evaluating on a ray returns `A\vec{r}`. Only the sign or whether it is zero is meaningful. * Evaluating on a line returns `A\vec{l}`. Only whether it is zero or not...
84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc/polyhedra.py
is_inequality.__doc__ = Hrepresentation.is_inequality.__doc__
def is_inequality(self): """ Returns True since this is, by construction, an inequality.
84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc/polyhedra.py
"""
If you pass a vector, it is assumed to be the coordinate vector of a point:: sage: P = Polyhedron(vertices=[[1,1],[1,-1],[-1,1],[-1,-1]]) sage: p = vector(ZZ, [1,0] ) sage: [ ieq.interior_contains(p) for ieq in P.inequality_generator() ] [True, True, True, False] """ try: if Vobj.is_vector(): return self.polyhedron()...
def interior_contains(self, Vobj): """ Tests whether the interior of the halfspace (excluding its boundary) defined by the inequality contains the given vertex/ray/line.
84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc/polyhedra.py
is_equation.__doc__ = Hrepresentation.is_equation.__doc__
def is_equation(self): """ Tests if this object is an equation. By construction, it must be.
84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc/polyhedra.py
is_vertex.__doc__ = Vrepresentation.is_vertex.__doc__
def is_vertex(self): """ Tests if this object is a vertex. By construction it always is.
84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc/polyhedra.py
is_ray.__doc__ = Vrepresentation.is_ray.__doc__
def is_ray(self): """ Tests if this object is a ray. Always True by construction.
84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc/polyhedra.py
is_line.__doc__ = Vrepresentation.is_line.__doc__
def is_line(self): """ Tests if the object is a line. By construction it must be.
84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc/polyhedra.py
Returns the identity projection.
Returns the identity projection of the polyhedron.
def identity(self): """ Returns the identity projection.
84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc/polyhedra.py
identity.__doc__ = projection_func_identity.__doc__
def identity(self): """ Returns the identity projection.
84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/84c90f627aa2eefd601a2ae3a4ad63f4e91ac1cc/polyhedra.py
- ``category`` - a category; reserved for future use - ``skip`` - a string or list (or iterable) of strings
- ``category`` - a category; reserved for future use - ``skip`` - a string or list (or iterable) of strings
def run(self, category = None, skip = [], catch = True, raise_on_failure = False, **options): """ Run all the tests from this test suite:
2e93f797c6c79f37d5bddd19d9592c505bf4e432 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/2e93f797c6c79f37d5bddd19d9592c505bf4e432/sage_unittest.py
- ``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:
2e93f797c6c79f37d5bddd19d9592c505bf4e432 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/2e93f797c6c79f37d5bddd19d9592c505bf4e432/sage_unittest.py
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 ...
2e93f797c6c79f37d5bddd19d9592c505bf4e432 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/2e93f797c6c79f37d5bddd19d9592c505bf4e432/sage_unittest.py
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.
2e93f797c6c79f37d5bddd19d9592c505bf4e432 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/2e93f797c6c79f37d5bddd19d9592c505bf4e432/sage_unittest.py
xy_data_arrays = map(lambda g: [[g(x, y) for x in xsrange(*ranges[0], include_endpoint=True)] for y in xsrange(*ranges[1], include_endpoint=True)], g) xy_data_array = map(lambda *rows: map(lambda *vals: mangle_neg(vals), *rows), *xy_data_arrays)
xy_data_arrays = numpy.asarray([[[func(x, y) for x in xsrange(*ranges[0], include_endpoint=True)] for y in xsrange(*ranges[1], include_endpoint=True)] for func in g],dtype=float) xy_data_array=numpy.abs(xy_data_arrays.prod(axis=0)) neg_indices = (xy_data_arrays<0).all(axis=0) xy_data_array[neg_indices]=-xy_data_array...
def region_plot(f, xrange, yrange, plot_points, incol, outcol, bordercol, borderstyle, borderwidth): r""" ``region_plot`` takes a boolean function of two variables, `f(x,y)` and plots the region where f is True over the specified ``xrange`` and ``yrange`` as demonstrated below. ``region_plot(f, (xmin, xmax), (ymin, ym...
63c73066c1587ec9886ecf425b6e5da537144bd9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/63c73066c1587ec9886ecf425b6e5da537144bd9/contour_plot.py
def mangle_neg(vals): """ Returns the product of all values in vals, with the result nonnegative if any of the values is nonnegative. EXAMPLES:: sage: from sage.plot.contour_plot import mangle_neg sage: mangle_neg([-1.2, -0.74, -2.56, -1.01]) -2.29601280000000 sage: mangle_neg([-1.2, 0.0, -2.56]) 0.000000000000000 s...
def equify(f): """ Returns the equation rewritten as a symbolic function to give negative values when True, positive when False. EXAMPLES:: sage: from sage.plot.contour_plot import equify sage: var('x, y') (x, y) sage: equify(x^2 < 2) x^2 - 2 sage: equify(x^2 > 2) -x^2 + 2 sage: equify(x*y > 1) -x*y + 1 sage: equify(...
63c73066c1587ec9886ecf425b6e5da537144bd9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/63c73066c1587ec9886ecf425b6e5da537144bd9/contour_plot.py
def order(self, *gens, **kwds):
def order(self, *args, **kwds):
def order(self, *gens, **kwds): r""" Return the order with given ring generators in the maximal order of this number field. INPUT: - ``gens`` - list of elements of self; if no generators are given, just returns the cardinality of this number field (oo) for consistency. - ``check_is_integral`` - bool (default: Tru...
242285f9eba614ac96ab97dbf141142a8eca9858 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/242285f9eba614ac96ab97dbf141142a8eca9858/number_field.py
def order(self, *gens, **kwds): r""" Return the order with given ring generators in the maximal order of this number field. INPUT: - ``gens`` - list of elements of self; if no generators are given, just returns the cardinality of this number field (oo) for consistency. - ``check_is_integral`` - bool (default: Tru...
242285f9eba614ac96ab97dbf141142a8eca9858 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/242285f9eba614ac96ab97dbf141142a8eca9858/number_field.py
"""
sage: K.<a> = NumberField(x^3 - 2) sage: ZZ[a] Order in Number Field in a0 with defining polynomial x^3 - 2 TESTS: We verify that trac sage: K.<a> = NumberField(x^4 + 4*x^2 + 2) sage: B = K.integral_basis() sage: K.order(*B) Order in Number Field in a with defining polynomial x^4 + 4*x^2 + 2 sage: K.order(B) Order ...
def order(self, *gens, **kwds): r""" Return the order with given ring generators in the maximal order of this number field. INPUT: - ``gens`` - list of elements of self; if no generators are given, just returns the cardinality of this number field (oo) for consistency. - ``check_is_integral`` - bool (default: Tru...
242285f9eba614ac96ab97dbf141142a8eca9858 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/242285f9eba614ac96ab97dbf141142a8eca9858/number_field.py
- ``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:
ac01f803958583026685031a12eb209830c3f54d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/ac01f803958583026685031a12eb209830c3f54d/word.py
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:
ac01f803958583026685031a12eb209830c3f54d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/ac01f803958583026685031a12eb209830c3f54d/word.py
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:
ac01f803958583026685031a12eb209830c3f54d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/ac01f803958583026685031a12eb209830c3f54d/word.py
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:
ac01f803958583026685031a12eb209830c3f54d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/ac01f803958583026685031a12eb209830c3f54d/word.py
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:
ac01f803958583026685031a12eb209830c3f54d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/ac01f803958583026685031a12eb209830c3f54d/word.py
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:
ac01f803958583026685031a12eb209830c3f54d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/ac01f803958583026685031a12eb209830c3f54d/word.py
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:
ac01f803958583026685031a12eb209830c3f54d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/ac01f803958583026685031a12eb209830c3f54d/word.py
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:
ac01f803958583026685031a12eb209830c3f54d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/ac01f803958583026685031a12eb209830c3f54d/word.py
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:
ac01f803958583026685031a12eb209830c3f54d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/ac01f803958583026685031a12eb209830c3f54d/word.py
-0.530637530952518 + 1.11851787964371*I
0.530637530952518 - 1.11851787964371*I
def __init__(self): r""" The inverse of the hyperbolic secant function.
343edcd46184b355d8d557570e118333acd4c8fa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/343edcd46184b355d8d557570e118333acd4c8fa/hyperbolic.py
.. [CB07] Nicolas T\. Courtois, Gregory V\. Bard *Algebraic Cryptanalysis of the Data Encryption Standard*; Cryptography and Coding -- 11th IMA International Conference; 2007; available at http://eprint.iacr.org/2006/402
.. [CBJ07] Gregory V\. Bard, and Nicolas T\. Courtois, and Chris Jefferson. *Efficient Methods for Conversion and Solution of Sparse Systems of Low-Degree Multivariate Polynomials over GF(2) via SAT-Solvers*. Cryptology ePrint Archive: Report 2007/024. available at http://eprint.iacr.org/2007/024
def eliminate_linear_variables(self, maxlength=3, skip=lambda lm,tail: False): """ Return a new system where "linear variables" are eliminated.
71ea588c33eb90a29e0856669b0e8d3a3b9b2e8c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/71ea588c33eb90a29e0856669b0e8d3a3b9b2e8c/mpolynomialsystem.py
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...
30be9d12c724c13a62417b00fbc1b13092236bfe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/30be9d12c724c13a62417b00fbc1b13092236bfe/ell_rational_field.py
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...
30be9d12c724c13a62417b00fbc1b13092236bfe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/30be9d12c724c13a62417b00fbc1b13092236bfe/ell_rational_field.py
Normalization of arguments; see :cls:`UniqueRepresentation`.
Normalization of arguments; see :class:`UniqueRepresentation`.
def __classcall_private__(cls, fam, facade=True, keepkey=False): # was *args, **options): """ Normalization of arguments; see :cls:`UniqueRepresentation`.
1b26096ba2e7d52d9415bdb2fc4fec10259fbe9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/1b26096ba2e7d52d9415bdb2fc4fec10259fbe9d/disjoint_union_enumerated_sets.py
sage: import operator
def derivative(self, ex, operator): """ EXAMPLES::
7612ee2120a60eefd18f1ae87983f5942390076d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7612ee2120a60eefd18f1ae87983f5942390076d/expression_conversions.py
sage: a = function('f', x).diff(x); a
sage: f = function('f') sage: a = f(x).diff(x); a
def derivative(self, ex, operator): """ EXAMPLES::
7612ee2120a60eefd18f1ae87983f5942390076d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7612ee2120a60eefd18f1ae87983f5942390076d/expression_conversions.py
sage: b = function('f', x).diff(x).diff(x)
sage: b = f(x).diff(x, x)
def derivative(self, ex, operator): """ EXAMPLES::
7612ee2120a60eefd18f1ae87983f5942390076d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7612ee2120a60eefd18f1ae87983f5942390076d/expression_conversions.py
args = ex.args()
args = ex.operands()
def derivative(self, ex, operator): """ EXAMPLES::
7612ee2120a60eefd18f1ae87983f5942390076d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7612ee2120a60eefd18f1ae87983f5942390076d/expression_conversions.py
"""
r"""
def strip_answer(self, s): """ Returns the string s with Matlab's answer prompt removed. EXAMPLES:: sage: s = '\nans =\n\n 2\n' sage: matlab.strip_answer(s) ' 2' """ i = s.find('=') return s[i+1:].strip('\n')
e94e2681ad1f6199efc5ab4c64ae109f91284db6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/e94e2681ad1f6199efc5ab4c64ae109f91284db6/matlab.py
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...
21279e7d739d6177b46be251da7e561641f0d9e0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/21279e7d739d6177b46be251da7e561641f0d9e0/contfrac.py
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
21279e7d739d6177b46be251da7e561641f0d9e0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/21279e7d739d6177b46be251da7e561641f0d9e0/contfrac.py
"""
r"""
def cospectral_graphs(self, vertices, matrix_function=lambda g: g.adjacency_matrix(), graphs=None): """ Find all sets of graphs on ``vertices`` vertices (with possible restrictions) which are cospectral with respect to a constructed matrix.
d1883d40a558a65b91073fd643c1cd00012a28d3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/d1883d40a558a65b91073fd643c1cd00012a28d3/graph_generators.py
cospectral graphs.
cospectral graphs (lists of cadinality 1 being omitted).
def cospectral_graphs(self, vertices, matrix_function=lambda g: g.adjacency_matrix(), graphs=None): """ Find all sets of graphs on ``vertices`` vertices (with possible restrictions) which are cospectral with respect to a constructed matrix.
d1883d40a558a65b91073fd643c1cd00012a28d3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/d1883d40a558a65b91073fd643c1cd00012a28d3/graph_generators.py
is enough to check the spectrum of the matrix `D^{-1}A`, where D
is enough to check the spectrum of the matrix `D^{-1}A`, where `D`
def cospectral_graphs(self, vertices, matrix_function=lambda g: g.adjacency_matrix(), graphs=None): """ Find all sets of graphs on ``vertices`` vertices (with possible restrictions) which are cospectral with respect to a constructed matrix.
d1883d40a558a65b91073fd643c1cd00012a28d3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/d1883d40a558a65b91073fd643c1cd00012a28d3/graph_generators.py
- ``scope`` -- namespace (default: global);
- ``scope`` -- namespace (default: global, not just the scope from which this function was called);
def inject_coefficients(self, scope=None, verbose=True): r""" Inject generators of the base field of ``self`` into ``scope``.
bc08271a149642c16f0a0e051f10fcd76466364e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/bc08271a149642c16f0a0e051f10fcd76466364e/toric_variety.py
sage: P1xP1 = ToricVariety(fan) sage: P1xP1.inject_coefficients() The last command does nothing, since ``P1xP1`` is defined over `\QQ`. Let's construct a toric variety over a more complicated field::
def inject_coefficients(self, scope=None, verbose=True): r""" Inject generators of the base field of ``self`` into ``scope``.
bc08271a149642c16f0a0e051f10fcd76466364e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/bc08271a149642c16f0a0e051f10fcd76466364e/toric_variety.py
""" if is_FractionField(self.base_ring()):
We check that we can use names ``a`` and ``b``, Trac sage: a + b a + b sage: a + b in P1xP1.coordinate_ring() True """ if scope is None: depth = 0 while True: scope = sys._getframe(depth).f_globals if (scope["__name__"] == "__main__" and scope["__package__"] is None): break depth += 1 try:
def inject_coefficients(self, scope=None, verbose=True): r""" Inject generators of the base field of ``self`` into ``scope``.
bc08271a149642c16f0a0e051f10fcd76466364e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/bc08271a149642c16f0a0e051f10fcd76466364e/toric_variety.py
ValueError: polys (=[x - y, x*y]) must be homogeneous of the same degree
ValueError: polys (=[x - y, x*y]) must be of the same degree sage: H([x-1, x*y+x]) Traceback (most recent call last): ... ValueError: polys (=[x - 1, x*y + x]) must be homogeneous
def _repr_defn(self): """ This function is used internally for printing.
7c6386781b714529e227cb24f2cc53a73badf2c2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7c6386781b714529e227cb24f2cc53a73badf2c2/morphism.py
deg = self.defining_polynomials()[0].degree() for poly in self.defining_polynomials(): if (poly.degree() != deg) or not poly.is_homogeneous(): raise ValueError, "polys (=%s) must be homogeneous of the same degree"%polys
polys = self.defining_polynomials() try: d = polys[0].degree() except AttributeError: polys = [f.lift() for f in polys] if not all([f.is_homogeneous() for f in polys]): raise ValueError, "polys (=%s) must be homogeneous"%polys degs = [f.degree() for f in polys] if not all([d==degs[0] for d in degs[1:]]): raise ValueEr...
def __init__(self, parent, polys, check=True): SchemeMorphism_on_points.__init__(self, parent, polys, check) if check: # morphisms from projective space are always given by # homogeneous polynomials of the same degree deg = self.defining_polynomials()[0].degree() for poly in self.defining_polynomials(): if (poly.degree...
7c6386781b714529e227cb24f2cc53a73badf2c2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/7c6386781b714529e227cb24f2cc53a73badf2c2/morphism.py
return matrix_space.MatrixSpace(ring, n, n, sparse).identity_matrix()
return matrix_space.MatrixSpace(ring, n, n, sparse)(1)
def identity_matrix(ring, n=0, sparse=False): r""" Return the `n \times n` identity matrix over the given ring. The default ring is the integers. EXAMPLES:: sage: M = identity_matrix(QQ, 2); M [1 0] [0 1] sage: M.parent() Full MatrixSpace of 2 by 2 dense matrices over Rational Field sage: M = identity_matrix(2); M [...
9eeca7a233e4a645a1a7472d0cbd46b274e1526d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/9eeca7a233e4a645a1a7472d0cbd46b274e1526d/constructor.py
return matrix_space.MatrixSpace(ring, nrows, ncols, sparse).zero_matrix()
return matrix_space.MatrixSpace(ring, nrows, ncols, sparse)(0)
def zero_matrix(ring, nrows, ncols=None, sparse=False): r""" Return the `nrows \times ncols` zero matrix over the given ring. The default ring is the integers. EXAMPLES:: sage: M = zero_matrix(QQ, 2); M [0 0] [0 0] sage: M.parent() Full MatrixSpace of 2 by 2 dense matrices over Rational Field sage: M = zero_matrix(2...
9eeca7a233e4a645a1a7472d0cbd46b274e1526d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/9eeca7a233e4a645a1a7472d0cbd46b274e1526d/constructor.py
sage: browse_sage_doc(identity_matrix, 'rst')[:9] '**File:**' sage: browse_sage_doc(identity_matrix, 'rst')[-60:] 'MatrixSpace of 3 by 3 sparse matrices over Integer Ring\n ' sage: browse_sage_doc(identity_matrix, 'html', False)[:59] '<div class="docstring">\n \n <p><strong>File:</strong> /v'
sage: browse_sage_doc(identity_matrix, 'rst') "...**File:**...**Type:**...**Definition:** identity_matrix..." sage: identity_matrix.__doc__.replace('\\','\\\\') in browse_sage_doc(identity_matrix, 'rst') True sage: browse_sage_doc(identity_matrix, 'html', False) '...div...File:...Type:...Definition:...identity_matrix.....
def __call__(self, obj, output='html', view=True): r""" Return the documentation for ``obj``.
9fd332d57559ae1941bee00643f9874974d25b5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/9fd332d57559ae1941bee00643f9874974d25b5b/sagedoc.py
for i in xrange(0, l - 2):
for i in xrange(0, l-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 """ l = self.length() if l < 2: return True suff = self for i in xrange(0,...
f361d63ef20ff00628a8007a912d533d88b634c5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/f361d63ef20ff00628a8007a912d533d88b634c5/finite_word.py
Return the number type that contains both `self.field()` and `other`.
Return the common field for both ``self`` and ``other``.
def coerce_field(self, other): """ Return the number type that contains both `self.field()` and `other`.
6f5d9d004aadaa2ef31b928e21f139a72b5e9ce0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/6f5d9d004aadaa2ef31b928e21f139a72b5e9ce0/polyhedra.py
The argument `other` must be either * another `Polyhedron()` object * `QQ` or `RDF` * a constant that can be coerced to `QQ` or `RDF`.
The argument ``other`` must be either: * another ``Polyhedron`` object * `\QQ` or `RDF` * a constant that can be coerced to `\QQ` or `RDF`
def coerce_field(self, other): """ Return the number type that contains both `self.field()` and `other`.
6f5d9d004aadaa2ef31b928e21f139a72b5e9ce0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/6f5d9d004aadaa2ef31b928e21f139a72b5e9ce0/polyhedra.py