# Changes in [3172:2b664e2fb661:3173:8ef6a6e960f0]

Ignore:
Location:
sage
Files:
24 edited

Unmodified
Removed
• ## sage/ext/random.pxi

 r2802 long random() void srandom(unsigned int seed) k = randrange(0,2**32) k = randrange(0, int(2)**32) srandom(k)
• ## sage/functions/transcendental.py

 r2641 return x I = complex_field.ComplexField().gen(0) CC = complex_field.ComplexField() I = CC.gen(0) def __eval(x): return eval(x) """ Gamma function at s. """ if not (is_ComplexNumber(s) or is_RealNumber(s)): s = RealField()(s) return s.gamma() #return complex_field.ComplexField()(pari(s).gamma(prec).python(prec)) EXAMPLES: sage: gamma(CDF(0.5,14)) -4.05370307804e-10 - 5.77329961615e-10*I sage: gamma(I) -0.154949828301810 - 0.498015668118356*I sage: gamma(6) 120.000000000000 """ try: return s.gamma() except AttributeError: return CC(s).gamma() def gamma_inc(s, t): """ Incomplete Gamma function Gamma(s,t). """ if not (is_ComplexNumber(s)): if is_ComplexNumber(t): C = t.parent() else: C = ComplexField() s = C(s) return s.gamma_inc(t) #s = pari.new_with_prec(s, prec) #t = pari.new_with_prec(s, prec) #return complex_field.ComplexField()(s.incgam(t, prec).python(prec)) EXAMPLES: sage: gamma_inc(CDF(0,1), 3) 0.00320857499337 + 0.0124061862007*I sage: gamma_inc(3, 3) 0.846380162253687 sage: gamma_inc(RDF(1), 3) 0.0497870683678639 """ try: return s.gamma_inc(t) except AttributeError: if not (is_ComplexNumber(s)): if is_ComplexNumber(t): C = t.parent() else: C = ComplexField() s = C(s) return s.gamma_inc(t) # synonym.
