Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Github repo cloud-examples: https://github.com/sagemath/cloud-examples

Views: 7963
License: MIT

Sage Basics

Evaluate all cells via pressing the Shift+Return keys or the small “play” button in the menu.

x = var('x') solve(2*x^2 + 3 * x - 10 == 0, x)
[x == -1/4*sqrt(89) - 3/4, x == 1/4*sqrt(89) - 3/4]
# expressions var('x y z') ex1 = 2 * x / (1 + x + y ^2) * sin(x*z) ex2 = ex1 / x / sin(x*z) show(ex1) show(ex2) ︠3f2d7a03-8b3d-47f8-980a-79bda1f390e8︠ phi = var('phi') find_root(cos(phi) * sin(tan(phi - pi/2)) == sqrt(phi), 0, 2 * pi)
0.2637894422530672
diff(sin(x^2), x, 4)
16*x^4*sin(x^2) - 48*x^2*cos(x^2) - 12*sin(x^2)
A = Matrix(ZZ, [[1,2,-3],[3,2,1],[1,1,1]]) A.inverse()
[-1/6 5/6 -4/3] [ 1/3 -2/3 5/3] [-1/6 -1/6 2/3]
A2 = A.change_ring(RDF) A2.inverse()
[-0.166666666667 0.833333333333 -1.33333333333] [ 0.333333333333 -0.666666666667 1.66666666667] [-0.166666666667 -0.166666666667 0.666666666667]
v = vector(ZZ, [-4, 0, 1]) s = A \ v s
(-2/3, 1/3, 4/3)
v == A * s
True
A.echelon_form()
[1 0 5] [0 1 2] [0 0 6]
E = EllipticCurve('131a') E.plot()
bessel_J(2.1,1, 'pari', 250)
0.097838255257252160061715725960235803678515571060227678839771094653725501184
show(sum(plot(lambda x : bessel_J(x, k), (x, -pi, 3 * pi), color=Color((k/5.,1-k/5., 1))) for k in range(1,5)))