Every function must have a docstring that includes the following information:
int.
ALGORITHM: Uses Pari.
def point(self, x=1, y=2):
r"""
This function returns the point $(x^5,y)$.
INPUT:
x -- integer (default: 1) the ...
y -- integer (default: 2) the ...
OUTPUT:
integer -- the ...
EXAMPLES:
This example illustrates ...
sage: A = ModuliSpace()
sage: A.point(2,3)
xxx
We now ...
sage: B = A.point(5,6)
sage: xxx
It is an error to ...
sage: C = A.point('x',7)
Traceback (most recent call last):
...
TypeError: unable to convert x (=r) to an integer
NOTES:
This function uses the algorithm of [BCDT] to determine whether
an elliptic curve E over Q is modular.
...
REFERENCES:
[BCDT] Breuil, Conrad, Diamond, Taylor, "Modularity ...."
AUTHORS:
- William Stein (2005-01-03)
- First_name Last_name (yyyy-mm-dd)
"""
<body of the function>
def cos(x):
"""
Returns $\\cos(x)$.
"""
def sin(x):
r"""
Returns $\sin(x)$.
"""
Also, the non-standard LaTeX macros that are used when typesetting the
documentation are defined in
SAGE_ROOT/doc/commontex/macros.tex. If you need to add more
macros, add them there and post a patch file on the Sage trac server
(Chapter 9) so that they can be included in the next
version of Sage.
The code in the examples should pass automatic testing. This means
that if the above code is in the file f.py (or f.sage),
then sage -t f.py should not give any error messages. Testing
occurs with full Sage preparsing of input within the standard Sage
shell environment, as described in Section 3.3.
Important: The file f.py is not
imported when running tests unless you have arranged that it be
imported into your Sage environment, i.e., unless its functions are
available when you start Sage using the sage command. For
example, the function cdd_convert in the file
SAGE_ROOT/devel/sage/sage/geometry/polyhedra.py includes
an EXAMPLES block containing the following:
sage: from sage.geometry.polyhedra import cdd_convert
sage: cdd_convert(' 1 1 0 0')
[1, 1, 0, 0]
cdd_convert by default,
so it needs to be imported before it is tested; hence the first line
in the example.