• ## sage/graphs/graph.py

 r3136 -- Robert L. Miller (2007-02-12): vertex color-maps, graph boundaries, graph6 helper functions in SageX SAGE Days 3 (2007-02-17--21): 3d plotting in Tachyon, TUTORIAL: sage: pl.save('sage.png') C = graphs.CubeGraph(8) P = C.plot(vertex_labels=False, node_size=0, graph_border=True) P.save('sage.png') sage: C = graphs.CubeGraph(8) sage: P = C.plot(vertex_labels=False, node_size=0, graph_border=True) sage: P.save('sage.png') """ GG = Graphics() return GG def plot3d(self, bgcolor=(1,1,1), vertex_color=(1,0,0), edge_color=(0,0,0), pos3d=None): """ Plots the graph using Tachyon, and returns a Tachyon object containing a representation of the graph. INPUT: bgcolor -- background color vertex_color -- vertex color edge_color -- edge color (pos3d -- currently ignored, pending GSL random point distribution in sphere...) EXAMPLES: sage: D = graphs.DodecahedralGraph() sage: P3D = D.plot3d() sage: P3D.save('sage.png') # long time sage: G = graphs.PetersenGraph() sage: G.plot3d(vertex_color=(0,0,1)).save('sage.png') # long time sage: C = graphs.CubeGraph(4) sage: C.plot3d(edge_color=(0,1,0), vertex_color=(1,1,1), bgcolor=(0,0,0)).save('sage.png') # long time """ import networkx from math import sqrt from sage.plot.tachyon import Tachyon c = [0,0,0] r = [] verts = self.vertices() pos3d = networkx.spring_layout(self._nxg, dim=3) # to be replaced by comment blocks 1, 2 below #spring = False # block 1 #if pos3d is None: #    spring = True #    pos3d = networkx.spring_layout(self._nxg, dim=3) for v in verts: c[0] += pos3d[v][0] c[1] += pos3d[v][1] c[2] += pos3d[v][2] order = self.order() c[0] = c[0]/order c[1] = c[1]/order c[2] = c[2]/order for v in verts: pos3d[v][0] = pos3d[v][0] - c[0] pos3d[v][1] = pos3d[v][1] - c[1] pos3d[v][2] = pos3d[v][2] - c[2] r.append(abs(sqrt((pos3d[v][0])**2 + (pos3d[v][1])**2 + (pos3d[v][2])**2))) r = max(r) for v in verts: pos3d[v][0] = pos3d[v][0]/r pos3d[v][1] = pos3d[v][1]/r pos3d[v][2] = pos3d[v][2]/r #if not spring: # block 2 #    for v in verts: #        if not v in pos3d: #            pass### place node randomly inside B_1(origin) TT = Tachyon(camera_center=(1.4,1.4,1.4), antialiasing=13) TT.light((4,3,2), 0.02, (1,1,1)) TT.texture('node', ambient=0.1, diffuse=0.9, specular=0.03, opacity=1.0, color=vertex_color) TT.texture('edge', ambient=0.1, diffuse=0.9, specular=0.03, opacity=1.0, color=edge_color) TT.texture('bg', ambient=1, diffuse=1, specular=0, opacity=1.0, color=bgcolor) TT.plane((-1.6,-1.6,-1.6), (1.6,1.6,1.6), 'bg') for v in verts: TT.sphere((pos3d[v][0],pos3d[v][1],pos3d[v][2]), .06, 'node') for u,v,l in self.edges(): TT.fcylinder( (pos3d[u][0],pos3d[u][1],pos3d[u][2]),\ (pos3d[v][0],pos3d[v][1],pos3d[v][2]), .02,'edge') return TT def show(self, pos=None, layout=None, vertex_labels=True, node_size=200, graph_border=False, color_dict=None, **kwds): """ """ self.plot(pos=pos, layout=layout, vertex_labels=vertex_labels, node_size=node_size, color_dict=color_dict, graph_border=graph_border).show(**kwds) def show3d(self, bgcolor=(1,1,1), vertex_color=(1,0,0), edge_color=(0,0,0), pos3d=None, **kwds): """ Plots the graph using Tachyon, and shows the resulting plot. INPUT: bgcolor -- background color vertex_color -- vertex color edge_color -- edge color (pos3d -- currently ignored, pending GSL random point distribution in sphere...) EXAMPLES: sage: D = graphs.DodecahedralGraph() sage: P3D = D.plot3d() sage: P3D.save('sage.png') # long time sage: G = graphs.PetersenGraph() sage: G.plot3d(vertex_color=(0,0,1)).save('sage.png') # long time sage: C = graphs.CubeGraph(4) sage: C.plot3d(edge_color=(0,1,0), vertex_color=(1,1,1), bgcolor=(0,0,0)).save('sage.png') # long time """ self.plot3d(bgcolor=bgcolor, vertex_color=vertex_color, edge_color=edge_color).show(**kwds) class DiGraph(GenericGraph): return GG def plot3d(self, bgcolor=(1,1,1), vertex_color=(1,0,0), edge_color=(0,0,0), pos3d=None): """ Plots the graph using Tachyon, and returns a Tachyon object containing a representation of the graph. INPUT: bgcolor -- background color vertex_color -- vertex color edge_color -- edge color (pos3d -- currently ignored, pending GSL random point distribution in sphere...) NOTE: The weaknesses of the NetworkX spring layout are illustrated even further in the case of digraphs: my guess is that digraphs weren't even considered in the authoring of this algorithm. The following example illustrates this. EXAMPLE: # This is a running example # A directed version of the dodecahedron sage: D = DiGraph( { 0: [1, 10, 19], 1: [8, 2], 2: [3, 6], 3: [19, 4], 4: [17, 5], 5: [6, 15], 6: [7], 7: [8, 14], 8: [9], 9: [10, 13], 10: [11], 11: [12, 18], 12: [16, 13], 13: [14], 14: [15], 15: [16], 16: [17], 17: [18], 18: [19], 19: []} ) # If I use an undirected version of my graph, the output is as expected sage: import networkx sage: pos3d=networkx.spring_layout(graphs.DodecahedralGraph()._nxg, dim=3) sage: D.plot3d(pos3d=pos3d).save('sage.png') # long time # However, if I use the directed version, everything gets skewed bizarrely: sage: D.plot3d().save('sage.png') # long time """ import networkx from math import sqrt from sage.plot.tachyon import Tachyon c = [0,0,0] r = [] verts = self.vertices() #pos3d = networkx.spring_layout(self._nxg, dim=3) spring = False if pos3d is None: pos3d = networkx.spring_layout(self._nxg, dim=3) for v in verts: c[0] += pos3d[v][0] c[1] += pos3d[v][1] c[2] += pos3d[v][2] order = self.order() c[0] = c[0]/order c[1] = c[1]/order c[2] = c[2]/order for v in verts: pos3d[v][0] = pos3d[v][0] - c[0] pos3d[v][1] = pos3d[v][1] - c[1] pos3d[v][2] = pos3d[v][2] - c[2] r.append(abs(sqrt((pos3d[v][0])**2 + (pos3d[v][1])**2 + (pos3d[v][2])**2))) r = max(r) for v in verts: pos3d[v][0] = pos3d[v][0]/r pos3d[v][1] = pos3d[v][1]/r pos3d[v][2] = pos3d[v][2]/r TT = Tachyon(camera_center=(1.4,1.4,1.4), antialiasing=13) TT.light((4,3,2), 0.02, (1,1,1)) TT.texture('node', ambient=0.1, diffuse=0.9, specular=0.03, opacity=1.0, color=vertex_color) TT.texture('edge', ambient=0.1, diffuse=0.9, specular=0.03, opacity=1.0, color=edge_color) TT.texture('bg', ambient=1, diffuse=1, specular=0, opacity=1.0, color=bgcolor) TT.plane((-1.6,-1.6,-1.6), (1.6,1.6,1.6), 'bg') for v in verts: TT.sphere((pos3d[v][0],pos3d[v][1],pos3d[v][2]), .06, 'node') for u,v,l in self.arcs(): TT.fcylinder( (pos3d[u][0],pos3d[u][1],pos3d[u][2]),\ (pos3d[v][0],pos3d[v][1],pos3d[v][2]), .02,'edge') TT.fcylinder( (0.25*pos3d[u][0] + 0.75*pos3d[v][0],\ 0.25*pos3d[u][1] + 0.75*pos3d[v][1],\ 0.25*pos3d[u][2] + 0.75*pos3d[v][2],), (pos3d[v][0],pos3d[v][1],pos3d[v][2]), .0325,'edge') return TT def show(self, pos=None, vertex_labels=True, node_size=200, graph_border=False, color_dict=None, **kwds): """ self.plot(pos, vertex_labels, node_size=node_size, color_dict=color_dict, graph_border=graph_border).show(**kwds) def show3d(self, bgcolor=(1,1,1), vertex_color=(1,0,0), edge_color=(0,0,0), pos3d=None, **kwds): """ Plots the graph using Tachyon, and shows the resulting plot. INPUT: bgcolor -- background color vertex_color -- vertex color edge_color -- edge color (pos3d -- currently ignored, pending GSL random point distribution in sphere...) NOTE: The weaknesses of the NetworkX spring layout are illustrated even further in the case of digraphs: my guess is that digraphs weren't even considered in the authoring of this algorithm. The following example illustrates this. EXAMPLE: # This is a running example # A directed version of the dodecahedron sage: D = DiGraph( { 0: [1, 10, 19], 1: [8, 2], 2: [3, 6], 3: [19, 4], 4: [17, 5], 5: [6, 15], 6: [7], 7: [8, 14], 8: [9], 9: [10, 13], 10: [11], 11: [12, 18], 12: [16, 13], 13: [14], 14: [15], 15: [16], 16: [17], 17: [18], 18: [19], 19: []} ) # If I use an undirected version of my graph, the output is as expected sage: import networkx sage: pos3d=networkx.spring_layout(graphs.DodecahedralGraph()._nxg, dim=3) sage: D.plot3d(pos3d=pos3d).save('sage.png') # long time # However, if I use the directed version, everything gets skewed bizarrely: sage: D.plot3d().save('sage.png') # long time """ self.plot3d(bgcolor=bgcolor, vertex_color=vertex_color, edge_color=edge_color).show(**kwds)
• ## sage/graphs/graph_fast.pyx

 r2993 """ # pad on the right to make a multiple of 6 x = x + ( '0' * ((6 - len(x))%6) ) x += '0' * ( (6 - (len(x) % 6)) % 6) # split into groups of 6, and convert numbers to decimal, adding 63
• ## sage/interfaces/macaulay2.py

 r3043 sage: X.structure_sheaf()                           # optional OO sage6 sage1 """ return self.parent()('OO_%s'%self.name())
• ## sage/interfaces/octave.py

 r1908 sage: octave.eval("b = [ 1; 3; 13]")                         # optional 'b =\n\n 1\n 3\n 13\n\n' sage: octave.eval("c=a \\ b") # solves linear equation: a*c = b  # optional sage: octave.eval("c=a \\ b") # solves linear equation: a*c = b  # optional random output 'c =\n\n 1\n -0\n 0\n\n' sage: print octave.eval("c")                                 # optional sage: octave.eval("c")                                 # optional random output c = sage: V3  = VectorSpace(QQ,3) sage: b   = V3([1,2,3]) sage: octave.solve_linear_system(A,b)    # requires optional octave sage: octave.solve_linear_system(A,b)    # requires optional octave (and output is slightly random in low order bits) [-0.33333299999999999, 0.66666700000000001, 0]
