CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

| Download
Views: 40
Image: ubuntu2204
Kernel: SageMath 10.1
xmax = 2 ; n = 4 g=plot(x, x, -xmax, xmax) for d in [1..n]: g += plot(x^(2*d+1), x, -xmax, xmax, color=(5*d/(2*n), 1.5*d/(2*n), 1-2*d/(4*n))) g.show(ymin=-2, ymax=2)
Image in a Jupyter notebook
numerical_approx(sin(pi^2)/log(2))
-0.620793431854518
x,y,z=var('x,y,z') f=x^5*y^7*z^9+1 f(x=25,y=26,z=27)
598118666777330017848750000001
L=list(filter(is_prime,[1..1000])) Q=[t^2 for t in L if is_prime(t)] Q[len(Q):]=['Last'] Q[0:0]=['First'] Q[2:2]=[0]
L=[1,[2,[3]],[4,[[5],6]]] L[2][1][0]
[5]
R=PolynomialRing(QQ,'x,y,z') x,y,z=R.gens() f=x*y*z^2+y*z^2+x*z+x+1 f.degree()
4
R=PolynomialRing(QQ,'x,y,z') x,y,z=R.gens() f=x*y*z^2+y*z^2+x*z+x+1 L=f.monomials() L[0]
x*y*z^2
R=PolynomialRing(QQ,'x,y,z') x,y,z=R.gens() f=x*y*z^2+y*z^2+x*z+x+1 G=f.coefficients() G[0]
1
L[0]/G[0]
x*y*z^2
f=x+2*x^2+3*x^3+4*x^4+5*x^5+6*x^6+7*x^7+8*x^8+9*x^9+10*x^10 g=1+3*x^3+5*x^5+7*x^7+9*x^9 f*g
90*x^19 + 81*x^18 + 142*x^17 + 126*x^16 + 160*x^15 + 139*x^14 + 148*x^13 + 124*x^12 + 100*x^11 + 86*x^10 + 61*x^9 + 45*x^8 + 29*x^7 + 20*x^6 + 11*x^5 + 7*x^4 + 3*x^3 + 2*x^2 + x
m,n=var('m,n') V=500*(1+0.02/(m))^(m*n) V(m=1)
500*1.02000000000000^n
V(m=2)
500*1.01000000000000^(2*n)
V(m=4)
500*1.00500000000000^(4*n)
V(m=12)
500*1.00166666666667^(12*n)
V(m=365)
500*1.00005479452055^(365*n)
i,j=var('i,j') i=1 j=0 while i<=99: j=j+i i=i+2 print(i,j)
101 2500
i,j=var('i,j') i=200 j=300 if( i<1000 or j<200): if(i<100): i=i+j else: if(j<300): j=i+2 else: j=i else: if(i<100): i=i+j else: if(j<300): j=i+2 else: j=i+3 print(i,j)
200 200
p=var('p') p=0 for i in range(100,1001): p=p+i p
495550
#Use loop to define functions for (a) t(a,d,n)=a+(a+d)+(a+2d)+...+(a+(n-1)d) and (a) s(a,r,n)=a+(ar)+(ar2)+...+(ar(n-1)) if r≠1. def f(a,d,n): b=1 s=0 for i in range(0,n): b=a+i*d s=s+b print(b) return s f(1,2,3)
1 3 5
9
a,r,n=var('a,r,n') def S(a,r,n): b=0 s=0 for i in range(0,n): b=a*r^i s+=b print(b) return s S(1,2,3)
1 2 4
7