11.07.2015 Views

Cryptography - Sage

Cryptography - Sage

Cryptography - Sage

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

sage: x = 2sage: type(x)sage: y = 2/1sage: type(y)sage: z = ’2’sage: type(z)The class of an object determines which functions apply to it. The printing of an objectdoes not in general determine the object itself.Each class of object has special member functions which apply to it; the result dependson the function definition. A member function is called by typing the object name, a ’.’,followed by the function name and any arguments it takes in parentheses. For instance,the integer 2 is not a unit in Z, since there is no element 1/2 in Z. In contrast, the element2 as a rational number is a unit.sage: x.is_unit()Falsesage: y.is_unit()TrueAn easy way to determine what member functions exist is to type the first few charactersand a TAB to see what functions complete it:sage: x.isx.is_nilpotent x.is_prime x.is_squarefree x.is_zerox.is_one x.is_square x.is_unit x.isqrtsage: x.isTo determine what a function does, type (the object, ’.’, and) the function name, followedby a ? (and return):89

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!