• ## sage/libs/ntl/ntl.pyx

 r3170 if x is None: from random import randint seed = make_new_ZZ(str(randint(0,2**64))) seed = make_new_ZZ(str(randint(0,int(2)**64))) else: seed = make_new_ZZ(str(x))
• ## sage/libs/pari/gen.pyx

 r2843 return idealval(self.g, t0, t1) def modreverse(self): """ modreverse(x): reverse polymod of the polymod x, if it exists. EXAMPLES: """ _sig_on return self.new_gen(polymodrecip(self.g)) def nfbasis(self, long flag=0, p=0): cdef gen _p return self.new_gen(nfbasis0(self.g, flag, g)) def nffactor(self, x): t0GEN(x) _sig_on return self.new_gen(nffactor(self.g, t0)) def nfgenerator(self): f = self[0] return self.new_gen(rnfelementreltoabs(self.g, t0)) def rnfequation(self, poly): def rnfequation(self, poly, long flag=0): t0GEN(poly) _sig_on return self.new_gen(rnfequation0(self.g, t0, 0)) return self.new_gen(rnfequation0(self.g, t0, flag)) def rnfidealabstorel(self, x): return self.new_gen(polrecip(self.g)) def polred(self, flag=0, fa=None): _sig_on if fa is None: return self.new_gen(polred0(self.g, flag, NULL)) else: t0GEN(fa) return self.new_gen(polred0(self.g, flag, t0)) def polresultant(self, y, var=-1, flag=0): t0GEN(y)
• ## sage/misc/hg.py

 r2687 t = tmp_filename() open(t,'w').write(cmd) os.system('source %s &'%(os.path.abspath(t))) P = os.path.abspath(t) os.system('chmod +x %s; %s &'%(P, P)) self('serve --port %s'%port)
• ## sage/modules/module.pyx

 r2419 False """ return isinstance(x, Module) return bool(isinstance(x, Module)) def is_VectorSpace(x): """ import sage.modules.free_module return isinstance(x, sage.modules.free_module.FreeModule_generic_field) return bool(isinstance(x, sage.modules.free_module.FreeModule_generic_field))

• ## sage/rings/real_double.pyx

 r2869 EXAMPLES: sage: R = RealField(100) sage: RDF.pi() 3.14159265359
• ## sage/rings/real_mpfi.pyx

 r2833 sage: a == 2 False COMPARISONS: Comparison operations (==,!=,<,<=,>,>=) return true if every value in the first interval has the given relation to every value in the second interval.  The cmp(a, b) function works differently; it compares two intervals lexicographically.  (However, the behavior is not specified if given a non-interval and an interval.) This convention for comparison operators has good and bad points.  The good: * Expected transitivity properties hold (if a > b and b == c, then a > c; etc.) * if a>b, then cmp(a, b) == 1; if a==b, then cmp(a,b) == 0; if a0 means something useful (that every value in the interval is greater than 0) The bad: * Trichotomy fails to hold: there are values (a,b) such that none of ab are true * It is not the case that if cmp(a, b) == 0 then a==b, or that if cmp(a, b) == 1 then a>b, or that if cmp(a, b) == -1 then aself._parent).__middle_field._new() mpfi_mig( x.value, self.value) return x def center(self): def __richcmp__(left, right, int op): return (left)._richcmp(right, op) return (left)._richcmp(right, op) cdef _richcmp_c_impl(left, Element right, int op): """ Implements comparisons between intervals.  (See the file header comment for more information on interval comparison.) EXAMPLES: sage: 0 < RIF(1, 3) True sage: 1 < RIF(1, 3) False sage: 2 < RIF(1, 3) False sage: 4 < RIF(1, 3) False sage: RIF(0, 1/2) < RIF(1, 3) True sage: RIF(0, 1) < RIF(1, 3) False sage: RIF(0, 2) < RIF(1, 3) False sage: RIF(1, 2) < RIF(1, 3) False sage: RIF(1, 3) < 4 True sage: RIF(1, 3) < 3 False sage: RIF(1, 3) < 2 False sage: RIF(1, 3) < 0 False sage: 0 <= RIF(1, 3) True sage: 1 <= RIF(1, 3) True sage: 2 <= RIF(1, 3) False sage: 4 <= RIF(1, 3) False sage: RIF(0, 1/2) <= RIF(1, 3) True sage: RIF(0, 1) <= RIF(1, 3) True sage: RIF(0, 2) <= RIF(1, 3) False sage: RIF(1, 2) <= RIF(1, 3) False sage: RIF(1, 3) <= 4 True sage: RIF(1, 3) <= 3 True sage: RIF(1, 3) <= 2 False sage: RIF(1, 3) <= 0 False sage: RIF(1, 3) > 0 True sage: RIF(1, 3) > 1 False sage: RIF(1, 3) > 2 False sage: RIF(1, 3) > 4 False sage: RIF(1, 3) > RIF(0, 1/2) True sage: RIF(1, 3) > RIF(0, 1) False sage: RIF(1, 3) > RIF(0, 2) False sage: RIF(1, 3) > RIF(1, 2) False sage: 4 > RIF(1, 3) True sage: 3 > RIF(1, 3) False sage: 2 > RIF(1, 3) False sage: 0 > RIF(1, 3) False sage: RIF(1, 3) >= 0 True sage: RIF(1, 3) >= 1 True sage: RIF(1, 3) >= 2 False sage: RIF(1, 3) >= 4 False sage: RIF(1, 3) >= RIF(0, 1/2) True sage: RIF(1, 3) >= RIF(0, 1) True sage: RIF(1, 3) >= RIF(0, 2) False sage: RIF(1, 3) >= RIF(1, 2) False sage: 4 >= RIF(1, 3) True sage: 3 >= RIF(1, 3) True sage: 2 >= RIF(1, 3) False sage: 0 >= RIF(1, 3) False sage: 0 == RIF(0) True sage: 0 == RIF(1) False sage: 1 == RIF(0) False sage: 0 == RIF(0, 1) False sage: 1 == RIF(0, 1) False sage: RIF(0, 1) == RIF(0, 1) False sage: RIF(1) == 0 False sage: RIF(1) == 1 True sage: RIF(0) == RIF(0) True sage: RIF(pi) == RIF(pi) False sage: RIF(0, 1) == RIF(1, 2) False sage: RIF(1, 2) == RIF(0, 1) False sage: 0 != RIF(0) False sage: 0 != RIF(1) True sage: 1 != RIF(0) True sage: 0 != RIF(0, 1) False sage: 1 != RIF(0, 1) False sage: RIF(0, 1) != RIF(0, 1) False sage: RIF(1) != 0 True sage: RIF(1) != 1 False sage: RIF(0) != RIF(0) False sage: RIF(pi) != RIF(pi) False sage: RIF(0, 1) != RIF(1, 2) False sage: RIF(1, 2) != RIF(0, 1) False """ cdef RealIntervalFieldElement lt, rt lt = left rt = right if op == 0: #< return PyBool_FromLong(mpfr_less_p(<.value.right, &rt.value.left)) elif op == 2: #== # a == b iff a<=b and b <= a # (this gives a result with two comparisons, where the # obvious approach would use three) return PyBool_FromLong(mpfr_lessequal_p(<.value.right, &rt.value.left)) \ and PyBool_FromLong(mpfr_lessequal_p(&rt.value.right, <.value.left)) elif op == 4: #> return PyBool_FromLong(mpfr_less_p(&rt.value.right, <.value.left)) elif op == 1: #<= return PyBool_FromLong(mpfr_lessequal_p(<.value.right, &rt.value.left)) elif op == 3: #!= return PyBool_FromLong(mpfr_less_p(<.value.right, &rt.value.left)) \ or PyBool_FromLong(mpfr_less_p(&rt.value.right, <.value.left)) elif op == 5: #>= return PyBool_FromLong(mpfr_lessequal_p(&rt.value.right, <.value.left)) def __cmp__(left, right): """ Compare two intervals lexicographically.  Returns 0 if they are the same interval, -1 if the second is larger, or 1 if the first is larger. EXAMPLES: sage: cmp(RIF(0), RIF(1)) -1 sage: cmp(RIF(0, 1), RIF(1)) -1 sage: cmp(RIF(0, 1), RIF(1, 2)) -1 sage: cmp(RIF(0, 0.99999), RIF(1, 2)) -1 sage: cmp(RIF(1, 2), RIF(0, 1)) 1 sage: cmp(RIF(1, 2), RIF(0)) 1 sage: cmp(RIF(0, 1), RIF(0, 2)) -1 sage: cmp(RIF(0, 1), RIF(0, 1)) 0 sage: cmp(RIF(0, 1), RIF(0, 1/2)) 1 """ return (left)._cmp(right) cdef int _cmp_c_impl(left, Element right) except -2: """ Compare two intervals.  Returns 0 if they overlap, -1 if the second is larger, or 1 if the first is larger. EXAMPLES: sage: RIF(0) < RIF(1) True sage: RIF(0, 1) < RIF(1) False sage: RIF(0, 1) == RIF(1, 2) True sage: RIF(0, 0.99999) == RIF(1, 2) False sage: RIF(1, 2) > RIF(0, 1) False sage: RIF(1, 2) > RIF(0) True """ cdef RealIntervalFieldElement self, x self = left x = right Implements the lexicographic total order on intervals. """ cdef RealIntervalFieldElement lt, rt lt = left rt = right cdef int i i = mpfi_cmp(self.value, x.value) i = mpfr_cmp(<.value.left, &rt.value.left) if i < 0: return -1 elif i == 0: return 0 elif i > 0: return 1 i = mpfr_cmp(<.value.right, &rt.value.right) if i < 0: return -1 elif i > 0: return 1 else: return 1 return 0 def __contains__(self, other): return False # Skipping mpfi_intersect(), because it can return an empty # interval (where nothing else can), and I don't want to # deal with empty intervals everywhere. def intersection(self, other): """ Return the intersection of two intervals.  If the intervals do not overlap, raises a ValueError. EXAMPLES: sage: RIF(1, 2).intersection(RIF(1.5, 3)) [1.5000000000000000 ... 2.0000000000000000] sage: RIF(1, 2).intersection(RIF(4/3, 5/3)) [1.3333333333333332 ... 1.6666666666666668] sage: RIF(1, 2).intersection(RIF(3, 4)) Traceback (most recent call last): ... ValueError: intersection of non-overlapping intervals """ cdef RealIntervalFieldElement x x = self._new() cdef RealIntervalFieldElement other_intv if PY_TYPE_CHECK(other, RealIntervalFieldElement): other_intv = other else: # Let type errors from _coerce_ propagate... other_intv = self._parent._coerce_(other) mpfi_intersect(x.value, self.value, other_intv.value) if mpfr_less_p(&x.value.right, &x.value.left): raise ValueError, "intersection of non-overlapping intervals" return x def union(self, other): def sqrt(self): """ Return a square root of self. If self is negative a complex number is returned. If you use self.square_root() then a real number will always be returned (though it will be NaN if self is negative). Return a square root of self.  Raises an error if self is nonpositive. If you use self.square_root() then an interval will always be returned (though it will be NaN if self is nonpositive). EXAMPLES: [65.909028213136323 ... 65.909028213136339] sage: r.sqrt()^2 == r False sage: r in r.sqrt()^2 True sage: r.sqrt()^2 - r """ Return a square root of self.  An interval will always be returned (though it will be NaN if self is negative). returned (though it will be NaN if self is nonpositive). EXAMPLES: sage: a.is_int() (True, -1) """ if self.diameter() >= 1: return False, None a = (self.lower()+1).floor() sage: a = RIF(0.1, 1.9) sage: a.is_int() (True, 1) """ a = (self.lower()).ceil() b = (self.upper()).floor() if a == b: return True, a else: sage: q2 = i.acos(); q2 [1.0471975511965974 ... 1.0471975511965981] sage: q2 == q True sage: q == q2 False sage: q != q2 False sage: q2.lower() == q.lower() False sage: q2 = i.asin(); q2 [0.62831853071795851 ... 0.62831853071795885] sage: q2 == q True sage: q == q2 False sage: q != q2 False sage: q2.lower() == q.lower() False sage: q2 = i.atan(); q2 [0.62831853071795851 ... 0.62831853071795885] sage: q2 == q True sage: q == q2 False sage: q != q2 False sage: q2.lower() == q.lower() False def is_RealIntervalFieldElement(x): return PY_TYPE_CHECK(x, RealIntervalFieldElementClass) return PY_TYPE_CHECK(x, RealIntervalFieldElement) def __create__RealIntervalFieldElement_version0(parent, x, base=10): return RealIntervalFieldElement(parent, x, base=base)
