Export to GitHub

sympy - issue #2774

``See Also`` feature in Number Theory


Posted on Oct 24, 2011 by Massive Giraffe

Edit the doc-string to add list of other function that are closely related to the query.

Ex.

>>> prime? Docstring: Return the nth prime, with the primes indexed as prime(1) = 2, prime(2) = 3, etc.... The nth prime is approximately n*log(n) and can never be larger than 2**n.

Reference: http://primes.utm.edu/glossary/xpage/BertrandsPostulate.html

This is the present doc-string. One needs to add the following line

See also : isprime, primerange, primepi

Comment #1

Posted on Oct 24, 2011 by Massive Giraffe

This is the list of .py files and approximate number of functions it contains, which needs to linked to each other.

sympy/ntheory/factor_.py 7 functions sympy/ntheory/generate.py 8 functions sympy/ntheory/modular.py 1 function sympy/ntheroy/multinomial.py 3 functions sympy/ntheroy/partitions_.py 1 function sympy/ntheroy/primetest.py 1 function sympy/ntheroy/residue_theory.py 7 functions

There are around 28 functions which one needs to understand (the input parameters and final result and not the code) to interrelate them.

Comment #2

Posted on Oct 25, 2011 by Happy Elephant

For the see also section, if you format it as

See Also

:class:someclass, :function:somefunction

(use class or function depending on what that object actually is), then Sphinx will convert into a nice see also block. See for example the very bottom of http://docs.sympy.org/0.7.1/modules/galgebra/GA/GAsympy.html.

Comment #3

Posted on Oct 25, 2011 by Grumpy Cat

(No comment was entered for this change.)

Comment #4

Posted on Oct 30, 2011 by Happy Elephant

(No comment was entered for this change.)

Comment #5

Posted on Nov 9, 2011 by Happy Elephant

(No comment was entered for this change.)

Comment #6

Posted on Nov 20, 2011 by Happy Elephant

(No comment was entered for this change.)

Comment #7

Posted on Nov 24, 2011 by Happy Elephant

As noted at https://github.com/sympy/sympy/pull/747, the way to make this work with Sphinx is to just type the function name for functions, and do class:classname for classes. So something like

See Also

functionname: description class:classname: description

or you can just list the functions, classes without descriptions:

See Also

functionname1, functionname2, class:classname1, class:classname2

(though, obviously, putting the descriptions is better).

Comment #8

Posted on Dec 30, 2011 by Helpful Rabbit

Actually the format for classes is the same as for functions - you don't have to add class:... for classes. So the See Also section should look like this:

See Also

funcname1 : description classname1 : description classname2, classname3, funcname2

And regarding descriptions - i think that it is not always better to include a description. Most functions in SymPy have names transparent enough to deduce the functionality from the name. Sure, you could add some extra information about function in the description, but that belongs to function's docstring (before using the function you will anyway have to look at its docstring). For example, functions like prime, isprime, nextprime, prevprime, primerange don't need a description, while primepi might use one.

When we come to an agreement about the use of descriptions, we should write down the rules here: https://github.com/sympy/sympy/wiki/Writing-documentation

Comment #9

Posted on Mar 20, 2012 by Happy Elephant

(No comment was entered for this change.)

Comment #10

Posted on Sep 25, 2012 by Happy Giraffe

That was https://github.com/sympy/sympy/pull/909 and https://github.com/sympy/sympy/pull/853

Comment #11

Posted on Mar 5, 2014 by Happy Elephant

We have moved issues to GitHub https://github.com/sympy/sympy/issues.

Comment #12

Posted on Apr 6, 2014 by Happy Rabbit

Migrated to http://github.com/sympy/sympy/issues/5873

Status: Fixed

Labels:
Type-Enhancement Priority-Medium CodeInCategory-Documentation CodeInDifficulty-Easy EasyToFix CodeInImportedIntoMelange Restrict-AddIssueComment-Commit