Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168749
Image: ubuntu2004
sage: n=var('n')
sage: a_n=(1+1/n)**n
sage: a_n.limit(n=oo)
e
sage: limit(sin(n*pi/3),n=oo)
ind
sage: limit((n**2-1)/(n+5),n=oo)
+Infinity
sage: x=var('x')
sage: diff(sin(x),x)
cos(x)
sage: diff(sin(x),x,2)
-sin(x)
sage: x,y=var('x,y')
sage: f=x^2*y+x*exp(y)
sage: f.diff(x,y)
2*x + e^y
sage: var('x,a')
(x, a)
sage: f=exp(sin(a-x^2))/x
sage: f.derivative(x)
-2*e^(sin(-x^2 + a))*cos(-x^2 + a) - e^(sin(-x^2 + a))/x^2
sage: x=var('x')
sage: f=sin(x)
sage: taylor(f,x,0,6)
1/120*x^5 - 1/6*x^3 + x
sage: x,y=var('x,y')
sage: f=sin(x*y)
sage: taylor(f,(x,0),(y,-1),4)
-1/2*(y + 1)*x^3 + 1/6*x^3 + (y + 1)*x - x
sage: x=var('x')
sage: integral(x*sin(x**2),x)
-1/2*cos(x^2)
sage: integral(x^2,x,0,1)
1/3
sage: x=var('x')
sage: integral(x**(-2),1,infinity)
1
sage: var('x,k,w')
(x, k, w)
sage: f=x^3*exp(k*x)*sin(w*x)
sage: f.integral(x)
-(((k^6*w + 3*k^4*w^3 + 3*k^2*w^5 + w^7)*x^3 - 24*k^3*w + 24*k*w^3 - 6*(k^5*w + 2*k^3*w^3 + k*w^5)*x^2 + 6*(3*k^4*w + 2*k^2*w^3 - w^5)*x)*e^(k*x)*cos(w*x) - ((k^7 + 3*k^5*w^2 + 3*k^3*w^4 + k*w^6)*x^3 - 6*k^4 + 36*k^2*w^2 - 6*w^4 - 3*(k^6 + k^4*w^2 - k^2*w^4 - w^6)*x^2 + 6*(k^5 - 2*k^3*w^2 - 3*k*w^4)*x)*e^(k*x)*sin(w*x))/(k^8 + 4*k^6*w^2 + 6*k^4*w^4 + 4*k^2*w^6 + w^8)
sage: m=var('m')
sage: sum(1/(m*(m+1)),m,1,oo)
1
sage: sum(1/(m*(m+1)),m,1,10)
10/11
sage: sum(1/(m*(m+1)),m,1,100)
100/101
sage: t=var('t')
sage: x=function('x',t)
sage: a,b=var('a,b')
sage: DE=a*diff(x,t)+b*x-1
sage: desolve(DE,[x,t])
(c + e^(b*t/a)/b)*e^(-b*t/a)
sage: plot(sin,(0,2*pi),color='red')
sage: var('x,p,a')
(x, p, a)
sage: p=plot(sin(x),color=hue(1.0))
sage: for a in range(2,8+1):
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("Zm9yIGEgaW4gcmFuZ2UoMiw4KzEpOg=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmp1ootGK/___code___.py", line 4 ^ IndentationError: expected an indented block
sage: p+=plot(sin(a*x),color=hue(1.0/a))
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("cCs9cGxvdChzaW4oYSp4KSxjb2xvcj1odWUoMS4wL2EpKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpl6iNGe/___code___.py", line 3, in <module> exec compile(u'p+=plot(sin(a*x),color=hue(_sage_const_1p0 /a))' + '\n', '', 'single') File "", line 1, in <module> File "/usr/local/sage2/local/lib/python2.6/site-packages/sage/plot/colors.py", line 1036, in hue return tuple(map(float, hsv_to_rgb(mod_one(h), mod_one(s), mod_one(v)))) File "/usr/local/sage2/local/lib/python2.6/site-packages/sage/plot/colors.py", line 228, in mod_one x = float(x) File "expression.pyx", line 935, in sage.symbolic.expression.Expression.__float__ (sage/symbolic/expression.cpp:5205) TypeError: unable to simplify to float approximation
sage:
sage: p.show(xmin=-1, xmax=1, ymin=-1, ymax=1)
sage: var('t')
t
sage: parametric_plot((1-2*sin(t),t^2),(t,-4,4))
sage: var('x y')
(x, y)
sage: implicit_plot(x^2/4-y^2/9-1,(x,-5,5),(y,-5,5)).show(aspect_ratio=1)
sage: var('a')
a
sage: polar_plot(a/5,(a,0,6*pi),color='green').show(aspect_ratio=1)
sage: var('x,y')
(x, y)
sage: plot3d(x^2/16-y^2/9,(x,-10,10),(y,-10,10))
sage: n=var('n')
sage: limit(exp(n)/n**2,n=oo)
+Infinity
sage: limit((n^2+1)/(2*n+1),n=oo)
+Infinity
sage: var('x')
x
sage: limit(exp(x)/x^2,x=oo)
+Infinity
sage: limit((1+1/x)**x,x=oo)
e
sage: limit((x**2+1)/(2*x+1),x=oo)
+Infinity
sage: diff(x**x,x)
(log(x) + 1)*x^x
sage: var('n x')
(n, x)
sage: diff(sin(n*x)**n,x)
n^2*sin(n*x)^(n - 1)*cos(n*x)
sage: var('x,y')
(x, y)
sage: diff(x*sin(x*y),x)
x*y*cos(x*y) + sin(x*y)
sage: diff(x*sin(x*y),x,y)
-x^2*y*sin(x*y) + 2*x*cos(x*y)
sage: diff(x*sin(x*y),x,y,2)
-x^3*y*cos(x*y) - 3*x^2*sin(x*y)
sage: x=var('x')
sage: integral(1/(4+5*cos(x)),x)
-1/3*log(sin(x)/(cos(x) + 1) - 3) + 1/3*log(sin(x)/(cos(x) + 1) + 3)
sage: integral(sin(x)**2/(1+sin(x)**2),x)
-1/2*sqrt(2)*arctan(sqrt(2)*tan(x)) + arctan(tan(x))
sage: integral(x*exp(x)/(1+x)**2,x)
e^x/(x + 1)
sage: integral(x/cos(x)**2,x,-1/4*pi,1/4*pi)
0
sage: n=var('n')
sage: sum((2*n-1)/2**n,n,1,oo)
3
sage: sum(n**2/2**n,n,1,oo)
6
sage: var('x,m,p')
(x, m, p)
sage: p=plot(x/(1+x**2),color=hue(1.0))
sage: for m in range(2,8+1):
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_33.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Zm9yIG0gaW4gcmFuZ2UoMiw4KzEpOg=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmp4R6kQE/___code___.py", line 4 ^ IndentationError: expected an indented block
sage: p+=plot(m*x/(1+(m*x)**2),color=hue(1.0/m))
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_35.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cCs9cGxvdChtKngvKDErKG0qeCkqKjIpLGNvbG9yPWh1ZSgxLjAvbSkp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpQ3Qy1t/___code___.py", line 3, in <module> exec compile(u'p+=plot(m*x/(_sage_const_1 +(m*x)**_sage_const_2 ),color=hue(_sage_const_1p0 /m))' + '\n', '', 'single') File "", line 1, in <module> File "/usr/local/sage2/local/lib/python2.6/site-packages/sage/plot/colors.py", line 1036, in hue return tuple(map(float, hsv_to_rgb(mod_one(h), mod_one(s), mod_one(v)))) File "/usr/local/sage2/local/lib/python2.6/site-packages/sage/plot/colors.py", line 228, in mod_one x = float(x) File "expression.pyx", line 935, in sage.symbolic.expression.Expression.__float__ (sage/symbolic/expression.cpp:5205) TypeError: unable to simplify to float approximation
sage:
sage: p.show(xmin=0,xmax=4)
sage: var('t')
t
sage: parametric_plot((sin(3*t)*cos(t),sin(3*t)*sin(t)),(t,0,pi))
sage: var('x,y')
(x, y)
sage: implicit_plot(x^2/16+y^2/4-1,(x,-4,4),(y,-2,2)).show(aspect_ratio=1)
sage: var('a')
a
sage: polar_plot(a^2*sin(a^2),color='red').show(aspect_ratio=1)
sage: var('n')
n
sage: limit(ln(1/n),n=oo)
-Infinity
sage: var('x')
x
sage: limit(ln(1/x),x=oo)
-Infinity
sage: diff(ln(x**x),x,2)
1/x
sage: integral(sin(ln(x)),x,1,exp(1))
1/2*e*sin(1) - 1/2*e*cos(1) + 1/2
sage: integral(x^2*ln(x-1),x,1,exp(1)+1)
1/2*e^2 + 2/9*e^3
sage: var('n')
n
sage: sum(ln((n^2+1)/(n^2-1)),n,2,+oo)
-Infinity
sage: n=n;sum=1;
sage: for n in range(1,n+1):
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_73.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Zm9yIG4gaW4gcmFuZ2UoMSxuKzEpOg=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmp2G02Is/___code___.py", line 4 ^ IndentationError: expected an indented block
sage: sum+=n
sage: limit(sum/n^3,n=oo)
0