{{{id=1| ring r1 = 0,(t,x,y,z),ls; /// ring r1 = 0,(t,x,y,z),ls; }}} {{{id=4| r1 ideal i1 = x-t2,y-t3,z; /// Traceback (most recent call last): File "", line 1, in File "_sage_input_8.py", line 10, in exec compile(u"print _support_.syseval(singular, u'i1.category', __SAGE_TMP_DIR__)" + '\n', '', 'single') File "", line 1, in File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sagenb-0.8.2-py2.6.egg/sagenb/misc/support.py", line 473, in syseval return system.eval(cmd, sage_globals, locals = sage_globals) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/interfaces/singular.py", line 549, in eval raise RuntimeError, 'Singular error:\n%s'%s RuntimeError: Singular error: i1[1]=x-t2 i1[2]=y-t3 i1[3]=z ? error occurred in or before STDIN line 31: `i1.category;` skipping text from `category` }}} {{{id=5| i1.show /// Traceback (most recent call last): File "", line 1, in File "_sage_input_10.py", line 10, in exec compile(u"print _support_.syseval(singular, u'i1.show', __SAGE_TMP_DIR__)" + '\n', '', 'single') File "", line 1, in File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sagenb-0.8.2-py2.6.egg/sagenb/misc/support.py", line 473, in syseval return system.eval(cmd, sage_globals, locals = sage_globals) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/interfaces/singular.py", line 549, in eval raise RuntimeError, 'Singular error:\n%s'%s RuntimeError: Singular error: i1[1]=x-t2 i1[2]=y-t3 i1[3]=z ? error occurred in or before STDIN line 35: `i1.show;` skipping text from `show` }}} {{{id=43| R. = PolynomialRing(QQ) /// }}} {{{id=44| R.objgens() /// (Multivariate Polynomial Ring in r, s, t over Rational Field, (r, s, t)) }}} {{{id=6| def cuberoot2(c, prec): x = 1 count = 0 while (abs(x^3-c) > prec): x = (2*x^3+c)/(3*x^2) count = count + 1 print 'did %s loops'%(count) return n(x); /// }}} {{{id=7| time cuberoot2(500, 10^(-6)) /// did 13 loops 7.93700525984100 Time: CPU 7.92 s, Wall: 8.26 s }}} {{{id=8| def cuberoot1(c, prec): s = sign(c); c = abs(c); a = 0; b = max(c, 1); count = 0; while (b-a > prec): m = (a+b)/2; if (m^3 < c): a = m else: b = m count = count + 1 print 'did %s loops'%(count) return n(s*m); /// }}} {{{id=41| numerical_approx(pi) /// 3.14159265358979 }}} {{{id=42| pari('factor(15)') /// [3, 1; 5, 1] }}} {{{id=9| time cuberoot1(500, 10^(-6)) /// did 29 loops 7.93700572103262 Time: CPU 0.00 s, Wall: 0.00 s }}} {{{id=12| poly = sum(Integer(round(random()*1000)))*x^i, i in range(10)); /// Traceback (most recent call last): File "", line 1, in File "_sage_input_61.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cG9seSA9IHN1bShJbnRlZ2VyKHJvdW5kKHJhbmRvbSgpKjEwMDApKSkqeF5pLCBpIGluIHJhbmdlKDEwKSk7"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in File "/tmp/tmpbgDyXs/___code___.py", line 3 poly = sum(Integer(round(random()*_sage_const_1000 )))*x**i, i in range(_sage_const_10 )); ^ SyntaxError: invalid syntax }}} {{{id=13| add(range(5)) /// 10 }}} {{{id=14| p1 = PolynomialRing(QQ, 'x').random_element(degree=200) /// }}} {{{id=16| type(p1) /// }}} {{{id=15| v = var('v') p2 = p1 + v - v /// }}} {{{id=17| type(p2) /// }}} {{{id=18| time t1 = p1*p1 /// Traceback (most recent call last): File "", line 1, in File "_sage_input_100.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("dCA9IHRpbWUgdDEgPSBwMSpwMQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in File "/tmp/tmpg51FF9/___code___.py", line 2 t = time t1 = p1*p1 ^ SyntaxError: invalid syntax }}} {{{id=19| time t2 = expand(p2*p2) /// Time: CPU 0.48 s, Wall: 0.48 s }}} {{{id=20| expand(t1-t2) /// 0 }}} {{{id=21| def time_polymult(deg): res = []; d = 1; while (d < deg): p1 = PolynomialRing(QQ, 'x').random_element(degree=d) p2 = PolynomialRing(QQ, 'x').random_element(degree=d) t = cputime() p1 = p1*p2 res.append((d,cputime(t))) d = ceil(11/10*d) return res /// }}} {{{id=22| timing = time_polymult(5000) /// }}} {{{id=23| plot_step_function(timing) /// }}} {{{id=24| time mathematica(p1*p2) /// WARNING: Output truncated! full_output.txt Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in ignored Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in ignored Traceback (most recent call last): File "", line 1, in File "_sage_input_141.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("dGltZSBtYXRoZW1hdGljYShwMSpwMik="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in File "/tmp/tmpN60Kig/___code___.py", line 2, in exec compile(u'__time__=misc.cputime(); __wall__=misc.walltime(); mathematica(p1*p2); print "Time: CPU %.2f s, Wall: %.2f s"%(misc.cputime(__time__), misc.walltime(__wall__))' + '\n', '', 'single') File "", line 1, in File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/interfaces/expect.py", line 1034, in __call__ return self._coerce_from_special_method(x) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/interfaces/expect.py", line 1058, in _coerce_from_special_method return (x.__getattribute__(s))(self) File "sage_object.pyx", line 542, in sage.structure.sage_object.SageObject._mathematica_ (sage/structure/sage_object.c:5739) File "expression.pyx", line 423, in sage.symbolic.expression.Expression._interface_ (sage/symbolic/expression.cpp:3239) File "sage_object.pyx", line 379, in sage.structure.sage_object.SageObject._interface_ (sage/structure/sage_object.c:3374) File "sage_object.pyx", line 547, in sage.structure.sage_object.SageObject._mathematica_init_ (sage/structure/sage_object.c:5832) File "expression.pyx", line 462, in sage.symbolic.expression.Expression._interface_init_ (sage/symbolic/expression.cpp:3510) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) ... args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 214, in __call__ return self.arithmetic(ex, operator) File "/home/ckoutsch/sage-4.5.3/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 505, in arithmetic args = ["(%s)"%self(op) for op in ex.operands()] File "expression.pyx", line 3568, in sage.symbolic.expression.Expression.operands (sage/symbolic/expression.cpp:16014) File "pynac.pyx", line 948, in sage.symbolic.pynac.py_numer (sage/symbolic/pynac.cpp:8561) RuntimeError: maximum recursion depth exceeded in __instancecheck__ }}} {{{id=26| test = 3 /// }}} {{{id=25| test.str() /// '3' }}} {{{id=28| 2.sqrt().n() /// 1.41421356237310 }}} {{{id=29| def f(x): return x^2 /// }}} {{{id=30| type(f) /// }}} {{{id=31| g(x,y) = x^2+y^3 /// }}} {{{id=32| type(g(x)) /// }}} {{{id=33| h = function('h', x) /// }}} {{{id=34| g.diff() /// x |--> 2*x }}} {{{id=35| desolve(diff(h,x)+h-1, [h,x]) /// (c + e^x)*e^(-x) }}} {{{id=36| p1 = plot(f, (-2,2)) /// }}} {{{id=37| p2 = circle((0,0), 1, rgbcolor=(1,1,0)) /// }}} {{{id=38| show(p1+p2) /// }}} {{{id=39| R = PolynomialRing(QQ, 2, "xy") R /// Multivariate Polynomial Ring in x, y over Rational Field }}} {{{id=45| x,y = R.gens() /// }}} {{{id=46| f = x^2+y^2+1; g = x^3+2*x*y-y^3 /// }}} {{{id=47| id1 = (f,g)*R /// }}} {{{id=48| id1.groebner_basis() /// [y^4 - 3/2*x*y + y^2 + x - y + 1/2, x*y^2 + y^3 - 2*x*y + x, x^2 + y^2 + 1] }}} {{{id=49| x = var('x') def ff(x): if x<2: return 0 else: return x-2 /// }}} {{{id=50| plot(ff, (0, 4)) /// }}} {{{id=51| x /// x }}} {{{id=52| /// }}}