简介
阅读本教程的全部内容最多只需要3、4个小时。你可以阅读HTML或PDF版本,或者在Sagenotebook中点击Help
,再点击Tutorial
,边阅读边使用Sage。
虽然Sage主要是基于Python实现的,但是不懂Python也可以阅读本教程。如果你想要学习一下Python(一种非常有趣的语言),网上也有很多关于Python的优秀资源,比如PyT 和Dive。如果你只是想快速的尝试一下Sage,阅读本教程就对了。下面是一些例子:
sage: 2 + 2
4
sage: factor(-2007)
-1 * 3^2 * 223
sage: A = matrix(4,4, range(16)); A
[ 0 1 2 3]
[ 4 5 6 7]
[ 8 9 10 11]
[12 13 14 15]
sage: factor(A.charpoly())
x^2 * (x^2 - 30*x - 80)
sage: m = matrix(ZZ,2, range(4))
sage: m[0,0] = m[0,0] - 3
sage: m
[-3 1]
[ 2 3]
sage: E = EllipticCurve([1,2,3,4,5]);
sage: E
Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5
over Rational Field
sage: E.anlist(10)
[0, 1, 1, 0, -1, -3, 0, -1, -3, -3, -3]
sage: E.rank()
1
sage: k = 1/(sqrt(3)*I + 3/4 + sqrt(73)*5/9); k
36/(20*sqrt(73) + 36*I*sqrt(3) + 27)
sage: N(k)
0.165495678130644 - 0.0521492082074256*I
sage: N(k,30) # 30 "比特/位"
0.16549568 - 0.052149208*I
sage: latex(k)
\frac{36}{20 \, \sqrt{73} + 36 i \, \sqrt{3} + 27}