Sage/Crash Course

Understanding Objects
To work with Sage you have to know a little bit of Python, because it is the underlying language Sage is written in and it is the language Sage understands!


 * Objects: An object is a data structure with methods that operate on the data inside an object. In Python - and Sage - everything is an object, even the number "1".
 * You can store objects in variables. That is a string of characters where only a-z, A-Z, digits (digits must not be at the first position) and the sign "_" is allowed (e.g. "abs_1"). To accomplish this, enter "x=1" and indicate with "Shift-Return/Enter" that you have ended your input.
 * To access the data (the object's value) behind the variable, you have to enter it and probably write "print" in front of it.
 * The methods of an object can be accessed via the "." sign and then comes the name and parenthesis "(...)", where they can be empty or have arguments.
 * The data stored inside an object is accessed similarly just by the "." and the name but with no parenthesis.
 * Functions are objects that do not need an object.

Example:


 * Objects can be combined with others:
 * using an operator sign like "+", "*", ...
 * inserting them into the argument list of a method or function

Example: