Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for Blaec (CSO) Tasks and Strategy Outline.
Download

Sage Tutorial Chapter 1 Introduction

31 views
ubuntu2204
Kernel: SageMath 10.4

CHAPTER ONE

INTRODUCTION

This tutorial should take at most 3-4 hours to fully work through. You can read it in HTML or PDF versions, or from the Sage notebook click Help, then click Tutorial to interactively work through the tutorial from within Sage.

Though much of Sage is implemented using Python, no Python background is needed to read this tutorial. You will want to learn Python (a very fun language!) at some point, and there are many excellent free resources for doing so: the Python Beginner’s Guide lists many options. If you just want to quickly try out Sage, this tutorial is the place to start. For example:

2 + 2
4
factor(-2007)
-1 * 3^2 * 223
A = matrix(4,4, range(16)); A
[ 0 1 2 3] [ 4 5 6 7] [ 8 9 10 11] [12 13 14 15]
factor(A.charpoly())
x^2 * (x^2 - 30*x - 80)
m = matrix(ZZ,2, range(4)) m[0,0] = m[0,0] - 3 m
[-3 1] [ 2 3]
E = EllipticCurve([1,2,3,4,5]); E
Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field
E.anlist(10)
[0, 1, 1, 0, -1, -3, 0, -1, -3, -3, -3]
E.rank()
1
k = 1/(sqrt(3)*I + 3/4 + sqrt(73)*5/9); k
36/(20*sqrt(73) + 36*I*sqrt(3) + 27)
N(k)
0.165495678130644 - 0.0521492082074256*I
N(k,30)
0.16549568 - 0.052149208*I
latex(k)
\frac{36}{20 \, \sqrt{73} + 36 i \, \sqrt{3} + 27}
from sage.all import * Integer(2) + Integer(2)
4
factor(-Integer(2007))
-1 * 3^2 * 223
A = matrix(Integer(4),Integer(4), range(Integer(16))); A
[ 0 1 2 3] [ 4 5 6 7] [ 8 9 10 11] [12 13 14 15]
factor(A.charpoly())
x^2 * (x^2 - 30*x - 80)
m = matrix(ZZ,Integer(2), range(Integer(4))) m[Integer(0),Integer(0)] = m[Integer(0),Integer(0)] - Integer(3) m
[-3 1] [ 2 3]
E = EllipticCurve([Integer(1),Integer(2),Integer(3),Integer(4),Integer(5)]); E
Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field
E.anlist(Integer(10))
[0, 1, 1, 0, -1, -3, 0, -1, -3, -3, -3]
E.rank()
1
k = Integer(1)/(sqrt(Integer(3))*I + Integer(3)/Integer(4) + sqrt(Integer(73))*Integer(5)/Integer(9)); k
36/(20*sqrt(73) + 36*I*sqrt(3) + 27)
N(k)
0.165495678130644 - 0.0521492082074256*I
N(k,Integer(30))
0.16549568 - 0.052149208*I
latex(k)
\frac{36}{20 \, \sqrt{73} + 36 i \, \sqrt{3} + 27}