• ## sage/server/notebook/cell.py

 r3136 dir = self.directory() D = os.listdir(dir) D.sort() if len(D) == 0: return '' r = '' r += ' '*(7-len(r)) if do_print: btn = "" else: btn = """ """%(self.__id,self.__id) tbl = btn + """ ##         if do_print: ##             btn = "" ##         else: ##             btn = """ ##                  ##                   """%(self.__id,self.__id) ##        tbl = btn + """ tbl = """
• ## sage/server/notebook/css.py

 r3126 color:#000000; background-color: #e8e8e8; border: 0px solid white; /* border-left: 2px solid green; */ border: 2px solid white; font-family: courier, monospace; font-size:12pt; /*  overflow:hidden; */ overflow:auto; padding-left:5px; padding-top:3px; padding-bottom:0px; /*  margin:0px; */ width: 100%; margin-bottom:0px;
• ## sage/server/notebook/js.py

 r3126 e.className="cell_input_active"; cell_input_resize(e); set_class('evaluate_button_'+id, 'evaluate_button') /* set_class('evaluate_button_'+id, 'evaluate_button') */ return true; } e.className="cell_input"; cell_input_minimize_size(e); setTimeout("set_class('evaluate_button_"+id+"', 'hidden')", 100); /* setTimeout("set_class('evaluate_button_"+id+"', 'hidden')", 100); */ return true; } function cell_input_resize(cell_input) { var rows = 2; //var rows = cell_input.value.split('\n').length - 1; var rows = cell_input.value.split('\n').length + 1; if (rows <= 1) { rows = 2; } else { /* to avoid bottom chop off */ /*      rows = rows + 1; */ if (rows < 1) { rows = 1; } try { cell_input.style.height = rows + 'em'; // this sort of works in konqueror... cell_input.style.height = 1.3*rows + 'em'; // this sort of works in konqueror... } catch(e) {} try{ /*    try{ cell_input.rows = rows; } catch(e) {} */ if(slide_hidden) { cell_input.className = 'cell_input'; var rows = v.split('\n').length ; var rows = v.split('\n').length + 1; if (rows < 1) { rows = 1; } cell_input.rows = rows; try { cell_input.style.height = 1.3*rows + 'em'; // this sort of works in konqueror... } catch(e) {} /*    try{ cell_input.rows = rows; } catch(e) {} */ if (rows == 1) { // hack because of bug in firefox with 1-row textarea
• ## sage/structure/element.pxd

 r2866 cdef class Element(sage_object.SageObject): cdef ParentWithBase _parent cdef _richcmp_c_impl(left, Element right, int op) cdef int _cmp_c_impl(left, Element right) except -2 cdef public _richcmp(self, right, int op) cdef public _cmp(self, right) cdef _set_parent_c(self, ParentWithBase parent) cdef base_extend_c(self, ParentWithBase R)       # do *NOT* override, but OK to call directly
• ## sage/structure/element.pyx

 r3074 return PyBool_FromLong(self == self._parent(0)) def _richcmp_(left, right, op): return left._richcmp(right, op) cdef _richcmp(left, right, int op): """ Compare left and right. def _cmp_(left, right): return left._cmp(right) cdef _cmp(left, right): """ Compare left and right. """ cdef int r try: _left, _right = canonical_coercion_c(left, right) r = cmp(_left, _right) if PY_IS_NUMERIC(_left): return cmp(_left, _right) else: return _left._cmp_(_right) except TypeError: r = cmp(type(left), type(right)) if r == 0: r = -1 return r else: return left._cmp_c_impl(right) def _richcmp_(left, right, op): return left._richcmp(right, op) cdef _richcmp(left, right, int op): """ Compare left and right, according to the comparison operator op. """ cdef int r if not have_same_parent(left, right): try: _left, _right = canonical_coercion_c(left, right) if PY_IS_NUMERIC(_left): r = cmp(_left, _right) else: return _left._richcmp_(_right, op) except TypeError: r = cmp(type(left), type(right)) if r == 0: r = -1 else: if HAS_DICTIONARY(left):   # fast check r = left.__cmp__(right) else: r = left._cmp_c_impl(right) return left._richcmp_c_impl(right, op) return left._rich_to_bool(op, r) # your subclasses, in order for it to take advantage of the # above generic comparison code.  You must also define # _cmp_c_impl. # either _cmp_c_impl (if your subclass is totally ordered), # _richcmp_c_impl (if your subclass is partially ordered), or both # (if your class has both a total order and a partial order; # then the total order will be available with cmp(), and the partial # order will be available with the relation operators; in this case # you must also define __cmp__ in your subclass). # This is simply how Python works. # return (left)._richcmp(right, op) #################################################################### # If your subclass has both a partial order (available with the # relation operators) and a total order (available with cmp()), # you **must** put the following in your subclass. # # Note that in this case the total order defined by cmp() will # not properly respect coercions. #################################################################### def __cmp__(left, right): return (left)._cmp(right) cdef _richcmp_c_impl(left, Element right, int op): return left._rich_to_bool(op, left._cmp_c_impl(right)) cdef int _cmp_c_impl(left, Element right) except -2: ### For derived SAGEX code, you *MUST* ALSO COPY the __richcmp__ above ### into your class!!!  For Python code just use __cmp__. raise NotImplementedError, "BUG: sort algorithm for elements of '%s' not implemented"%right.parent() def __cmp__(left, right): return left._cmp_c_impl(right)   # default def is_ModuleElement(x):
Note: See TracChangeset for help on using the changeset viewer.