| Hosted by CoCalc | Download
(x+2)^2
(x + 2)^2
expand((x+2)^10)
x^10 + 20*x^9 + 180*x^8 + 960*x^7 + 3360*x^6 + 8064*x^5 + 13440*x^4 + 15360*x^3 + 11520*x^2 + 5120*x + 1024
fibonacci(45)
1134903170
%python fibonacci(234)
3577855662560905981638959513147239988861837901112
fibonacci(234)/fibonacci(233).n()
1.61803398874989
23+90
113
%python def foo(x): return(x*x) foo(100)
10000
var('y') expand((x+y)^5)
y x^5 + 5*x^4*y + 10*x^3*y^2 + 10*x^2*y^3 + 5*x*y^4 + y^5
x12+y12 =z 12
x12+y 12 ≠ z12
diff(exp(x^2), x)
2*x*e^(x^2)
integrate(exp(-x^2), x)
1/2*sqrt(pi)*erf(x)

Test

expand((x+10)^20) g = graphs.RandomGNM(15, 20) # 15 vertices and 20 edges show(g) g.incidence_matrix() show(graphs.PetersenGraph()) graphs.PetersenGraph()
x^20 + 200*x^19 + 19000*x^18 + 1140000*x^17 + 48450000*x^16 + 1550400000*x^15 + 38760000000*x^14 + 775200000000*x^13 + 12597000000000*x^12 + 167960000000000*x^11 + 1847560000000000*x^10 + 16796000000000000*x^9 + 125970000000000000*x^8 + 775200000000000000*x^7 + 3876000000000000000*x^6 + 15504000000000000000*x^5 + 48450000000000000000*x^4 + 114000000000000000000*x^3 + 190000000000000000000*x^2 + 200000000000000000000*x + 100000000000000000000
d3-based renderer not yet implemented
[1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 0 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0] [0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0] [0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0] [0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1] [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1] [0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0] [0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0]
d3-based renderer not yet implemented
Petersen graph: Graph on 10 vertices
%md ## This is the Fall Class

This is the Fall Class

prime_range(1000)
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
show(graphs.PetersenGraph()) show(graphs.PetersenGraph()) g = graphs.RandomGNM(15, 20) # 15 vertices and 20 edges show(g)(3987^12+4365^12) g.incidence_matrix() graphs.PetersenGraph()
d3-based renderer not yet implemented
d3-based renderer not yet implemented
d3-based renderer not yet implemented
Error in lines 4-4 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1043, in execute exec compile(block+'\n', '', 'single', flags=compile_flags) in namespace, locals File "", line 1, in <module> TypeError: 'NoneType' object is not callable
100!
Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 968, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "<string>", line 1 Integer(100)! ^ SyntaxError: invalid syntax
factorial(100)
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
((3987^12+4365^12)^(1/12)).n()
4472.00000000706
4472^12-3978^12-4365^12
431665707951537682131871304076320971178575
factorial(100)
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
factorial(10)
3628800
factorial(100)
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
2^50
1125899906842624
2^30
1073741824
2^20
1048576
1073741824*1048576
1125899906842624
%md # I am talking to Sudip

I am talking to Sudip

G=Graph() G.add_edge(('A','B'))
G.show()
G.show()
G1=Graph() G1.add_edge(('A','B')) G1.add_edge(('A','C')) G1.add_edge(('B','D')) G1.add_edge(('D','E')) G1.show()
G2=Graph() G2.add_edge(('A','B')) G2.add_edge(('A','C')) G2.add_edge(('A','D')) G2.add_edge(('A','E')) G2.add_edge(('A','F')) G2.add_edge(('B','C')) G2.add_edge(('B','D')) G2.add_edge(('B','F')) G2.add_edge(('C','F')) G2.show()
set_random_seed(0) gnp = graphs.RandomGNP(5,.5) gnp.show()
ba = graphs.RandomBarabasiAlbert(200,3) ba.order(), ba.size()
(200, 591)
hh=ba.degree_sequence()
from sage.plot.histogram import Histogram
histogram(hh,bins=200)
hh
[41, 29, 29, 23, 21, 21, 20, 19, 17, 16, 15, 15, 15, 14, 14, 14, 14, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
baa = graphs.RandomBarabasiAlbert(1000,4)
hhh=baa.degree_sequence()
histogram(hhh,bins=100)