| 1 | initial version |
This is the way to apply a method to an object.
Very often, instead of f(x), the notation in Python, and therefore in SageMath,
will be x.f().
Follow a Python tutorial or a Sage tutorial to learn more.
In the example you mention, sol[0] is an equation,
and to extract its right-hand side, you apply the method "rhs" to it,
by doing sol[0].rhs().
This is very efficient, especially when you need to apply several operations in a row.
For example, starting from a graph, say you want to compute its adjacency matrix, then get the characteristic polynomial of this matrix, then factor this polynomial.
You can do g.adjacency_matrix().charpoly().factor(), which maybe better
shows the sequence of operations, and avoids nested parenthesis, if you compare
to writing factor(charpoly(adjacency_matrix(g))).
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.