Tutorial Release 10.4 The Sage Development Team https://doc.sagemath.org/pdf/en/tutorial/sage_tutorial.pdf
Sage is free, open-source math software that supports research and teaching in algebra, geometry, number theory, cryptography, numerical computation, and related areas. Both the Sage development model and the technology in Sage itself are distinguished by an extremely strong emphasis on openness, community, cooperation, and collaboration: we are building the car, not reinventing the wheel. The overall goal of Sage is to create a viable, free, open-source alternative to Maple, Mathematica, Magma, and MATLAB.
This tutorial is the best way to become familiar with Sage in only a few hours. 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).
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.
ubuntu2204
A GUIDED TOUR
This section is a guided tour of some of what is available in Sage. For many more examples, see "Sage Constructions", which is intended to answer the general question "How do I construct ...?". See also the "Sage Reference Manual", which has thousands more examples. Also note that you can interactively work through this tour in the Sage notebook by clicking the Help link.
(If you are viewing the tutorial in the Sage notebook, press Shift-Enter
to evaluate any input cell. You can even edit the input before pressing Shift-Enter
. On some Macs, you might have to press Shift-Return
rather than Shift-Enter
.)
2.1 Assignment, Equality, and Arithmetic
With some minor exceptions, Sage uses the Python programming language, so most introductory books on Python will help you to learn Sage.
Sage uses for assignment. It uses , , , , and for comparison:
Sage provides all of the basic mathematical operations:
The computation of an expression like depends on the order in which the operations are applied; this is specified in the "operator precedence table" in Arithmetical binary operator precedence.
Sage also provides many familiar mathematical functions; here are just a few examples: