sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.39k stars 473 forks source link

Take in the module OEIS the keyword 'dead' of sequences into account. #17330

Closed PeterLuschny closed 8 years ago

PeterLuschny commented 9 years ago

OEIS functions should simply ignore sequences with the keyword 'dead'. At least they should not attempt to return terms of these sequences.

For example the sequence A000017 https://oeis.org/A000017 is 'dead', what means it has errors in the data and was replaced by another version. It is policy of the OEIS to keep such sequences so they can be found in the case they are referenced in the literature.

As it is now oeis(17).first_terms(12) throws the TypeError: You found a sign inconsistency, please contact OEIS

CC: @mo271

Component: misc

Keywords: OEIS

Author: Moritz Firsching

Branch/Commit: d416ecc

Reviewer: Vincent Delecroix

Issue created by migration from https://trac.sagemath.org/ticket/17330

mo271 commented 8 years ago

Commit: 8ea4b1a

mo271 commented 8 years ago

Branch: u/moritz/ticket/17330

mo271 commented 8 years ago
comment:1

Here is how this could be fixed (see git branch).

When doctesting this, I noticed the another bug:

**********************************************************************
File "src/sage/databases/oeis.py", line 845, in sage.databases.oeis.OEISSequence.keywords
Failed example:
    f.keywords()                          # optional -- internet
Expected:
    ('core', 'nonn', 'nice', 'easy', 'hear')
Got:
    ('core', 'nonn', 'nice', 'easy', 'hear', 'changed')
**********************************************************************

This is due to the fact that the keyword 'changed' is temporarily added, so this would go away after a while. I propose to change that example to a sequence that is not altered as often as the Fibonacci numbers (see commit)


New commits:

8ea4b1afirst try to fix 17330
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 8ea4b1a to 10c15fc

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

10c15fcsecond try to fix 17330
videlec commented 8 years ago
comment:5

You should put your full name in the "Authors" field.

mo271 commented 8 years ago

Author: Moritz Firsching

mo271 commented 8 years ago
comment:6

done

videlec commented 8 years ago
comment:7

The patch provided does not do what is in the description. Namely the dead sequences are not ignored!

I would add an explicit error message like

sage: oeis(17)
Traceback (most recent call last):
...
ValueError: this sequence is dead "A000017: Erroneous version of A032522."

Possibly, you could add an option to get it even if it is dead

sage: oeis(17, force=True)
A000017: Erroneous version of A032522.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

d416eccadding a warning
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 10c15fc to d416ecc

videlec commented 8 years ago
comment:9

Better!

videlec commented 8 years ago

Reviewer: Vincent Delecroix

mo271 commented 8 years ago

Changed reviewer from Vincent Delecroix to none

mo271 commented 8 years ago
comment:10

Perhaps throwing an error is too much? I just pushed a version where you have a warning..

videlec commented 8 years ago

Reviewer: Vincent Delecroix

videlec commented 8 years ago
comment:11

yeap. this is fine. (I rewrote my name as a reviewer)

vbraun commented 8 years ago

Changed branch from u/moritz/ticket/17330 to d416ecc