Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168746
Image: ubuntu2004
a=5
a
5
2==2
True
2>3
False
2**3
8
5/2
5/2
5//2
2
18%5
3
012
10
09
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_11.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("MDk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmptfu6nB/___code___.py", line 2 _sage_const_09 = Integer(09) ^ SyntaxError: invalid token
sin?

File: /usr/local/sage2/local/lib/python2.6/site-packages/sage/functions/trig.py

Type: <class ‘sage.functions.trig.Function_sin’>

Definition: sin(*args, coerce=True, hold=False, dont_call_method_on_arg=False)

Docstring:

The sine function.

EXAMPLES:

sage: sin(0)
0
sage: sin(x).subs(x==0)
0
sage: sin(2).n(100)
0.90929742682568169539601986591
sage: loads(dumps(sin))
sin
def is_even(n):
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_26.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZGVmIGlzIGV2ZW46"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmppgjYY_/___code___.py", line 2 def is even: ^ SyntaxError: invalid syntax
return n%2==0
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_14.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cmV0dXJuIG4lMj09MA=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpIo6jdm/___code___.py", line 3 return n%_sage_const_2 ==_sage_const_0 SyntaxError: 'return' outside function
def is_even(n): return n%2==0 is even(123)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_27.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZGVmIGlzX2V2ZW4obik6CiAgIHJldHVybiBuJTI9PTAKaXMgZXZlbigxMjMp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmp0PLcfu/___code___.py", line 5 is even(_sage_const_123 ) ^ SyntaxError: invalid syntax
def is even: is even(123)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_16.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZGVmIGlzIGV2ZW46CiByZXR1cm4gbiUyPT0wCmlzIGV2ZW4oMTIzKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmptqLJGY/___code___.py", line 3 def is even: ^ SyntaxError: invalid syntax
def is even: return n%2==0 is even(2)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_17.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZGVmIGlzIGV2ZW46CiAgIHJldHVybiBuJTI9PTAKaXMgZXZlbigyKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpBYPPIu/___code___.py", line 3 def is even: ^ SyntaxError: invalid syntax
def is even: return n%2==0 is even(2)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_18.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZGVmIGlzIGV2ZW46CnJldHVybiBuJTI9PTAKaXMgZXZlbigyKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpKsQPIR/___code___.py", line 3 def is even: ^ SyntaxError: invalid syntax
teacher tell me why?haw to do this example...
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_19.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("dGVhY2hlciB0ZWxsIG1lIHdoeT9oYXcgdG8gZG8gdGhpcyBleGFtcGxlLi4u"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmp1ZP6Rj/___code___.py", line 2 teacher tell me why?haw to do this exampleEllipsis ^ SyntaxError: invalid syntax
def is even(n): return n%2==0 is even(2)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_20.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZGVmIGlzIGV2ZW4obik6CiAgICByZXR1cm4gbiUyPT0wCgppcyBldmVuKDIp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpYeO6e0/___code___.py", line 3 def is even(n): ^ SyntaxError: invalid syntax
sage: def is-divisible-by(number,divisor=2): ....: return number%divisor==0 ....: sage: is-divisible-by(123,5)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_22.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZGVmIGlzLWRpdmlzaWJsZS1ieShudW1iZXIsZGl2aXNvcj0yKToKICAgcmV0dXJuIG51bWJlciVkaXZpc29yPT0wCgppcy1kaXZpc2libGUtYnkoMTIzLDUp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpVYfs6D/___code___.py", line 3 def is-divisible-by(number,divisor=_sage_const_2 ): ^ SyntaxError: invalid syntax
sage: def is_divisible_by(number,divisor=2): ....: return number%divisor==0 ....: sage: is-divisible-by(123,5)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_25.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZGVmIGlzX2RpdmlzaWJsZV9ieShudW1iZXLvvIxkaXZpc29yPTIpOgogICByZXR1cm4gbnVtYmVyJWRpdmlzb3I9PTAKCmlzLWRpdmlzaWJsZS1ieSgxMjPvvIw1KQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpFRpXpp/___code___.py", line 3 def is_divisible_by(number,divisor=_sage_const_2 ): ^ SyntaxError: invalid syntax
if expression: if_suite else: else_suite elif expressionl: elif_suite
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_24.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("aWYgZXhwcmVzc2lvbjoKICAgaWZfc3VpdGUKZWxzZTogCiAgIGVsc2Vfc3VpdGUKZWxpZiBleHByZXNzaW9ubDoKICAgZWxpZl9zdWl0ZQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpglk57v/___code___.py", line 6 elif expressionl: ^ SyntaxError: invalid syntax
if expression: if_suite else: else_suite elif expressionl: elif_suite def myfaction(x): if x<0: retrun -1 elif x==0: return 0 else: return 1 myfunction(-2)
Traceback (most recent call last): def myfaction(x): File "", line 1, in <module> File "/tmp/tmpuSTa2q/___code___.py", line 7 elif expressionl: ^ SyntaxError: invalid syntax