rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
subdivisions between each major tick | subdivisions between each major tick. | def ruler_frame(lower_left, upper_right, ticks=4, sub_ticks=4, **kwds): """ Draw a frame made of 3D rulers, with major and minor ticks. INPUT: - ``lower_left`` - the lower left corner of the frame, as a list, tuple, or vector - ``upper_right`` - the upper right corner of the frame, as a list, tuple, or vector - ``ticks`` - (default: 4) the number of major ticks shown on each ruler - ``sub_ticks`` - (default: 4) the number of shown subdivisions between each major tick Type ``line3d.options`` for a dictionary of the default options for lines which are also available. EXAMPLES: A ruler frame:: sage: from sage.plot.plot3d.shapes2 import ruler_frame sage: F = ruler_frame([1,2,3],vector([2,3,4])); F A ruler frame with some options:: sage: F = ruler_frame([1,2,3],vector([2,3,4]),ticks=6, sub_ticks=2, color='red'); F """ return ruler(lower_left, (upper_right[0], lower_left[1], lower_left[2]), ticks=ticks, sub_ticks=sub_ticks, absolute=True, **kwds) \ + ruler(lower_left, (lower_left[0], upper_right[1], lower_left[2]), ticks=ticks, sub_ticks=sub_ticks, absolute=True, **kwds) \ + ruler(lower_left, (lower_left[0], lower_left[1], upper_right[2]), ticks=ticks, sub_ticks=sub_ticks, absolute=True, **kwds) | a074a851cc2fcbb495453d24cda3b4b1c0b78eec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a074a851cc2fcbb495453d24cda3b4b1c0b78eec/shapes2.py |
options for lines which are also available. | options for lines, which are also available. | def ruler_frame(lower_left, upper_right, ticks=4, sub_ticks=4, **kwds): """ Draw a frame made of 3D rulers, with major and minor ticks. INPUT: - ``lower_left`` - the lower left corner of the frame, as a list, tuple, or vector - ``upper_right`` - the upper right corner of the frame, as a list, tuple, or vector - ``ticks`` - (default: 4) the number of major ticks shown on each ruler - ``sub_ticks`` - (default: 4) the number of shown subdivisions between each major tick Type ``line3d.options`` for a dictionary of the default options for lines which are also available. EXAMPLES: A ruler frame:: sage: from sage.plot.plot3d.shapes2 import ruler_frame sage: F = ruler_frame([1,2,3],vector([2,3,4])); F A ruler frame with some options:: sage: F = ruler_frame([1,2,3],vector([2,3,4]),ticks=6, sub_ticks=2, color='red'); F """ return ruler(lower_left, (upper_right[0], lower_left[1], lower_left[2]), ticks=ticks, sub_ticks=sub_ticks, absolute=True, **kwds) \ + ruler(lower_left, (lower_left[0], upper_right[1], lower_left[2]), ticks=ticks, sub_ticks=sub_ticks, absolute=True, **kwds) \ + ruler(lower_left, (lower_left[0], lower_left[1], upper_right[2]), ticks=ticks, sub_ticks=sub_ticks, absolute=True, **kwds) | a074a851cc2fcbb495453d24cda3b4b1c0b78eec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a074a851cc2fcbb495453d24cda3b4b1c0b78eec/shapes2.py |
We normally access this via the point3d function. Note that extra | We normally access this via the ``point3d`` function. Note that extra | def text3d(txt, (x,y,z), **kwds): r""" Display 3d text. INPUT: - ``txt`` - some text - ``(x,y,z)`` - position - ``**kwds`` - standard 3d graphics options .. note:: There is no way to change the font size or opacity yet. EXAMPLES: We write the word Sage in red at position (1,2,3):: sage: text3d("Sage", (1,2,3), color=(0.5,0,0)) We draw a multicolor spiral of numbers:: sage: sum([text3d('%.1f'%n, (cos(n),sin(n),n), color=(n/2,1-n/2,0)) \ for n in [0,0.2,..,8]]) Another example :: sage: text3d("Sage is really neat!!",(2,12,1)) And in 3d in two places:: sage: text3d("Sage is...",(2,12,1), rgbcolor=(1,0,0)) + text3d("quite powerful!!",(4,10,0), rgbcolor=(0,0,1)) """ if not kwds.has_key('color') and not kwds.has_key('rgbcolor'): kwds['color'] = (0,0,0) G = Text(txt, **kwds).translate((x,y,z)) G._set_extra_kwds(kwds) return G | a074a851cc2fcbb495453d24cda3b4b1c0b78eec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a074a851cc2fcbb495453d24cda3b4b1c0b78eec/shapes2.py |
def text3d(txt, (x,y,z), **kwds): r""" Display 3d text. INPUT: - ``txt`` - some text - ``(x,y,z)`` - position - ``**kwds`` - standard 3d graphics options .. note:: There is no way to change the font size or opacity yet. EXAMPLES: We write the word Sage in red at position (1,2,3):: sage: text3d("Sage", (1,2,3), color=(0.5,0,0)) We draw a multicolor spiral of numbers:: sage: sum([text3d('%.1f'%n, (cos(n),sin(n),n), color=(n/2,1-n/2,0)) \ for n in [0,0.2,..,8]]) Another example :: sage: text3d("Sage is really neat!!",(2,12,1)) And in 3d in two places:: sage: text3d("Sage is...",(2,12,1), rgbcolor=(1,0,0)) + text3d("quite powerful!!",(4,10,0), rgbcolor=(0,0,1)) """ if not kwds.has_key('color') and not kwds.has_key('rgbcolor'): kwds['color'] = (0,0,0) G = Text(txt, **kwds).translate((x,y,z)) G._set_extra_kwds(kwds) return G | a074a851cc2fcbb495453d24cda3b4b1c0b78eec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a074a851cc2fcbb495453d24cda3b4b1c0b78eec/shapes2.py |
||
Create the graphics primitive :class:`Point` in 3D. See the | Create the graphics primitive :class:`Point` in 3-D. See the | def __init__(self, center, size=1, **kwds): """ Create the graphics primitive :class:`Point` in 3D. See the docstring of this class for full documentation. | a074a851cc2fcbb495453d24cda3b4b1c0b78eec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a074a851cc2fcbb495453d24cda3b4b1c0b78eec/shapes2.py |
Returns the lower and upper corners of a 3D bounding box for self. This is used for rendering and self should fit entirely within this | Returns the lower and upper corners of a 3-D bounding box for ``self``. This is used for rendering and ``self`` should fit entirely within this | def bounding_box(self): """ Returns the lower and upper corners of a 3D bounding box for self. This is used for rendering and self should fit entirely within this box. In this case, we simply return the center of the point. | a074a851cc2fcbb495453d24cda3b4b1c0b78eec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a074a851cc2fcbb495453d24cda3b4b1c0b78eec/shapes2.py |
using Tachyon ray tracer. | using the Tachyon ray tracer. | def tachyon_repr(self, render_params): """ Returns representation of the point suitable for plotting using Tachyon ray tracer. | a074a851cc2fcbb495453d24cda3b4b1c0b78eec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a074a851cc2fcbb495453d24cda3b4b1c0b78eec/shapes2.py |
Create the graphics primitive :class:`Line` in 3D. See the | Create the graphics primitive :class:`Line` in 3-D. See the | def __init__(self, points, thickness=5, corner_cutoff=.5, arrow_head=False, **kwds): """ Create the graphics primitive :class:`Line` in 3D. See the docstring of this class for full documentation. | a074a851cc2fcbb495453d24cda3b4b1c0b78eec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a074a851cc2fcbb495453d24cda3b4b1c0b78eec/shapes2.py |
Returns the lower and upper corners of a 3D bounding box for self. This is used for rendering and self should fit entirely within this | Returns the lower and upper corners of a 3-D bounding box for ``self``. This is used for rendering and ``self`` should fit entirely within this | def bounding_box(self): """ Returns the lower and upper corners of a 3D bounding box for self. This is used for rendering and self should fit entirely within this box. In this case, we return the highest and lowest values of each coordinate among all points. | a074a851cc2fcbb495453d24cda3b4b1c0b78eec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a074a851cc2fcbb495453d24cda3b4b1c0b78eec/shapes2.py |
using Tachyon ray tracer. | using the Tachyon ray tracer. | def tachyon_repr(self, render_params): """ Returns representation of the line suitable for plotting using Tachyon ray tracer. | a074a851cc2fcbb495453d24cda3b4b1c0b78eec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a074a851cc2fcbb495453d24cda3b4b1c0b78eec/shapes2.py |
def eval(self, command, **kwds): | def eval(self, command, *args, **kwds): | def eval(self, command, **kwds): """ Evaluates commands. | 759d82bd836a3998cbe48401d578c556633033f4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/759d82bd836a3998cbe48401d578c556633033f4/scilab.py |
'scilab-5.0...' | 'scilab-...' | def version(self): """ Returns the version of the Scilab software used. | 759d82bd836a3998cbe48401d578c556633033f4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/759d82bd836a3998cbe48401d578c556633033f4/scilab.py |
return QuotientRingElement(self.parent(), self.__rep + right.__rep) | return self.parent()(self.__rep + right.__rep) | def _add_(self, right): """ Add quotient ring element ``self`` to another quotient ring element, ``right``. If the quotient is `R/I`, the addition is carried out in `R` and then reduced to `R/I`. | 93452cacca64d6eff31f7868adc68d5c9f4369a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/93452cacca64d6eff31f7868adc68d5c9f4369a4/quotient_ring_element.py |
return QuotientRingElement(self.parent(), self.__rep - right.__rep) | return self.parent()(self.__rep - right.__rep) | def _sub_(self, right): """ Subtract quotient ring element ``right`` from quotient ring element ``self``. If the quotient is `R/I`, the subtraction is carried out in `R` and then reduced to `R/I`. | 93452cacca64d6eff31f7868adc68d5c9f4369a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/93452cacca64d6eff31f7868adc68d5c9f4369a4/quotient_ring_element.py |
return QuotientRingElement(self.parent(), self.__rep * right.__rep) | return self.parent()(self.__rep * right.__rep) | def _mul_(self, right): """ Multiply quotient ring element ``self`` by another quotient ring element, ``right``. If the quotient is `R/I`, the multiplication is carried out in `R` and then reduced to `R/I`. | 93452cacca64d6eff31f7868adc68d5c9f4369a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/93452cacca64d6eff31f7868adc68d5c9f4369a4/quotient_ring_element.py |
return QuotientRingElement(self.parent(), -self.__rep) | return self.parent()(-self.__rep) | def __neg__(self): """ EXAMPLES:: | 93452cacca64d6eff31f7868adc68d5c9f4369a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/93452cacca64d6eff31f7868adc68d5c9f4369a4/quotient_ring_element.py |
return QuotientRingElement(self.parent(), inv) | return self.parent()(inv) | def __invert__(self): """ EXAMPLES:: | 93452cacca64d6eff31f7868adc68d5c9f4369a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/93452cacca64d6eff31f7868adc68d5c9f4369a4/quotient_ring_element.py |
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. | 93452cacca64d6eff31f7868adc68d5c9f4369a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/93452cacca64d6eff31f7868adc68d5c9f4369a4/quotient_ring_element.py |
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. | 93452cacca64d6eff31f7868adc68d5c9f4369a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/93452cacca64d6eff31f7868adc68d5c9f4369a4/quotient_ring_element.py |
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:: | 93452cacca64d6eff31f7868adc68d5c9f4369a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/93452cacca64d6eff31f7868adc68d5c9f4369a4/quotient_ring_element.py |
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:: | 93452cacca64d6eff31f7868adc68d5c9f4369a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/93452cacca64d6eff31f7868adc68d5c9f4369a4/quotient_ring_element.py |
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``. | 93452cacca64d6eff31f7868adc68d5c9f4369a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/93452cacca64d6eff31f7868adc68d5c9f4369a4/quotient_ring_element.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)) | e24dd3c62ad1f440792ccb94718bf5873e280f2a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e24dd3c62ad1f440792ccb94718bf5873e280f2a/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)) | e24dd3c62ad1f440792ccb94718bf5873e280f2a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e24dd3c62ad1f440792ccb94718bf5873e280f2a/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)) | e24dd3c62ad1f440792ccb94718bf5873e280f2a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e24dd3c62ad1f440792ccb94718bf5873e280f2a/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. | e24dd3c62ad1f440792ccb94718bf5873e280f2a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e24dd3c62ad1f440792ccb94718bf5873e280f2a/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. | e24dd3c62ad1f440792ccb94718bf5873e280f2a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e24dd3c62ad1f440792ccb94718bf5873e280f2a/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. | e24dd3c62ad1f440792ccb94718bf5873e280f2a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e24dd3c62ad1f440792ccb94718bf5873e280f2a/arc.py |
String representation of Arc primitive. | String representation of ``Arc`` primitive. | def _repr_(self): """ String representation of Arc primitive. | e24dd3c62ad1f440792ccb94718bf5873e280f2a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e24dd3c62ad1f440792ccb94718bf5873e280f2a/arc.py |
TESTS: | TESTS:: | def plot3d(self): r""" TESTS: | e24dd3c62ad1f440792ccb94718bf5873e280f2a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e24dd3c62ad1f440792ccb94718bf5873e280f2a/arc.py |
K = NumberField_quadratic(polynomial, name, check, embedding, latex_name=latex_name) | K = NumberField_quadratic(polynomial, name, latex_name, check, embedding) | def NumberField(polynomial, name=None, check=True, names=None, cache=True, embedding=None, latex_name=None): r""" Return *the* number field defined by the given irreducible polynomial and with variable with the given name. If check is True (the default), also verify that the defining polynomial is irreducible and over `\QQ`. INPUT: - ``polynomial`` - a polynomial over `\QQ` or a number field, or a list of polynomials. - ``name`` - a string (default: 'a'), the name of the generator - ``check`` - bool (default: True); do type checking and irreducibility checking. - ``embedding`` - image of the generator in an ambient field (default: None) EXAMPLES:: sage: z = QQ['z'].0 sage: K = NumberField(z^2 - 2,'s'); K Number Field in s with defining polynomial z^2 - 2 sage: s = K.0; s s sage: s*s 2 sage: s^2 2 Constructing a relative number field:: sage: K.<a> = NumberField(x^2 - 2) sage: R.<t> = K[] sage: L.<b> = K.extension(t^3+t+a); L Number Field in b with defining polynomial t^3 + t + a over its base field sage: L.absolute_field('c') Number Field in c with defining polynomial x^6 + 2*x^4 + x^2 - 2 sage: a*b a*b sage: L(a) a sage: L.lift_to_base(b^3 + b) -a Constructing another number field:: sage: k.<i> = NumberField(x^2 + 1) sage: R.<z> = k[] sage: m.<j> = NumberField(z^3 + i*z + 3) sage: m Number Field in j with defining polynomial z^3 + i*z + 3 over its base field Number fields are globally unique:: sage: K.<a>= NumberField(x^3-5) sage: a^3 5 sage: L.<a>= NumberField(x^3-5) sage: K is L True Having different defining polynomials makes the fields different:: sage: x = polygen(QQ, 'x'); y = polygen(QQ, 'y') sage: k.<a> = NumberField(x^2 + 3) sage: m.<a> = NumberField(y^2 + 3) sage: k Number Field in a with defining polynomial x^2 + 3 sage: m Number Field in a with defining polynomial y^2 + 3 One can also define number fields with specified embeddings, may be used for arithmetic and deduce relations with other number fields which would not be valid for an abstract number field:: sage: K.<a> = NumberField(x^3-2, embedding=1.2) sage: RR.coerce_map_from(K) Composite map: From: Number Field in a with defining polynomial x^3 - 2 To: Real Field with 53 bits of precision Defn: Generic morphism: From: Number Field in a with defining polynomial x^3 - 2 To: Real Lazy Field Defn: a -> 1.259921049894873? then Conversion via _mpfr_ method map: From: Real Lazy Field To: Real Field with 53 bits of precision sage: RR(a) 1.25992104989487 sage: 1.1 + a 2.35992104989487 sage: b = 1/(a+1); b 1/3*a^2 - 1/3*a + 1/3 sage: RR(b) 0.442493334024442 sage: L.<b> = NumberField(x^6-2, embedding=1.1) sage: L(a) b^2 sage: a + b b^2 + b Note that the image only needs to be specified to enough precision to distinguish roots, and is exactly computed to any needed precision:: sage: RealField(200)(a) 1.2599210498948731647672106072782283505702514647015079800820 One can embed into any other field:: sage: K.<a> = NumberField(x^3-2, embedding=CC.gen()-0.6) sage: CC(a) -0.629960524947436 + 1.09112363597172*I sage: L = Qp(5) sage: f = polygen(L)^3 - 2 sage: K.<a> = NumberField(x^3-2, embedding=f.roots()[0][0]) sage: a + L(1) 4 + 2*5^2 + 2*5^3 + 3*5^4 + 5^5 + 4*5^6 + 2*5^8 + 3*5^9 + 4*5^12 + 4*5^14 + 4*5^15 + 3*5^16 + 5^17 + 5^18 + 2*5^19 + O(5^20) sage: L.<b> = NumberField(x^6-x^2+1/10, embedding=1) sage: K.<a> = NumberField(x^3-x+1/10, embedding=b^2) sage: a+b b^2 + b sage: CC(a) == CC(b)^2 True sage: K.coerce_embedding() Generic morphism: From: Number Field in a with defining polynomial x^3 - x + 1/10 To: Number Field in b with defining polynomial x^6 - x^2 + 1/10 Defn: a -> b^2 The ``QuadraticField`` and ``CyclotomicField`` constructors create an embedding by default unless otherwise specified. :: sage: K.<zeta> = CyclotomicField(15) sage: CC(zeta) 0.913545457642601 + 0.406736643075800*I sage: L.<sqrtn3> = QuadraticField(-3) sage: K(sqrtn3) 2*zeta^5 + 1 sage: sqrtn3 + zeta 2*zeta^5 + zeta + 1 An example involving a variable name that defines a function in PARI:: sage: theta = polygen(QQ, 'theta') sage: M.<z> = NumberField([theta^3 + 4, theta^2 + 3]); M Number Field in z0 with defining polynomial theta^3 + 4 over its base field TESTS:: sage: x = QQ['x'].gen() sage: y = ZZ['y'].gen() sage: K = NumberField(x^3 + x + 3, 'a'); K Number Field in a with defining polynomial x^3 + x + 3 sage: K.defining_polynomial().parent() Univariate Polynomial Ring in x over Rational Field :: sage: L = NumberField(y^3 + y + 3, 'a'); L Number Field in a with defining polynomial y^3 + y + 3 sage: L.defining_polynomial().parent() Univariate Polynomial Ring in y over Rational Field :: sage: sage.rings.number_field.number_field._nf_cache = {} sage: K.<x> = CyclotomicField(5)[] sage: W.<a> = NumberField(x^2 + 1); W Number Field in a with defining polynomial x^2 + 1 over its base field sage: sage.rings.number_field.number_field._nf_cache = {} sage: W1 = NumberField(x^2+1,'a') sage: K.<x> = CyclotomicField(5)[] sage: W.<a> = NumberField(x^2 + 1); W Number Field in a with defining polynomial x^2 + 1 over its base field """ if name is None and names is None: raise TypeError, "You must specify the name of the generator." if not names is None: name = names if isinstance(polynomial, (list, tuple)): return NumberFieldTower(polynomial, name) name = sage.structure.parent_gens.normalize_names(1, name) if not isinstance(polynomial, polynomial_element.Polynomial): try: polynomial = polynomial.polynomial(QQ) except (AttributeError, TypeError): raise TypeError, "polynomial (=%s) must be a polynomial."%repr(polynomial) # convert ZZ to QQ R = polynomial.base_ring() Q = polynomial.parent().base_extend(R.fraction_field()) polynomial = Q(polynomial) if cache: key = (polynomial, polynomial.base_ring(), name, embedding, embedding.parent() if embedding is not None else None) if _nf_cache.has_key(key): K = _nf_cache[key]() if not K is None: return K if isinstance(R, NumberField_generic): S = R.extension(polynomial, name, check=check) if cache: _nf_cache[key] = weakref.ref(S) return S if polynomial.degree() == 2: K = NumberField_quadratic(polynomial, name, check, embedding, latex_name=latex_name) else: K = NumberField_absolute(polynomial, name, None, check, embedding, latex_name=latex_name) if cache: _nf_cache[key] = weakref.ref(K) return K | a1a9ef727e26796ae9f7e10297c4e3fe3ebf2d52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a1a9ef727e26796ae9f7e10297c4e3fe3ebf2d52/number_field.py |
K = NumberField_absolute(polynomial, name, None, check, embedding, latex_name=latex_name) | K = NumberField_absolute(polynomial, name, latex_name, check, embedding) | def NumberField(polynomial, name=None, check=True, names=None, cache=True, embedding=None, latex_name=None): r""" Return *the* number field defined by the given irreducible polynomial and with variable with the given name. If check is True (the default), also verify that the defining polynomial is irreducible and over `\QQ`. INPUT: - ``polynomial`` - a polynomial over `\QQ` or a number field, or a list of polynomials. - ``name`` - a string (default: 'a'), the name of the generator - ``check`` - bool (default: True); do type checking and irreducibility checking. - ``embedding`` - image of the generator in an ambient field (default: None) EXAMPLES:: sage: z = QQ['z'].0 sage: K = NumberField(z^2 - 2,'s'); K Number Field in s with defining polynomial z^2 - 2 sage: s = K.0; s s sage: s*s 2 sage: s^2 2 Constructing a relative number field:: sage: K.<a> = NumberField(x^2 - 2) sage: R.<t> = K[] sage: L.<b> = K.extension(t^3+t+a); L Number Field in b with defining polynomial t^3 + t + a over its base field sage: L.absolute_field('c') Number Field in c with defining polynomial x^6 + 2*x^4 + x^2 - 2 sage: a*b a*b sage: L(a) a sage: L.lift_to_base(b^3 + b) -a Constructing another number field:: sage: k.<i> = NumberField(x^2 + 1) sage: R.<z> = k[] sage: m.<j> = NumberField(z^3 + i*z + 3) sage: m Number Field in j with defining polynomial z^3 + i*z + 3 over its base field Number fields are globally unique:: sage: K.<a>= NumberField(x^3-5) sage: a^3 5 sage: L.<a>= NumberField(x^3-5) sage: K is L True Having different defining polynomials makes the fields different:: sage: x = polygen(QQ, 'x'); y = polygen(QQ, 'y') sage: k.<a> = NumberField(x^2 + 3) sage: m.<a> = NumberField(y^2 + 3) sage: k Number Field in a with defining polynomial x^2 + 3 sage: m Number Field in a with defining polynomial y^2 + 3 One can also define number fields with specified embeddings, may be used for arithmetic and deduce relations with other number fields which would not be valid for an abstract number field:: sage: K.<a> = NumberField(x^3-2, embedding=1.2) sage: RR.coerce_map_from(K) Composite map: From: Number Field in a with defining polynomial x^3 - 2 To: Real Field with 53 bits of precision Defn: Generic morphism: From: Number Field in a with defining polynomial x^3 - 2 To: Real Lazy Field Defn: a -> 1.259921049894873? then Conversion via _mpfr_ method map: From: Real Lazy Field To: Real Field with 53 bits of precision sage: RR(a) 1.25992104989487 sage: 1.1 + a 2.35992104989487 sage: b = 1/(a+1); b 1/3*a^2 - 1/3*a + 1/3 sage: RR(b) 0.442493334024442 sage: L.<b> = NumberField(x^6-2, embedding=1.1) sage: L(a) b^2 sage: a + b b^2 + b Note that the image only needs to be specified to enough precision to distinguish roots, and is exactly computed to any needed precision:: sage: RealField(200)(a) 1.2599210498948731647672106072782283505702514647015079800820 One can embed into any other field:: sage: K.<a> = NumberField(x^3-2, embedding=CC.gen()-0.6) sage: CC(a) -0.629960524947436 + 1.09112363597172*I sage: L = Qp(5) sage: f = polygen(L)^3 - 2 sage: K.<a> = NumberField(x^3-2, embedding=f.roots()[0][0]) sage: a + L(1) 4 + 2*5^2 + 2*5^3 + 3*5^4 + 5^5 + 4*5^6 + 2*5^8 + 3*5^9 + 4*5^12 + 4*5^14 + 4*5^15 + 3*5^16 + 5^17 + 5^18 + 2*5^19 + O(5^20) sage: L.<b> = NumberField(x^6-x^2+1/10, embedding=1) sage: K.<a> = NumberField(x^3-x+1/10, embedding=b^2) sage: a+b b^2 + b sage: CC(a) == CC(b)^2 True sage: K.coerce_embedding() Generic morphism: From: Number Field in a with defining polynomial x^3 - x + 1/10 To: Number Field in b with defining polynomial x^6 - x^2 + 1/10 Defn: a -> b^2 The ``QuadraticField`` and ``CyclotomicField`` constructors create an embedding by default unless otherwise specified. :: sage: K.<zeta> = CyclotomicField(15) sage: CC(zeta) 0.913545457642601 + 0.406736643075800*I sage: L.<sqrtn3> = QuadraticField(-3) sage: K(sqrtn3) 2*zeta^5 + 1 sage: sqrtn3 + zeta 2*zeta^5 + zeta + 1 An example involving a variable name that defines a function in PARI:: sage: theta = polygen(QQ, 'theta') sage: M.<z> = NumberField([theta^3 + 4, theta^2 + 3]); M Number Field in z0 with defining polynomial theta^3 + 4 over its base field TESTS:: sage: x = QQ['x'].gen() sage: y = ZZ['y'].gen() sage: K = NumberField(x^3 + x + 3, 'a'); K Number Field in a with defining polynomial x^3 + x + 3 sage: K.defining_polynomial().parent() Univariate Polynomial Ring in x over Rational Field :: sage: L = NumberField(y^3 + y + 3, 'a'); L Number Field in a with defining polynomial y^3 + y + 3 sage: L.defining_polynomial().parent() Univariate Polynomial Ring in y over Rational Field :: sage: sage.rings.number_field.number_field._nf_cache = {} sage: K.<x> = CyclotomicField(5)[] sage: W.<a> = NumberField(x^2 + 1); W Number Field in a with defining polynomial x^2 + 1 over its base field sage: sage.rings.number_field.number_field._nf_cache = {} sage: W1 = NumberField(x^2+1,'a') sage: K.<x> = CyclotomicField(5)[] sage: W.<a> = NumberField(x^2 + 1); W Number Field in a with defining polynomial x^2 + 1 over its base field """ if name is None and names is None: raise TypeError, "You must specify the name of the generator." if not names is None: name = names if isinstance(polynomial, (list, tuple)): return NumberFieldTower(polynomial, name) name = sage.structure.parent_gens.normalize_names(1, name) if not isinstance(polynomial, polynomial_element.Polynomial): try: polynomial = polynomial.polynomial(QQ) except (AttributeError, TypeError): raise TypeError, "polynomial (=%s) must be a polynomial."%repr(polynomial) # convert ZZ to QQ R = polynomial.base_ring() Q = polynomial.parent().base_extend(R.fraction_field()) polynomial = Q(polynomial) if cache: key = (polynomial, polynomial.base_ring(), name, embedding, embedding.parent() if embedding is not None else None) if _nf_cache.has_key(key): K = _nf_cache[key]() if not K is None: return K if isinstance(R, NumberField_generic): S = R.extension(polynomial, name, check=check) if cache: _nf_cache[key] = weakref.ref(S) return S if polynomial.degree() == 2: K = NumberField_quadratic(polynomial, name, check, embedding, latex_name=latex_name) else: K = NumberField_absolute(polynomial, name, None, check, embedding, latex_name=latex_name) if cache: _nf_cache[key] = weakref.ref(K) return K | a1a9ef727e26796ae9f7e10297c4e3fe3ebf2d52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a1a9ef727e26796ae9f7e10297c4e3fe3ebf2d52/number_field.py |
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. | a1a9ef727e26796ae9f7e10297c4e3fe3ebf2d52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a1a9ef727e26796ae9f7e10297c4e3fe3ebf2d52/number_field.py |
.. rubric:: Migrating classes to :class:`UniqueRepresentation` and unpickling | .. rubric:: Migrating classes to ``UniqueRepresentation`` and unpickling | ... def __reduce__(self): | 40b7037430906f99415b2668f003fe73181847fd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/40b7037430906f99415b2668f003fe73181847fd/unique_representation.py |
nr_common = len(reduce(sets.Set.intersection, \ [sets.Set(c1[r]), sets.Set(c2[c]), sets.Set(c3[s])])) | nr_common = len(reduce(set.intersection, \ [set(c1[r]), set(c2[c]), set(c3[s])])) | def tau_to_bitrade(t1, t2, t3): """ Given permutations t1, t2, t3 that represent a latin bitrade, convert them to an explicit latin bitrade (T1, T2). The result is unique up to isotopism. EXAMPLE:: sage: from sage.combinat.matrices.latin import * sage: T1 = back_circulant(5) sage: x = isotopism( (0,1,2,3,4) ) sage: y = isotopism(5) # identity sage: z = isotopism(5) # identity sage: T2 = T1.apply_isotopism(x, y, z) sage: _, t1, t2, t3 = tau123(T1, T2) sage: U1, U2 = tau_to_bitrade(t1, t2, t3) sage: assert is_bitrade(U1, U2) sage: U1 [0 1 2 3 4] [1 2 3 4 0] [2 3 4 0 1] [3 4 0 1 2] [4 0 1 2 3] sage: U2 [4 0 1 2 3] [0 1 2 3 4] [1 2 3 4 0] [2 3 4 0 1] [3 4 0 1 2] """ c1 = t1.to_cycles() c2 = t2.to_cycles() c3 = t3.to_cycles() pt_to_cycle1 = {} pt_to_cycle2 = {} pt_to_cycle3 = {} for i in range(len(c1)): for j in range(len(c1[i])): pt_to_cycle1[c1[i][j]] = i for i in range(len(c2)): for j in range(len(c2[i])): pt_to_cycle2[c2[i][j]] = i for i in range(len(c3)): for j in range(len(c3[i])): pt_to_cycle3[c3[i][j]] = i n = max(len(c1), len(c2), len(c3)) T1 = LatinSquare(n) T2 = LatinSquare(n) for r in range(len(c1)): for c in range(len(c2)): for s in range(len(c3)): nr_common = len(reduce(sets.Set.intersection, \ [sets.Set(c1[r]), sets.Set(c2[c]), sets.Set(c3[s])])) assert nr_common in [0, 1] if nr_common == 1: T1[r, c] = s for cycle in c1: for pt1 in cycle: pt2 = t1[pt1 - 1] pt3 = t2[pt2 - 1] assert t3[pt3 - 1] == pt1 r = pt_to_cycle1[pt1] c = pt_to_cycle2[pt2] s = pt_to_cycle3[pt3] T2[r, c] = s return T1, T2 | cdbfddc2038b267cb2226dc1cde7059676ecb7ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/cdbfddc2038b267cb2226dc1cde7059676ecb7ea/latin.py |
val1 = sets.Set(filter(lambda x: x >= 0, T1.row(r))) val2 = sets.Set(filter(lambda x: x >= 0, T2.row(r))) | val1 = set(filter(lambda x: x >= 0, T1.row(r))) val2 = set(filter(lambda x: x >= 0, T2.row(r))) | def is_row_and_col_balanced(T1, T2): """ Partial latin squares T1 and T2 are balanced if the symbols appearing in row r of T1 are the same as the symbols appearing in row r of T2, for each r, and if the same condition holds on columns. EXAMPLES:: sage: from sage.combinat.matrices.latin import * sage: T1 = matrix([[0,1,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1]]) sage: T2 = matrix([[0,1,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1]]) sage: is_row_and_col_balanced(T1, T2) True sage: T2 = matrix([[0,3,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1]]) sage: is_row_and_col_balanced(T1, T2) False """ for r in range(T1.nrows()): val1 = sets.Set(filter(lambda x: x >= 0, T1.row(r))) val2 = sets.Set(filter(lambda x: x >= 0, T2.row(r))) if val1 != val2: return False for c in range(T1.ncols()): val1 = sets.Set(filter(lambda x: x >= 0, T1.column(c))) val2 = sets.Set(filter(lambda x: x >= 0, T2.column(c))) if val1 != val2: return False return True | cdbfddc2038b267cb2226dc1cde7059676ecb7ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/cdbfddc2038b267cb2226dc1cde7059676ecb7ea/latin.py |
val1 = sets.Set(filter(lambda x: x >= 0, T1.column(c))) val2 = sets.Set(filter(lambda x: x >= 0, T2.column(c))) | val1 = set(filter(lambda x: x >= 0, T1.column(c))) val2 = set(filter(lambda x: x >= 0, T2.column(c))) | def is_row_and_col_balanced(T1, T2): """ Partial latin squares T1 and T2 are balanced if the symbols appearing in row r of T1 are the same as the symbols appearing in row r of T2, for each r, and if the same condition holds on columns. EXAMPLES:: sage: from sage.combinat.matrices.latin import * sage: T1 = matrix([[0,1,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1]]) sage: T2 = matrix([[0,1,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1]]) sage: is_row_and_col_balanced(T1, T2) True sage: T2 = matrix([[0,3,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1], [-1,-1,-1,-1]]) sage: is_row_and_col_balanced(T1, T2) False """ for r in range(T1.nrows()): val1 = sets.Set(filter(lambda x: x >= 0, T1.row(r))) val2 = sets.Set(filter(lambda x: x >= 0, T2.row(r))) if val1 != val2: return False for c in range(T1.ncols()): val1 = sets.Set(filter(lambda x: x >= 0, T1.column(c))) val2 = sets.Set(filter(lambda x: x >= 0, T2.column(c))) if val1 != val2: return False return True | cdbfddc2038b267cb2226dc1cde7059676ecb7ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/cdbfddc2038b267cb2226dc1cde7059676ecb7ea/latin.py |
sage: phi,theta=var('phi theta') sage: Y=spherical_harmonic(2,1,theta,phi) sage: rea=spherical_plot3d(abs(real(Y)),(phi,0,2*pi),(theta,0,pi),color='blue',opacity=0.6) sage: ima=spherical_plot3d(abs(imag(Y)),(phi,0,2*pi),(theta,0,pi),color='red' ,opacity=0.6) sage: (rea+ima).show(aspect_ratio=1) | sage: phi, theta = var('phi, theta') sage: Y = spherical_harmonic(2, 1, theta, phi) sage: rea = spherical_plot3d(abs(real(Y)), (phi,0,2*pi), (theta,0,pi), color='blue', opacity=0.6) sage: ima = spherical_plot3d(abs(imag(Y)), (phi,0,2*pi), (theta,0,pi), color='red', opacity=0.6) sage: (rea + ima).show(aspect_ratio=1) | def spherical_plot3d(f, urange, vrange, **kwds): """ Plots a function in spherical coordinates. This function is equivalent to:: sage: r,u,v=var('r,u,v') sage: f=u*v; urange=(u,0,pi); vrange=(v,0,pi) sage: T = (r*cos(u)*sin(v), r*sin(u)*sin(v), r*cos(v), [u,v]) sage: plot3d(f, urange, vrange, transformation=T) or equivalently:: sage: T = Spherical('radius', ['azimuth', 'inclination']) sage: f=lambda u,v: u*v; urange=(u,0,pi); vrange=(v,0,pi) sage: plot3d(f, urange, vrange, transformation=T) INPUT: - ``f`` - a symbolic expression or function of two variables. - ``urange`` - a 3-tuple (u, u_min, u_max), the domain of the azimuth variable. - ``vrange`` - a 3-tuple (v, v_min, v_max), the domain of the inclination variable. EXAMPLES: A sphere of radius 2:: sage: x,y=var('x,y') sage: spherical_plot3d(2,(x,0,2*pi),(y,0,pi)) The real and imaginary parts of a spherical harmonic with `l=2` and `m=1`:: sage: phi,theta=var('phi theta') sage: Y=spherical_harmonic(2,1,theta,phi) sage: rea=spherical_plot3d(abs(real(Y)),(phi,0,2*pi),(theta,0,pi),color='blue',opacity=0.6) sage: ima=spherical_plot3d(abs(imag(Y)),(phi,0,2*pi),(theta,0,pi),color='red' ,opacity=0.6) sage: (rea+ima).show(aspect_ratio=1) A drop of water:: sage: x,y=var('x,y') sage: spherical_plot3d(e^-y,(x,0,2*pi),(y,0,pi),opacity=0.5).show(frame=False) An object similar to a heart:: sage: x,y=var('x,y') sage: spherical_plot3d((2+cos(2*x))*(y+1),(x,0,2*pi),(y,0,pi),rgbcolor=(1,.1,.1)) Some random figures: :: sage: x,y=var('x,y') sage: spherical_plot3d(1+sin(5*x)/5,(x,0,2*pi),(y,0,pi),rgbcolor=(1,0.5,0),plot_points=(80,80),opacity=0.7) :: sage: x,y=var('x,y') sage: spherical_plot3d(1+2*cos(2*y),(x,0,3*pi/2),(y,0,pi)).show(aspect_ratio=(1,1,1)) """ return plot3d(f, urange, vrange, transformation=Spherical('radius', ['azimuth', 'inclination']), **kwds) | 3be4b8efddefbb3d0b528075713e9a22536e08cb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3be4b8efddefbb3d0b528075713e9a22536e08cb/plot3d.py |
... __metaclass__ = sage.structure.unique_representation.ClasscallMetaclass | ... __metaclass__ = ClasscallMetaclass | def __call__(cls, *args, **options): """ This method implements ``cls(<some arguments>)``. | 86383ab943ecb3cae68844d31fbeffab377df242 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/86383ab943ecb3cae68844d31fbeffab377df242/classcall_metaclass.py |
... print "calling call_cls" | ... print "calling classcall" | ... def __classcall__(cls): | 86383ab943ecb3cae68844d31fbeffab377df242 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/86383ab943ecb3cae68844d31fbeffab377df242/classcall_metaclass.py |
calling call_cls | calling classcall | ... def __init__(self): | 86383ab943ecb3cae68844d31fbeffab377df242 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/86383ab943ecb3cae68844d31fbeffab377df242/classcall_metaclass.py |
try: | if '__classcall_private__' in cls.__dict__: return cls.__classcall_private__(cls, *args, **options) elif hasattr(cls, "__classcall__"): | ... def __init__(self): | 86383ab943ecb3cae68844d31fbeffab377df242 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/86383ab943ecb3cae68844d31fbeffab377df242/classcall_metaclass.py |
except AttributeError: | else: | ... def __init__(self): | 86383ab943ecb3cae68844d31fbeffab377df242 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/86383ab943ecb3cae68844d31fbeffab377df242/classcall_metaclass.py |
sage: P4 = simplicial_complexes.RealProjectiveSpace(4) sage: P4.f_vector() | sage: P4 = simplicial_complexes.RealProjectiveSpace(4) sage: P4.f_vector() | def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | 5d95ced8f0044b3d060e0809a34beccba8fa7a04 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/5d95ced8f0044b3d060e0809a34beccba8fa7a04/examples.py |
sage: P4.homology() | sage: P4.homology() | def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | 5d95ced8f0044b3d060e0809a34beccba8fa7a04 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/5d95ced8f0044b3d060e0809a34beccba8fa7a04/examples.py |
sage: P5.homology() | The following computation can take a long time -- over half an hour -- with Sage's default computation of homology groups, but if you have CHomP installed, Sage will use that and the computation should only take a second or two. (You can download CHomP from http://chomp.rutgers.edu/, or you can install it as a Sage package using "sage -i chomp"). :: sage: P5.homology() | def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | 5d95ced8f0044b3d060e0809a34beccba8fa7a04 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/5d95ced8f0044b3d060e0809a34beccba8fa7a04/examples.py |
sage: P4.dimension() | sage: P4.dimension() | def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | 5d95ced8f0044b3d060e0809a34beccba8fa7a04 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/5d95ced8f0044b3d060e0809a34beccba8fa7a04/examples.py |
from sage.rings.real_mpfr cimport RealField, RealNumber | from sage.rings.real_mpfr cimport RealField_class, RealNumber | cdef RealNumber result = domain(fn(*py_args)) | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
/* Automatically generated. Do not edit! */ ... | /* Automatically generated by ext/gen_interpreters.py. Do not edit! */ ... | def write_interpreter(self, write): r""" Generate the code for the C interpreter. | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
/* Automatically generated. Do not edit! */ | /* Automatically generated by ext/gen_interpreters.py. Do not edit! */ | def write_interpreter(self, write): r""" Generate the code for the C interpreter. | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
def write_wrapper(self, write): r""" Generate the code for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the wrapper. | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
||
def write_wrapper(self, write): r""" Generate the code for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the wrapper. | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
||
def write_pxd(self, write): r""" Generate the pxd file for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the pxd file. | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
||
def write_pxd(self, write): r""" Generate the pxd file for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the pxd file. | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
||
/* Automatically generated. Do not edit! */ | /* Automatically generated by ext/gen_interpreters.py. Do not edit! */ | def get_interpreter(self): r""" Returns the code for the C interpreter. | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
def get_wrapper(self): r""" Returns the code for the Cython wrapper. | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
||
def get_pxd(self): r""" Returns the code for the Cython .pxd file. | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
||
from sage.rings.real_mpfr cimport RealField, RealNumber | from sage.rings.real_mpfr cimport RealField_class, RealNumber | def get_pxd(self): r""" Returns the code for the Cython .pxd file. | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
'/* Automatically generated. Do not edit! */\n' | '/* Automatically generated by ext/gen_interpreters.py. Do not edit! */\n' | def build_interp(interp_spec, dir): r""" Given an InterpreterSpec, writes the C interpreter and the Cython wrapper (generates a pyx and a pxd file). EXAMPLES: sage: from sage.ext.gen_interpreters import * sage: testdir = tmp_filename() sage: os.mkdir(testdir) sage: rdf_interp = RDFInterpreter() sage: build_interp(rdf_interp, testdir) sage: open(testdir + '/interp_rdf.c').readline() '/* Automatically generated. Do not edit! */\n' """ ig = InterpreterGenerator(interp_spec) interp_fn = '%s/interp_%s.c' % (dir, interp_spec.name) wrapper_fn = '%s/wrapper_%s.pyx' % (dir, interp_spec.name) pxd_fn = '%s/wrapper_%s.pxd' % (dir, interp_spec.name) interp = ig.get_interpreter() wrapper = ig.get_wrapper() pxd = ig.get_pxd() write_if_changed(interp_fn, interp) write_if_changed(wrapper_fn, wrapper) write_if_changed(pxd_fn, pxd) | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
' | ' | def rebuild(dir): r""" Check whether the interpreter and wrapper sources have been written since the last time this module was changed. If not, write them. EXAMPLES: sage: from sage.ext.gen_interpreters import * sage: testdir = tmp_filename() sage: os.mkdir(testdir) sage: rebuild(testdir) Building interpreters for fast_callable sage: rebuild(testdir) sage: open(testdir + '/wrapper_el.pyx').readline() '# Automatically generated. Do not edit!\n' """ module_mtime = os.stat(__file__).st_mtime try: if os.stat(dir + '/timestamp').st_mtime > module_mtime: # No need to rebuild. return except OSError: pass # This line will show up in "sage -b" (once per upgrade, not every time # you run it). print "Building interpreters for fast_callable" interp = RDFInterpreter() build_interp(interp, dir) interp = CDFInterpreter() build_interp(interp, dir) interp = RRInterpreter() build_interp(interp, dir) interp = PythonInterpreter() build_interp(interp, dir) interp = ElementInterpreter() build_interp(interp, dir) # Do this last, so we don't do it if there's an error above. with open(dir + '/timestamp', 'w'): pass | 89c8332de5c914b500ffb00940fc8eebaae69cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/89c8332de5c914b500ffb00940fc8eebaae69cfa/gen_interpreters.py |
sage: cmp(c1, 1) | sage: cmp(c1, 1) * cmp(1, c1) | def __cmp__(self, right): r""" Compare ``self`` and ``right``. | 3f074141b23340048c07b4837ca93e3d433176d1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3f074141b23340048c07b4837ca93e3d433176d1/cone.py |
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. | 7db81c3f1a90204f557af158c4e6cc658b208972 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7db81c3f1a90204f557af158c4e6cc658b208972/element_ext_pari.py |
""" from sage.rings.all import ZZ | Check if sage: c.get_fake_div(1/pi/x) FakeExpression([1, FakeExpression([pi, x], <built-in function mul>)], <built-in function div>) """ | def get_fake_div(self, ex): """ EXAMPLES:: | d0aefb279f74a67e37df90d59b73a7386bd1c35d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d0aefb279f74a67e37df90d59b73a7386bd1c35d/expression_conversions.py |
if len(n) == 1: | if len(n) == 0: return FakeExpression([SR.one_element(), d], _operator.div) elif len(n) == 1: | def get_fake_div(self, ex): """ EXAMPLES:: | d0aefb279f74a67e37df90d59b73a7386bd1c35d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d0aefb279f74a67e37df90d59b73a7386bd1c35d/expression_conversions.py |
from sage.rings.all import Rational | def arithmetic(self, ex, operator): r""" EXAMPLES:: | d0aefb279f74a67e37df90d59b73a7386bd1c35d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d0aefb279f74a67e37df90d59b73a7386bd1c35d/expression_conversions.py |
|
codmain. | codomain. | def iter_morphisms(self, arg=None, codomain=None, min_length=1): r""" Iterate over all morphisms with domain ``self`` and the given codmain. | 35500ed2215d27303cd1b058328cb85d25aa4de3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/35500ed2215d27303cd1b058328cb85d25aa4de3/words.py |
iterator | iterator | def iter_morphisms(self, arg=None, codomain=None, min_length=1): r""" Iterate over all morphisms with domain ``self`` and the given codmain. | 35500ed2215d27303cd1b058328cb85d25aa4de3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/35500ed2215d27303cd1b058328cb85d25aa4de3/words.py |
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 | 2bbe90d8dd630ff240fa1449de79b164152e8e1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/2bbe90d8dd630ff240fa1449de79b164152e8e1e/tri_plot.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. | 8c4dc485eb804ace9bb6b2470385bc878b99b45b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8c4dc485eb804ace9bb6b2470385bc878b99b45b/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 this map take values in `\QQ`. | fd904fbe933fa046f1ac371c1b30f0f96ff1dc7a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/fd904fbe933fa046f1ac371c1b30f0f96ff1dc7a/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 this map take values in `\QQ`. | fd904fbe933fa046f1ac371c1b30f0f96ff1dc7a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/fd904fbe933fa046f1ac371c1b30f0f96ff1dc7a/ell_rational_field.py |
sage: EK.regulator_of_points([P,T]) | sage: EK.regulator_of_points([P,T]) | def regulator_of_points(self, points=[], precision=None): """ Returns the regulator of the given points on this curve. | a147dc602aa8a027c74c8a26df5bafcdc60444c0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a147dc602aa8a027c74c8a26df5bafcdc60444c0/ell_number_field.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((range(n), [[x,x+1] for x in range(n-1)])) | def ChainPoset(self, n): """ Returns a chain (a totally ordered poset) containing ``n`` elements. | fa59e7b098bb971010bf5024c4d05c57f7c29101 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/fa59e7b098bb971010bf5024c4d05c57f7c29101/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. | fa59e7b098bb971010bf5024c4d05c57f7c29101 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/fa59e7b098bb971010bf5024c4d05c57f7c29101/poset_examples.py |
sage: len(search_doc('tree', whole_word=True, interact=False).splitlines()) < 100 | sage: len(search_doc('tree', whole_word=True, interact=False).splitlines()) < 200 | def search_doc(string, extra1='', extra2='', extra3='', extra4='', extra5='', **kwds): """ Search Sage HTML documentation for lines containing ``string``. The search is case-sensitive. The file paths in the output are relative to ``$SAGE_ROOT/devel/sage/doc/output``. INPUT: same as for :func:`search_src`. OUTPUT: same as for :func:`search_src`. EXAMPLES: See the documentation for :func:`search_src` for more examples. :: sage: search_doc('creates a polynomial', path_re='tutorial', interact=False) # random html/en/tutorial/tour_polynomial.html:<p>This creates a polynomial ring and tells Sage to use (the string) If you search the documentation for 'tree', then you will get too many results, because many lines in the documentation contain the word 'toctree'. If you use the ``whole_word`` option, though, you can search for 'tree' without returning all of the instances of 'toctree'. In the following, since ``search_doc('tree', interact=False)`` returns a string with one line for each match, counting the length of ``search_doc('tree', interact=False).splitlines()`` gives the number of matches. :: sage: len(search_doc('tree', interact=False).splitlines()) > 2000 True sage: len(search_doc('tree', whole_word=True, interact=False).splitlines()) < 100 True """ return _search_src_or_doc('doc', string, extra1=extra1, extra2=extra2, extra3=extra3, extra4=extra4, extra5=extra5, **kwds) | c6cb71087a28f55e56b86510b154369ee28ae9ca /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/c6cb71087a28f55e56b86510b154369ee28ae9ca/sagedoc.py |
""" | sage: def square_for_met(f): ... @sage_wraps(f) ... def new_f(self, x): ... return f(self,x)*f(self,x) ... return new_f sage: class T: ... @square_for_met ... def g(self, x): ... "My little method" ... return x sage: t = T() sage: t.g(2) 4 sage: t.g._sage_src_() ' @square_for_met...def g(self, x)...' sage: t.g.__doc__ 'My little method' """ assigned= set(assigned).intersection(set(dir(wrapped))) | '@square...def g(x)...' | c33202541cd80b2558d177af7c0a87e97f64b7f0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/c33202541cd80b2558d177af7c0a87e97f64b7f0/misc.py |
self.__modulus = ntl_ZZ_pEContext(ntl_ZZ_pX(list(base_ring.polynomial()), p)) | self._modulus = ntl_ZZ_pEContext(ntl_ZZ_pX(list(base_ring.polynomial()), p)) | def __init__(self, base_ring, name="x", sparse=False, element_class=None, implementation=None): """ TESTS: sage: from sage.rings.polynomial.polynomial_ring import PolynomialRing_field as PRing sage: R = PRing(QQ, 'x'); R Univariate Polynomial Ring in x over Rational Field sage: type(R.gen()) <class 'sage.rings.polynomial.polynomial_element_generic.Polynomial_rational_dense'> sage: R = PRing(QQ, 'x', sparse=True); R Sparse Univariate Polynomial Ring in x over Rational Field sage: type(R.gen()) <class 'sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_sparse_field'> sage: R = PRing(CC, 'x'); R Univariate Polynomial Ring in x over Complex Field with 53 bits of precision sage: type(R.gen()) <class 'sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_dense_field'> """ if implementation is None: implementation="NTL" if implementation == "NTL" and \ sage.rings.finite_field.is_FiniteField(base_ring): p=base_ring.characteristic() from sage.libs.ntl.ntl_ZZ_pEContext import ntl_ZZ_pEContext from sage.libs.ntl.ntl_ZZ_pX import ntl_ZZ_pX self.__modulus = ntl_ZZ_pEContext(ntl_ZZ_pX(list(base_ring.polynomial()), p)) from sage.rings.polynomial.polynomial_zz_pex import Polynomial_ZZ_pEX element_class=Polynomial_ZZ_pEX | 066a1319dca500d6f1f1b4d90adf81fbb160e95c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/066a1319dca500d6f1f1b4d90adf81fbb160e95c/polynomial_ring.py |
be overfull if : - `n` is odd - It satisfies `2m > (n-1)\Delta(G)`, where `\Delta(G)` denotes the maximal degree of a vertex in `G` | be overfull if: - `n` is odd - It satisfies `2m > (n-1)\Delta(G)`, where `\Delta(G)` denotes the maximum degree among all vertices in `G`. | def is_overfull(self): r""" Tests whether the current graph is overfull. | 6f8059b4d06ca961c4eb6133af3e23efa6bc12cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/6f8059b4d06ca961c4eb6133af3e23efa6bc12cf/generic_graph.py |
EXAMPLE: A complete graph is overfull if and only if its number of vertices is odd:: | EXAMPLES: A complete graph of order `n > 1` is overfull if and only if `n` is odd:: | def is_overfull(self): r""" Tests whether the current graph is overfull. | 6f8059b4d06ca961c4eb6133af3e23efa6bc12cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/6f8059b4d06ca961c4eb6133af3e23efa6bc12cf/generic_graph.py |
return (self.order() % 2 == 1) and \ (2*self.size() > max(self.degree())*(self.order()-1)) | return (self.order() % 2 == 1) and ( 2 * self.size() > max(self.degree()) * (self.order() - 1)) | def is_overfull(self): r""" Tests whether the current graph is overfull. | 6f8059b4d06ca961c4eb6133af3e23efa6bc12cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/6f8059b4d06ca961c4eb6133af3e23efa6bc12cf/generic_graph.py |
sage: r.install_package('Hmisc') [1] 4 5 6 """ if UNAME == "Darwin": warn = "** You are using OS X. Unfortunately, the R optional package system currently doesn't support OS X very well. We are working on this. **" else: warn = None if warn is not None: print warn | sage: r.install_packages('aaMI') ... R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. ... Please restart Sage in order to use 'aaMI'. """ | def install_packages(self, package_name): """ Install an R package into Sage's R installation. | bca174b133ba583c6048f65988dae86d8338a432 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bca174b133ba583c6048f65988dae86d8338a432/r.py |
print "Please restart Sage or restart the R interface (via r.restart()) in order to use '%s'."%package_name if warn is not None: print warn | print "Please restart Sage in order to use '%s'."%package_name | def install_packages(self, package_name): """ Install an R package into Sage's R installation. | bca174b133ba583c6048f65988dae86d8338a432 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bca174b133ba583c6048f65988dae86d8338a432/r.py |
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. | b3346f6cfd70e8266493803a83efcc8a55613862 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/b3346f6cfd70e8266493803a83efcc8a55613862/power_series_ring.py |
- ``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. | b3346f6cfd70e8266493803a83efcc8a55613862 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/b3346f6cfd70e8266493803a83efcc8a55613862/power_series_ring.py |
- ``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. | b3346f6cfd70e8266493803a83efcc8a55613862 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/b3346f6cfd70e8266493803a83efcc8a55613862/power_series_ring.py |
sage: R.random_element(5) | sage: R.random_element(5) | def random_element(self, prec, bound=None): r""" Return a random power series. | b3346f6cfd70e8266493803a83efcc8a55613862 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/b3346f6cfd70e8266493803a83efcc8a55613862/power_series_ring.py |
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^9 + t^11 - 6*t^12 + 2*t^14 + 2*t^16 - t^17 - 3*t^18 + O(t^20) sage: S = PowerSeriesRing(ZZ,'t', default_prec=4) sage: S.random_element() 2 - t - 5*t^2 + t^3 + O(t^4) Further arguments are passed to the underlying base ring (ticket sage: SZ = PowerSeriesRing(ZZ,'v') sage: SQ = PowerSeriesRing(QQ,'v') sage: SR = PowerSeriesRing(RR,'v') sage: SZ.random_element(x=4, y=6) 4 + 5*v + 5*v^2 + 5*v^3 + 4*v^4 + 5*v^5 + 5*v^6 + 5*v^7 + 4*v^8 + 5*v^9 + 4*v^10 + 4*v^11 + 5*v^12 + 5*v^13 + 5*v^14 + 5*v^15 + 5*v^16 + 5*v^17 + 4*v^18 + 5*v^19 + O(v^20) sage: SZ.random_element(3, x=4, y=6) 5 + 4*v + 5*v^2 + O(v^3) sage: SQ.random_element(3, num_bound=3, den_bound=100) 1/87 - 3/70*v - 3/44*v^2 + O(v^3) sage: SR.random_element(3, max=10, min=-10) 2.85948321262904 - 9.73071330911226*v - 6.60414378519265*v^2 + O(v^3) """ if prec is None: prec = self.default_prec() return self(self.__poly_ring.random_element(prec-1, *args, **kwds), prec) | def random_element(self, prec, bound=None): r""" Return a random power series. | b3346f6cfd70e8266493803a83efcc8a55613862 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/b3346f6cfd70e8266493803a83efcc8a55613862/power_series_ring.py |
Returns the rim of ``self`` | Returns the rim of ``self``. | def rim(self): r""" Returns the rim of ``self`` | 161eecb116ecbf68d64e55cd14e42c6e2737222f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/161eecb116ecbf68d64e55cd14e42c6e2737222f/partition.py |
For example if `p=(5,5,2,1)`, the rim is composed from the dashed cells below:: | The rim of the partition `[5,5,2,1]` consists of the cells marked with `` | def rim(self): r""" Returns the rim of ``self`` | 161eecb116ecbf68d64e55cd14e42c6e2737222f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/161eecb116ecbf68d64e55cd14e42c6e2737222f/partition.py |
Returns the outer rim of ``self`` | Returns the outer rim of ``self``. | def outer_rim(self): """ Returns the outer rim of ``self`` | 161eecb116ecbf68d64e55cd14e42c6e2737222f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/161eecb116ecbf68d64e55cd14e42c6e2737222f/partition.py |
For example, the dashed cell below is the outer_rim of the partitions `(4,1)`:: | The outer rim of the partition `[4,1]` consists of the cells marked with `` | def outer_rim(self): """ Returns the outer rim of ``self`` | 161eecb116ecbf68d64e55cd14e42c6e2737222f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/161eecb116ecbf68d64e55cd14e42c6e2737222f/partition.py |
- ``alphabet`` - (default: (1,2)) any container that is suitable to build an instance of OrderedAlphabet (list, tuple, str, ...) | - ``alphabet`` - (default: (1,2)) an iterable of two positive integers | def KolakoskiWord(self, alphabet=(1,2)): r""" Returns the Kolakoski word over the given alphabet and starting with the first letter of the alphabet. | 4c70624aab06407e1fef08ffafb06e365cea8ac3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4c70624aab06407e1fef08ffafb06e365cea8ac3/word_generators.py |
[1] William Kolakoski, proposal 5304, American Mathematical Monthly 72 (1965), 674; for a partial solution, see "Self Generating Runs," by Necdet Üçoluk, Amer. Math. Mon. 73 (1966), 681-2. """ try: a = int(alphabet[0]) b = int(alphabet[1]) if a <=0 or b <= 0 or a == b: raise ValueError, 'The alphabet (=%s) must consist of two distinct positive integers'%alphabet else: return Words(alphabet)(self._KolakoskiWord_iterator(a, b), datatype = 'iter') except: raise ValueError, 'The elements of the alphabet (=%s) must be positive integers'%alphabet | - [1] William Kolakoski, proposal 5304, American Mathematical Monthly 72 (1965), 674; for a partial solution, see "Self Generating Runs," by Necdet Üçoluk, Amer. Math. Mon. 73 (1966), 681-2. """ a, b = alphabet if a not in ZZ or a <= 0 or b not in ZZ or b <= 0 or a == b: msg = 'The alphabet (=%s) must consist of two distinct positive integers'%(alphabet,) raise ValueError, msg return Words(alphabet)(self._KolakoskiWord_iterator(a, b), datatype = 'iter') | def KolakoskiWord(self, alphabet=(1,2)): r""" Returns the Kolakoski word over the given alphabet and starting with the first letter of the alphabet. | 4c70624aab06407e1fef08ffafb06e365cea8ac3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4c70624aab06407e1fef08ffafb06e365cea8ac3/word_generators.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. | 27afa7d7d2558f215295f6039ce9eabe97af8775 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/27afa7d7d2558f215295f6039ce9eabe97af8775/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 | 27afa7d7d2558f215295f6039ce9eabe97af8775 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/27afa7d7d2558f215295f6039ce9eabe97af8775/contfrac.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. | 58a962fefc201dcfd3e2e47df0f7b0e2cedced92 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/58a962fefc201dcfd3e2e47df0f7b0e2cedced92/polyhedra.py |
is_inequality.__doc__ = Hrepresentation.is_inequality.__doc__ | def is_inequality(self): """ Returns True since this is, by construction, an inequality. | 58a962fefc201dcfd3e2e47df0f7b0e2cedced92 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/58a962fefc201dcfd3e2e47df0f7b0e2cedced92/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()._is_positive( self.eval(Vobj) ) except AttributeError: pass | 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. | 58a962fefc201dcfd3e2e47df0f7b0e2cedced92 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/58a962fefc201dcfd3e2e47df0f7b0e2cedced92/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. | 58a962fefc201dcfd3e2e47df0f7b0e2cedced92 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/58a962fefc201dcfd3e2e47df0f7b0e2cedced92/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. | 58a962fefc201dcfd3e2e47df0f7b0e2cedced92 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/58a962fefc201dcfd3e2e47df0f7b0e2cedced92/polyhedra.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.