CoCalc Public Fileswww / talks / 2006-05-04-sage-uw-intro / ex.sage
Author: William A. Stein
1mathematica('N[Gamma[Pi + I]]')       # optional
2G = mathematica('Plot3D[Sin[x]*Cos[y],{x,2,10},{y,2,10}]');
3_ = G.show()
4gp.zeta(2)       # number theory
5gp.factor(2006)
6f = maxima('x*sin(x)^2').integral('x'); f    # calculus
7maple.eval('solve({ 2*x + 3*y = 1, 3*x + 5*y = 1 })')
8A = MatrixSpace(QQ,3)([1,2,3, 4,5,6, 8,10,12]); A
9A.charpoly().factor()
10V = QQ^3
11E = End(V); t = E(A); t
12print latex(A)
13P.<x,y,z,w> = ProjectiveSpace(3,QQ)
14C = P.subscheme([y^2-x*z, z^2-y*w, x*w-y*z])
15len(C.irreducible_components())   # twisted cubic
16J = C.defining_ideal()
17G = J.groebner_fan()
18len(G.reduced_groebner_bases())
19G.fvector()
20f = prod(J.gens())     # \/-- newton polytope
21NP = polymake.convex_hull(f.exponents())
22NP.facets()
23R.<t> = PowerSeriesRing(QQ, 't')
24f = 1/(1-t)
25f
26print latex(f)
27view(f)
28E = EllipticCurve('37a')
29v = E.Lseries_values_along_line(1, 1+10*I, 300)
30w = [(z[1].real(), z[1].imag()) for z in v]
31L = line(w, rgbcolor=(0.5,0,0))
32L.save('line.png')
33V = VectorSpace(QQ, 5)
34W = V.submodule([[1,2,3,4,5],[2,3,4,5,3]]); W
35W.save('W')