rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
suff = suff[1:] | def is_square_free(self): r""" Returns True if self does not contain squares, and False otherwise. | |
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. |
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. |
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. |
suff = suff[1:] | def is_cube_free(self): r""" Returns True if self does not contain cubes, and False otherwise. | |
Returns an iterator through all curves with conductor between Nmin and Nmax-1, inclusive, in the database. | Return an iterator through all curves in the database with given conductors. | def iter(self, conductors): """ Returns an iterator through all curves with conductor between Nmin and Nmax-1, inclusive, in the database. |
Returns an iterator through all optimal curves with conductor between Nmin and Nmax-1 in the database. | Return an iterator through all optimal curves in the database with given conductors. | def iter_optimal(self, conductors): """ Returns an iterator through all optimal curves with conductor between Nmin and Nmax-1 in the database. |
Returns a list of all curves with conductor between Nmin and Nmax-1, inclusive, in the database. | Returns a list of all curves with given conductors. | def list(self, conductors): """ Returns a list of all curves with conductor between Nmin and Nmax-1, inclusive, in the database. |
Returns a list of all optimal curves with conductor between Nmin and Nmax-1, inclusive, in the database. | Returns a list of all optimal curves with given conductors. | def list_optimal(self, conductors): """ Returns a list of all optimal curves with conductor between Nmin and Nmax-1, inclusive, in the database. |
The smallest conductor for which the database is complete. (Always 1.) | The smallest conductor for which the database is complete: always 1. | def smallest_conductor(self): """ The smallest conductor for which the database is complete. (Always 1.) |
OUTPUT: - ``int`` - smallest cond - ``int`` - largest conductor plus one | OUTPUT: tuple of ints (N1,N2+1) where N1 is the smallest and N2 the largest conductor for which the database is complete. | def conductor_range(self): """ Return the range of conductors that are covered by the database. |
and coefficients bounded above by 10. :: | and coefficients bounded above by 10:: | def algdep(z, degree, known_bits=None, use_bits=None, known_digits=None, use_digits=None, height_bound=None, proof=False): """ Returns a polynomial of degree at most `degree` which is approximately satisfied by the number `z`. Note that the returned polynomial need not be irreducible, and indeed usually won't be if `z`... |
Now type show(P1), show(P2) to view these. AUTHORS: David Joyner (3-2006, 8-2007) | Now type show(P1), show(P2) to view these. AUTHORS: - David Joyner (3-2006, 8-2007) | def desolve_system_strings(des,vars,ics=None): """ Solves any size system of 1st order ODE's. Initials conditions are optional. INPUT: de -- a list of strings representing the ODEs in maxima notation (eg, de = "diff(f(x),x,2)=diff(f(x),x)+sin(x)") vars -- a list of strings representing the variables (eg, vars = ["... |
self._read_faces(self.poly_x("i")) | self._read_faces(self.poly_x("i", reduce_dimension=True)) | def _compute_faces(self): r""" Compute and cache faces of this polytope. |
Return the sequence of faces of this polytope. | Return the sequence of proper faces of this polytope. | def faces(self, dim=None, codim=None): r""" Return the sequence of faces of this polytope. |
self._points = self._embed(read_palp_matrix( self.poly_x("p", reduce_dimension=True))) self._points.set_immutable() | if self.dim() == 0: self._points = self._vertices else: self._points = self._embed(read_palp_matrix( self.poly_x("p", reduce_dimension=True))) self._points.set_immutable() | def points(self): r""" Return all lattice points of this polytope as columns of a matrix. |
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)` |
(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)` |
P1 = P[0]; P2 = P[1] | P1 = P[0] P2 = P[1] if is_Integer(P1) and is_Integer(P2): R = PolynomialRing(self.value_ring(), 'x') P1 = R(P1) P2 = R(P2) return JacobianMorphism_divisor_class_field(self, tuple([P1,P2])) if is_Integer(P1) and is_Polynomial(P2): R = PolynomialRing(self.value_ring(), 'x') P1 = R(P1) return JacobianMorphism_divisor_clas... | def __call__(self, P): r""" Returns a rational point P in the abstract Homset J(K), given: |
NOTE:: | NOTE: | def sturm_bound(self, M=None): r""" For a space M of modular forms, this function returns an integer B such that two modular forms in either self or M are equal if and only if their q-expansions are equal to precision B (note that this is 1+ the usual Sturm bound, since `O(q^\mathrm{prec})` has precision prec). If M is... |
def tamagawa_product(self): | def tamagawa_product_bsd(self): | def tamagawa_product(self): r""" Given an elliptic curve `E` over a number field `K`, this function returns the integer `C(E/K)` that appears in the Birch and Swinnerton-Dyer conjecture accounting for the local information at finite places. If the model is a global minimal model then `C(E/K)` is simply the product of t... |
sage: E.tamagawa_product() | sage: E.tamagawa_product_bsd() | def tamagawa_product(self): r""" Given an elliptic curve `E` over a number field `K`, this function returns the integer `C(E/K)` that appears in the Birch and Swinnerton-Dyer conjecture accounting for the local information at finite places. If the model is a global minimal model then `C(E/K)` is simply the product of t... |
sage: E2 Elliptic Curve defined by y^2 + a*x*y + (a+1)*y = x^3 + (a+1)*x^2 + (12289755603565800754*a-75759141535687466985)*x + (51556320144761417221790307379*a-317814501841918807353201512829) over Number Field in a with defining polynomial x^2 - 38 | sage: E2 Elliptic Curve defined by y^2 + a*x*y + (a+1)*y = x^3 + (a+1)*x^2 + (368258520200522046806318444*a-2270097978636731786720859345)*x + (8456608930173478039472018047583706316424*a-52130038506793883217874390501829588391299) over Number Field in a with defining polynomial x^2 - 38 | def global_minimal_model(self, proof = None): r""" Returns a model of self that is integral, minimal at all primes. |
_vars = str(self.gen()) | _vars = '(%s)'%self.gen() | def _singular_init_(self, singular=singular_default): """ Return a newly created Singular ring matching this ring. """ if not can_convert_to_singular(self): raise TypeError, "no conversion of this ring to a Singular ring defined" |
Digraph on 6 vertices | Hasse diagram of a poset containing 6 elements | def hasse_diagram(self): """ Returns the Hasse_diagram of the poset as a Sage DiGraph object. |
sage: m._scaling -2 | Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by -1, 2 or -2. sage: m._scaling 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... |
.. note:: Reference for the Sturm bound that we use in the definition of of this function: J. Sturm, On the congruence of modular forms, Number theory (New York, 1984-1985), Springer, Berlin, 1987, pp. 275-280. Useful Remark: | sage: CuspForms(Gamma1(144), 3).sturm_bound() 3457 sage: CuspForms(DirichletGroup(144).1^2, 3).sturm_bound() 73 sage: CuspForms(Gamma0(144), 3).sturm_bound() 73 REFERENCE: - [Sturm] J. Sturm, On the congruence of modular forms, Number theory (New York, 1984-1985), Springer, Berlin, 1987, pp. 275-280. NOTE:: | def sturm_bound(self, M=None): r""" For a space M of modular forms, this function returns an integer B such that two modular forms in either self or M are equal if and only if their q-expansions are equal to precision B (note that this is 1+ the usual Sturm bound, since `O(q^\mathrm{prec})` has precision prec). If M is... |
`s \geq` the sturm bound for `\Gamma_0` at | `s \geq` the Sturm bound for `\Gamma_0` at | def sturm_bound(self, M=None): r""" For a space M of modular forms, this function returns an integer B such that two modular forms in either self or M are equal if and only if their q-expansions are equal to precision B (note that this is 1+ the usual Sturm bound, since `O(q^\mathrm{prec})` has precision prec). If M is... |
self.__sturm_bound = self.group().sturm_bound(self.weight())+1 | self.__sturm_bound = G.sturm_bound(self.weight())+1 | def sturm_bound(self, M=None): r""" For a space M of modular forms, this function returns an integer B such that two modular forms in either self or M are equal if and only if their q-expansions are equal to precision B (note that this is 1+ the usual Sturm bound, since `O(q^\mathrm{prec})` has precision prec). If M is... |
def valuation(m, p): """ The exact power of p that divides m. m should be an integer or rational (but maybe other types work too.) | def valuation(m,*args1, **args2): """ | def valuation(m, p): """ The exact power of p that divides m. m should be an integer or rational (but maybe other types work too.) This actually just calls the m.valuation() method. If m is 0, this function returns rings.infinity. EXAMPLES:: sage: valuation(512,2) 9 sage: valuation(1,2) 0 sage: valuation(5/9, 3) -... |
If m is 0, this function returns rings.infinity. | See the documentation of m.valuation() for a more precise description. Use of this function by developers is discouraged. Use m.valuation() instead. .. NOTE:: This is not always a valuation in the mathematical sense. For more information see: sage.rings.finite_rings.integer_mod.IntegerMod_int.valuation | def valuation(m, p): """ The exact power of p that divides m. m should be an integer or rational (but maybe other types work too.) This actually just calls the m.valuation() method. If m is 0, this function returns rings.infinity. EXAMPLES:: sage: valuation(512,2) 9 sage: valuation(1,2) 0 sage: valuation(5/9, 3) -... |
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. |
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. |
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. |
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. |
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. |
if self._style == "coroots" and all(xv in ZZ for xv in x): | if self._style == "coroots" and isinstance(x, tuple) and all(xv in ZZ for xv in x): | def __call__(self, *args): """ Coerces the element into the ring. You may pass a vector in the ambient space, an element of the base_ring, or an argument list of integers (or half-integers for the spin types) which are the components of a vector in the ambient space. |
return QuotientRingElement(self.parent(), -self.__rep) | return self.parent()(-self.__rep) | def __neg__(self): """ EXAMPLES:: |
return QuotientRingElement(self.parent(), inv) | return self.parent()(inv) | def __invert__(self): """ EXAMPLES:: |
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. |
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. |
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:: |
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:: |
return QuotientRingElement(self.parent(), self.__rep.reduce(G)) | return self.parent()(self.__rep.reduce(G)) | def reduce(self, G): r""" Reduce this quotient ring element by a set of quotient ring elements ``G``. |
def __init__(self, polynomial, name=None, check=True, embedding=None, latex_name=None): | def __init__(self, polynomial, name=None, latex_name=None, check=True, embedding=None): | def __init__(self, polynomial, name=None, check=True, embedding=None, latex_name=None): """ Create a quadratic number field. |
sage: cmp(c1, 1) | sage: cmp(c1, 1) * cmp(1, c1) | def __cmp__(self, right): r""" Compare ``self`` and ``right``. |
if len(value) > parent.degree(): raise ValueError, "list too long" self.__value = pari(0).Mod(parent._pari_modulus())*parent._pari_one() for i in range(len(value)): self.__value = self.__value + pari(int(value[i])).Mod(parent._pari_modulus())*pari("a^%s"%i) | self.__value = (pari(value).Polrev("a") * parent._pari_one()).Mod(parent._pari_modulus()) | def __init__(self, parent, value, check=True): """ Create element of a finite field. |
more planar areas get fewer triangles, and areas with higher curvature get more triangles | more planar areas get fewer triangles, and areas with higher curvature get more triangles. | def get_colors(self, list): """ Parameters: list: an iterable collection of values which can be cast into colors -- typically an RGB triple, or an RGBA 4-tuple |
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. |
- ``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. |
- ``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. |
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. |
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. |
""" 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. |
- ``algorithm`` - string (default: 'gmp') - ``'gmp'`` - use the GMP C-library factorial function - ``'pari'`` - use PARI's factorial function | - ``algorithm`` - string (default: 'gmp'): - ``'gmp'`` - use the GMP C-library factorial function - ``'pari'`` - use PARI's factorial function | def factorial(n, algorithm='gmp'): r""" Compute the factorial of `n`, which is the product `1\cdot 2\cdot 3 \cdots (n-1)\cdot n`. INPUT: - ``n`` - an integer - ``algorithm`` - string (default: 'gmp') - ``'gmp'`` - use the GMP C-library factorial function - ``'pari'`` - use PARI's factorial function OUTPUT: an... |
sage: T = _ArbCoordTrans((x + y, x - y, z), z) sage: f(x, y) = x * y | sage: T = _ArbitraryCoordinates((x + y, x - y, z), z,[x,y]) sage: f(x, y) = 2*x+y | def to_cartesian(self, func, params): """ Returns a 3-tuple of functions, parameterized over ``params``, that represents the cartesian coordinates of the value of ``func``. |
[x + y, x - y, x*y] """ | (x + y, x - y, 2*x + y) sage: [h(1,2) for h in T.to_cartesian(lambda x,y: 2*x+y)] [3, -1, 4] """ | def to_cartesian(self, func, params): """ Returns a 3-tuple of functions, parameterized over ``params``, that represents the cartesian coordinates of the value of ``func``. |
sage: from sage.plot.plot3d.plot3d import _ArbCoordTrans | sage: from sage.plot.plot3d.plot3d import _ArbitraryCoordinates | def gen_transform(self, f=None, u=None, v=None): """ EXAMPLE:: |
sage: T = _ArbCoordTrans((x + y, x - y, z), x) The independent and dependent variables don't really matter in the case of an arbitrary transformation (since it is already in terms of its own variables), so default values are provided:: sage: T.indep_var 'f' sage: T.dep_vars ['u', 'v'] Finally, an example of gen_tran... | sage: T = _ArbitraryCoordinates((x + y, x - y, z), x,[y,z]) sage: T.transform(x=z,y=1) (z + 1, z - 1, z) """ return tuple(t.subs(**kwds) for t in self.custom_trans) class Spherical(_Coordinates): | def gen_transform(self, f=None, u=None, v=None): """ EXAMPLE:: |
- the *radial distance* (``r``), - the *elevation angle* (``theta``), - and the *azimuth angle* (``phi``). | - the *radial distance* (``radius``) from the origin - the *azimuth angle* (``azimuth``) from the positive `x`-axis - the *inclination angle* (``inclination``) from the positive `z`-axis | def gen_transform(self, f=None, u=None, v=None): """ EXAMPLE:: |
Construct a spherical transformation for a function ``r`` in terms of ``theta`` and ``phi``:: sage: T = Spherical('r', ['phi', 'theta']) If we construct some concrete variables, we can get a transformation:: | Construct a spherical transformation for a function for the radius in terms of the azimuth and inclination:: sage: T = Spherical('radius', ['azimuth', 'inclination']) If we construct some concrete variables, we can get a transformation in terms of those variables:: | def gen_transform(self, f=None, u=None, v=None): """ EXAMPLE:: |
sage: T.gen_transform(r=r, theta=theta, phi=phi) (r*sin(theta)*cos(phi), r*sin(phi)*sin(theta), r*cos(theta)) Use with plot3d on a made-up function:: sage: plot3d(phi * theta, (phi, 0, 1), (theta, 0, 1), transformation=T) To graph a function ``theta`` in terms of ``r`` and ``phi``, you would use:: sage: Spherical('... | sage: T.transform(radius=r, azimuth=theta, inclination=phi) (r*sin(phi)*cos(theta), r*sin(phi)*sin(theta), r*cos(phi)) We can plot with this transform. Remember that the independent variable is the radius, and the dependent variables are the azimuth and the inclination (in that order):: sage: plot3d(phi * theta, (th... | def gen_transform(self, f=None, u=None, v=None): """ EXAMPLE:: |
all_vars = ['r', 'theta', 'phi'] _name = 'Spherical coordinate system' def gen_transform(self, r=None, theta=None, phi=None): """ | def transform(self, radius=None, azimuth=None, inclination=None): """ A spherical coordinates transform. | def gen_transform(self, f=None, u=None, v=None): """ EXAMPLE:: |
sage: T = Spherical('r', ['theta', 'phi']) sage: T.gen_transform(r=var('r'), theta=var('theta'), phi=var('phi')) (r*sin(theta)*cos(phi), r*sin(phi)*sin(theta), r*cos(theta)) """ return (r * sin(theta) * cos(phi), r * sin(theta) * sin(phi), r * cos(theta)) class Cylindrical(_CoordTrans): | sage: T = Spherical('radius', ['azimuth', 'inclination']) sage: T.transform(radius=var('r'), azimuth=var('theta'), inclination=var('phi')) (r*sin(phi)*cos(theta), r*sin(phi)*sin(theta), r*cos(phi)) """ return (radius * sin(inclination) * cos(azimuth), radius * sin(inclination) * sin(azimuth), radius * cos(inclination))... | def gen_transform(self, r=None, theta=None, phi=None): """ EXAMPLE:: |
- the *radial distance* (``rho``), - the *angular position* or *azimuth* (``phi``), - and the *height* or *altitude* (``z``). | - the *radial distance* (``radius``) from the `z`-axis - the *azimuth angle* (``azimuth``) from the positive `x`-axis - the *height* or *altitude* (``height``) above the `xy`-plane | def gen_transform(self, r=None, theta=None, phi=None): """ EXAMPLE:: |
Construct a cylindrical transformation for a function ``rho`` in terms of ``phi`` and ``z``:: sage: T = Cylindrical('rho', ['phi', 'z']) | Construct a cylindrical transformation for a function for ``height`` in terms of ``radius`` and ``azimuth``:: sage: T = Cylindrical('height', ['radius', 'azimuth']) | def gen_transform(self, r=None, theta=None, phi=None): """ EXAMPLE:: |
sage: rho, phi, z = var('rho phi z') sage: T.gen_transform(rho=rho, phi=phi, z=z) (rho*cos(phi), rho*sin(phi), z) Use with plot3d on a made-up function:: sage: plot3d(phi * z, (phi, 0, 1), (z, 0, 1), transformation=T) To graph a function ``z`` in terms of ``phi`` and ``rho`` you would use:: sage: Cylindrical('z', [... | sage: r, theta, z = var('r theta z') sage: T.transform(radius=r, azimuth=theta, height=z) (r*cos(theta), r*sin(theta), z) We can plot with this transform. Remember that the independent variable is the height, and the dependent variables are the radius and the azimuth (in that order):: sage: plot3d(9-r^2, (r, 0, 3), ... | def gen_transform(self, r=None, theta=None, phi=None): """ EXAMPLE:: |
_name = 'Cylindrical coordinate system' all_vars = ['rho', 'phi', 'z'] def gen_transform(self, rho=None, phi=None, z=None): """ | def transform(self, radius=None, azimuth=None, height=None): """ A cylindrical coordinates transform. | def gen_transform(self, r=None, theta=None, phi=None): """ EXAMPLE:: |
""" | r""" | def selmer_group(self, S, m, proof=True): """ Compute the Selmer group `K(S,m)`, which is defined to be the subgroup of `K^\times/(K^\times)^m` consisting of elements `a` such that `K(\sqrt[m]{a})/K` is unramified at all primes of `K` lying above a place outside of `S`. |
out = copy.deepcopy(_pik.loads(self._check_types)) return out def check_ieee_macros(self, *a, **kw): if self._check_ieee_macros is None: out = check_ieee_macros(*a, **kw) self._check_ieee_macros = _pik.dumps(out) | body.append(" %s;" % func) body.append(" return 0;") body.append("}") body = '\n'.join(body) + "\n" return self.try_link(body, headers, include_dirs, libraries, library_dirs) def check_funcs_once(self, funcs, headers=None, include_dirs=None, libraries=None, library_dirs=None, decl=False, call=False, call_args=None)... | def check_types(self, *a, **kw): if self._check_types is None: out = check_types(*a, **kw) self._check_types = _pik.dumps(out) else: out = copy.deepcopy(_pik.loads(self._check_types)) return out |
out = copy.deepcopy(_pik.loads(self._check_ieee_macros)) return out def check_complex(self, *a, **kw): if self._check_complex is None: out = check_complex(*a, **kw) self._check_complex = _pik.dumps(out) else: out = copy.deepcopy(_pik.loads(self._check_complex)) return out PYTHON_HAS_UNICODE_WIDE = True def pythonlib... | for f in funcs: body.append(" %s;" % f) body.append(" return 0;") body.append("}") body = '\n'.join(body) + "\n" return self.try_link(body, headers, include_dirs, libraries, library_dirs) def check_inline(self): """Return the inline keyword recognized by the compiler, empty string otherwise.""" return check_inline(... | def check_ieee_macros(self, *a, **kw): if self._check_ieee_macros is None: out = check_ieee_macros(*a, **kw) self._check_ieee_macros = _pik.dumps(out) else: out = copy.deepcopy(_pik.loads(self._check_ieee_macros)) return out |
nosmp = os.environ['NPY_NOSMP'] nosmp = 1 except KeyError: nosmp = 0 return nosmp == 1 def win32_checks(deflist): from numpy.distutils.misc_util import get_build_architecture a = get_build_architecture() print('BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % \ (a, os.name, sys.platform)) if a == 'AMD64': defl... | src, obj, exe = self._link(body, headers, include_dirs, libraries, library_dirs, lang) exe = os.path.join('.', exe) exitstatus, output = exec_command(exe, execute_in='.') if hasattr(os, 'WEXITSTATUS'): exitcode = os.WEXITSTATUS(exitstatus) if os.WIFSIGNALED(exitstatus): sig = os.WTERMSIG(exitstatus) log.error('subproce... | def is_npy_no_smp(): """Return True if the NPY_NO_SMP symbol must be defined in public header (when SMP support cannot be reliably enabled).""" # Python 2.3 causes a segfault when # trying to re-acquire the thread-state # which is done in error-handling # ufunc code. NPY_ALLOW_C_API and friends # cause the segfaul... |
priv.extend([fname2def(f) for f in flist]) check_prec('') check_prec('f') check_prec('l') return priv, pub def check_ieee_macros(config): priv = [] pub = [] macros = [] def _add_decl(f): priv.append(fname2def("decl_%s" % f)) pub.append('NPY_%s' % fname2def("decl_%s" % f)) _macros = ["isnan", "isinf", "signbit... | exitcode = exitstatus log.info("success!") except (CompileError, LinkError): log.info("failure.") self._clean() return exitcode, output | def check_prec(prec): flist = [f + prec for f in C99_COMPLEX_FUNCS] decl = dict([(f, True) for f in flist]) if not config.check_funcs_once(flist, call=decl, decl=decl, libraries=mathlibs): for f in flist: if config.check_func(f, call=True, decl=True, libraries=mathlibs): priv.append(fname2def(f)) else: priv.extend([fna... |
sage: maxima.eval('sage0: x == x;') | sage: maxima._eval_line('sage0: x == x;') | def _eval_line(self, line, allow_use_file=False, wait_for_prompt=True, reformat=True, error_check=True): """ EXAMPLES: |
TypeError: error evaluating "sage0: x == x;":... | TypeError: Error executing code in Maxima... | def _eval_line(self, line, allow_use_file=False, wait_for_prompt=True, reformat=True, error_check=True): """ EXAMPLES: |
pre_out = self._before() self._expect_expr() out = self._before() | out = self._before() | def _eval_line(self, line, allow_use_file=False, wait_for_prompt=True, reformat=True, error_check=True): """ EXAMPLES: |
self._error_check(line, pre_out) | def _eval_line(self, line, allow_use_file=False, wait_for_prompt=True, reformat=True, error_check=True): """ EXAMPLES: | |
i = o.rfind('(%o') return o[:i] | def _eval_line(self, line, allow_use_file=False, wait_for_prompt=True, reformat=True, error_check=True): """ EXAMPLES: | |
for _ in range(3): | for _ in range(5): | def _command_runner(self, command, s, redirect=True): """ Run ``command`` in a new Maxima session and return its output as an ``AsciiArtString``. |
'5.20.1' | '5.22.1' | def version(self): """ Return the version of Maxima that Sage includes. |
sage: f = attrcall('core', 3) sage: loads(dumps(f)) | sage: f = attrcall('core', 3); f | def __init__(self, name, args, kwds): """ TESTS:: |
- ``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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
if order is Infinity: | if order == 1: if isinstance(w, (tuple,str,list)): length = 'finite' elif isinstance(w, FiniteWord_class): length = sum(self._morph[a].length() * b for (a,b) in w.evaluation_dict().iteritems()) elif hasattr(w, '__iter__'): length = Infinity datatype = 'iter' elif w in self._domain.alphabet(): return self._morph[w] els... | def __call__(self, w, order=1, datatype='iter'): r""" Returns the image of ``w`` under self to the given order. |
if not isinstance(order, (int,Integer)) or order < 0 : raise TypeError, "order (%s) must be a positive integer or plus Infinity" % order | elif isinstance(order, (int,Integer)) and order > 1: return self(self(w, order-1),datatype=datatype) | def __call__(self, w, order=1, datatype='iter'): r""" Returns the image of ``w`` under self to the given order. |
elif order == 1: if isinstance(w, (tuple,str,list)): length = 'finite' elif isinstance(w, FiniteWord_class): length = sum(self._morph[a].length() * b for (a,b) in w.evaluation_dict().iteritems()) elif hasattr(w, '__iter__'): length = Infinity datatype = 'iter' elif w in self._domain.alphabet(): w = [w] length = 'finit... | else: raise TypeError, "order (%s) must be a positive integer or plus Infinity" % order | def __call__(self, w, order=1, datatype='iter'): r""" Returns the image of ``w`` under self to the given order. |
image = self(letter) | image = self.image(letter) | def is_prolongable(self, letter): r""" Returns ``True`` if ``self`` is prolongable on ``letter``. |
return sage_eval(x, self.gens_dict()) | return self(sage_eval(x, self.gens_dict())) | def __call__(self, x, check=True): """ Convert ``x`` to an element of this multivariate polynomial ring, possibly non-canonically. |
.. warning:: This function calls a Singular function that appears to be very buggy and should not be trusted. | def riemann_roch_basis(self, D): r""" Return a basis for the Riemann-Roch space corresponding to `D`. | |
- ``sort`` - bool (default: True), if True return the point list sorted. If False, returns the points in the order computed by Singular. | - ``D`` - a divisor OUTPUT: A list of function field elements that form a basis of the Riemann-Roch space | def riemann_roch_basis(self, D): r""" Return a basis for the Riemann-Roch space corresponding to `D`. |
sage: D = C.divisor([ (4, pts[0]), (0,pts[1]), (4, pts[2]) ]) | sage: D = C.divisor([ (4, pts[0]), (4, pts[2]) ]) | def riemann_roch_basis(self, D): r""" Return a basis for the Riemann-Roch space corresponding to `D`. |
The following example illustrates that the Riemann-Roch space function in Singular doesn't *not* work correctly. | def riemann_roch_basis(self, D): r""" Return a basis for the Riemann-Roch space corresponding to `D`. | |
sage: C.riemann_roch_basis(D) [x/(y + x), (z + y)/(y + x)] The answer has dimension 2 (confirmed via Magma). But it varies between 1 and quite large with Singular. | sage: C.riemann_roch_basis(D) [(-2*x + y)/(x + y), (-x + z)/(x + y)] .. NOTE:: Currently this only works over prime field and divisors supported on rational points. | def riemann_roch_basis(self, D): r""" Return a basis for the Riemann-Roch space corresponding to `D`. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.