Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168747
Image: ubuntu2004
a=5
a
5
2==2
True
2>3
False
2**3
8
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_12.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/tmpFwYYbX/___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): return n%2==0
is_even(2)
True
is_even(123)
False
def is_divisible_by(number,divisor=2): return number%divisor==0
is_divisible_by(123,5)
False
is_divisible_by(123)
False
def myfunction(x): if x<0: return -1 elif x==0: return 0 else: return 1
myfunction(-2)
-1
myfunction(0)
0
myfunction(3)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_8.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("bXlmdW5jdGlvbigzKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpoCGE4A/___code___.py", line 3, in <module> exec compile(u'myfunction(_sage_const_3 )' + '\n', '', 'single') File "", line 1, in <module> NameError: name 'myfunction' is not defined
money=10000
years=0
while money<20000: years=years+1 money=money*1.069
years
money