Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168742
Image: ubuntu2004
x=var('x') n=var('n') n=8 f=sqrt(x) p1=plot(f,(x,0,4)) p1
x=var('x') n=var('n') n=8 f=sqrt(x) p1=plot(f,(x,0,4)) for i in range(0,n,1):p1+=polygon([(i/2,0), (i/2+4/n,0), (i/2+4/n,f(i/2+4/n)), (i/2,f(i/2+4/n))], rgbcolor=(1/8,3/4,1/2)) p1
__main__:1: DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...)
import numpy import pylab t = numpy.arange(0.0, 1.0, 0.01) s = numpy.cos(2*2*numpy.pi*t) z = numpy.sin(2*2*numpy.pi*t) pylab.plot(t, s, 'ro-', t, z, 'bx-') pylab.xlabel('time (s)') pylab.ylabel('voltage (mV)') pylab.title('About as simple as it gets, folks') pylab.grid(True) pylab.savefig('simple_plot') pylab.legend(('sin','cos')) pylab.show()
u, v = var('u,v') fx = (1+cos(v))*cos(u) fy = (1+cos(v))*sin(u) fz = -tanh((2/3)*(u-pi))*sin(v) parametric_plot3d([fx, fy, fz], (u, 0, 2*pi), (v, 0, 2*pi), frame=False, color="red")
a=var('a') b=var('b') c=var('c') x = -1/2*(b + sqrt(-4*a*c + b^2))/a
x
-1/2*(b + sqrt(-4*a*c + b^2))/a
var('a b c d')
(a, b, c, d)
-1/2*(b + sqrt(-4*a*c + b^2))/a
-1/2*(b + sqrt(-4*a*c + b^2))/a
q = solve(a*x^2+b*x+c==0,x);q
[-1/2*(b + sqrt(-4*a*c + b^2))/a == -1/2*(b + sqrt(-4*a*c + b^2))/a]
show(q[0])
\newcommand{\Bold}[1]{\mathbf{#1}}-\frac{1}{2} \, \frac{{\left(b + \sqrt{-4 \, a c + b^{2}}\right)}}{a} = -\frac{1}{2} \, \frac{{\left(b + \sqrt{-4 \, a c + b^{2}}\right)}}{a}
var('a1 b1 c1 d1')
(a1, b1, c1, d1)
d1 = solve(a1*x^2+b1*x+c1==0,x);d1
[]
show(d1)
\newcommand{\Bold}[1]{\mathbf{#1}}\left[\right]
q = solve(a*x^3+b*x^2+c*x+d==0,x);q
[]
show(q[0].simplify_full())
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_18.py", line 9, in <module> exec compile(ur'open("___code___.py","w").write("# -*- coding: utf-8 -*-\n" + _support_.preparse_worksheet_cell(base64.b64decode("c2hvdyhxWzBdLnNpbXBsaWZ5X2Z1bGwoKSk="),globals())+"\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpBNvZaB/___code___.py", line 3, in <module> exec compile(ur'show(q[_sage_const_0 ].simplify_full())' + '\n', '', 'single') File "", line 1, in <module> IndexError: list index out of range
var('a b c d');show(sqrt(a+sqrt(b+sqrt(c+sqrt(d)))))
(a, b, c, d)(a, b, c, d) <html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}\sqrt{a + \sqrt{b + \sqrt{c + \sqrt{d
}}}
var('u v');plot3d(sin(u^2) - cos(v^2), (u,-2,2),(v,-2,2))
(u, v)