| Home | Trees | Indices | Help |
|---|
|
|
object --+
|
structure.sage_object.SageObject --+
|
SloaneSequence
Base class for a Slone integer sequence. EXAMPLES: We create a dummy sequence:
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
A sequence starting at offset (=1 by default).
EXAMPLES:
sage: from sage.combinat.sloane_functions import SloaneSequence
sage: SloaneSequence().offset
1
sage: SloaneSequence(4).offset
4
|
EXAMPLES:
sage: from sage.combinat.sloane_functions import SloaneSequence
sage: SloaneSequence(4)._repr_()
Traceback (most recent call last):
...
NotImplementedError
|
EXAMPLES:
sage: cmp(sloane.A000007,sloane.A000045) == 0
False
sage: cmp(sloane.A000007,sloane.A000007) == 0
True
|
EXAMPLES:
sage: sloane.A000007(2)
0
sage: sloane.A000007('a')
Traceback (most recent call last):
...
TypeError: input must be an int, long, or Integer
sage: sloane.A000007(-1)
Traceback (most recent call last):
...
ValueError: input n (=-1) must be an integer >= 0
sage: sloane.A000001(0)
Traceback (most recent call last):
...
ValueError: input n (=0) must be a positive integer
|
EXAMPLES:
sage: from sage.combinat.sloane_functions import SloaneSequence
sage: SloaneSequence(0)._eval(4)
Traceback (most recent call last):
...
NotImplementedError
|
Return n terms of the sequence: sequence[offset], sequence[offset+1], ... , sequence[offset+n-1]. EXAMPLES: sage: sloane.A000012.list(4) [1, 1, 1, 1] |
EXAMPLES:
sage: iter(sloane.A000012)
Traceback (most recent call last):
...
NotImplementedError
|
Return sequence[n].
We interpret slices as best we can, but our sequences
are infinite so we want to prevent some mis-incantations.
Therefore, we abitrarily cap slices to be at most
LENGTH=100000 elements long. Since many Sloane sequences
are costly to compute, this is probably not an unreasonable
decision, but just in case, list does not cap length.
EXAMPLES:
sage: sloane.A000012[3]
1
sage: sloane.A000012[:4]
[1, 1, 1, 1]
sage: sloane.A000012[:10]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
sage: sloane.A000012[4:10]
[1, 1, 1, 1, 1, 1]
sage: sloane.A000012[0:1000000000]
Traceback (most recent call last):
...
IndexError: slice (=slice(0, 1000000000, None)) too long
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Thu Jul 17 04:23:37 2008 | http://epydoc.sourceforge.net |