Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168749
Image: ubuntu2004
a=5
a
5
2==2
True
2>3
False
money=10000
years=0
while money<20000
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("d2hpbGUgbW9uZXk8MjAwMDA="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpaIt9QS/___code___.py", line 3 while money<_sage_const_20000 ^ SyntaxError: invalid syntax
years=years+1
money=money*1.069
years
1
money
10690.0000000000
x=y=z=123
x
123
y
123
z
123
n=var('n')
a_n=(1+1/n)**n
a_n.limit(n=00)
1
limit(sin(n*pi/3),n=00)
0
x=var('x')
diff(sin(x),x)
cos(x)
diff(sin(x),x,2)
-sin(x)
x,y=var('x,y')
f=sin(x*y)
taylor(f,(x,0),(y,-1),4)
-1/2*(y + 1)*x^3 + 1/6*x^3 + (y + 1)*x - x
plot(sin,(0,2*pi),color='red')
p=plot(sin(x),color=hue(1.0))
for a in range(2,8+1):
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_50.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Zm9yIGEgaW4gcmFuZ2UoMiw4KzEpOg=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpZIslj7/___code___.py", line 4 ^ IndentationError: expected an indented block
p+=plot(sin(a*x),color=hue(1.0/a))
p.show(xmin=-1,xmax=1,ymin=-1,ymax=1)
var('x,y')
(x, y)
plot3d(x^2/16-y^2/9,(x,-10,10),(y,-10,10))
m1=matrix(ZZ,[[1,2,3,],[4,5,6]])
m1.parent()
Full MatrixSpace of 2 by 3 dense matrices over Integer Ring
m1
[1 2 3] [4 5 6]
m1/2
[1/2 1 3/2] [ 2 5/2 3]
m2=matrix(QQ,[[1,2,3,],[4,5,6]])
m2.parent()
Full MatrixSpace of 2 by 3 dense matrices over Rational Field
m2
[1 2 3] [4 5 6]
m2/2
[1/2 1 3/2] [ 2 5/2 3]
m3=matrix(RR,[[1,2,3,],[4,5,6]])
m3.parent()
Full MatrixSpace of 2 by 3 dense matrices over Real Field with 53 bits of precision
m3
[1.00000000000000 2.00000000000000 3.00000000000000] [4.00000000000000 5.00000000000000 6.00000000000000]
m3/2
[0.500000000000000 1.00000000000000 1.50000000000000] [ 2.00000000000000 2.50000000000000 3.00000000000000]
A=matrix(QQ,3,range(9));A
[0 1 2] [3 4 5] [6 7 8]
b=matrix(QQ,3,1,[1,2,3]);b
[1] [2] [3]
(8*a)*b.transpose()
[ 40 80 120]
8*(a*transpose(b))
[ 40 80 120]
x=P1.gen()
759
759
y=matrix(RR,[[1,2],[3,4]]);y
[1.00000000000000 2.00000000000000] [3.00000000000000 4.00000000000000]
p(y)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_88.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cCh5KQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpcWlbNQ/___code___.py", line 2, in <module> exec compile(u'p(y)' + '\n', '', 'single') File "", line 1, in <module> TypeError: 'Graphics' object is not callable
lam=2
var('x')
x
p1=plot(lam*e^(-lam*x),(x,0,10))
p2=plot(1-e^(-lam*x),(x,0,10),linestyle="-.")
p=p1+p2
p.show()