Package rec_sequences

asked 2024-05-18 20:17:18 +0100

Roman1988 gravatar image

updated 2024-05-22 10:24:36 +0100

FrédéricC gravatar image

I installed rec_sequences (https://github.com/PhilippNuspl/rec_s...)

I repeat the proposed example:

from rec_sequences.CFiniteSequenceRing import *

from rec_sequences.C2FiniteSequenceRing import *

No problem.

However, in response to C = CFiniteSequenceRing(QQ) error message: TypeError: __init__() takes at least 1 positional argument (0 given)

KeyError                                  Traceback (most recent call last)                                             File ~/sage/sage/src/sage/misc/cachefunc.pyx:1007, in sage.misc.cachefunc.CachedFunction.__call__()                        1006 try:                                                                                                            -> 1007     return self.cache[k]                                                                                           1008 except TypeError:  # k is not hashable                                                                                                                                                                                                  File ~/sage/sage/src/sage/misc/weak_dict.pyx:715, in sage.misc.weak_dict.WeakValueDictionary.__getitem__()                  714 if wr == NULL:                                                                                                  --> 715     raise KeyError(k)                                                                                               716 out = PyWeakref_GetObject(wr)                                                                                                                                                                                                           KeyError: ((<class 'rec_sequences.CFiniteSequenceRing.CFiniteSequenceRing'>, Rational Field), ())                                                                                                                                               During handling of the above exception, another exception occurred:                                                                                                                                                                             TypeError                                 Traceback (most recent call last)                                             Cell In[3], line 1                                                                                                      ----> 1 C = CFiniteSequenceRing(QQ)                                                                                                                                                                                                             File ~/sage/sage/src/sage/misc/classcall_metaclass.pyx:320, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__()                                                                                                                          318 """                                                                                                                 319 if cls.classcall is not None:                                                                                   --> 320     return cls.classcall(cls, *args, **kwds)                                                                        321 else:                                                                                                               322     # Fast version of type.__call__(cls, *args, **kwds)                                                                                                                                                                                 File ~/sage/sage/src/sage/misc/cachefunc.pyx:1012, in sage.misc.cachefunc.CachedFunction.__call__()                        1010         return self.cache[k]                                                                                       1011 except KeyError:                                                                                                -> 1012     w = self.f(*args, **kwds)                                                                                      1013     self.cache[k] = w                                                                                              1014     return w                                                                                                                                                                                                                            File ~/sage/sage/src/sage/structure/unique_representation.py:1010, in CachedRepresentation.__classcall__(cls, *args, **options)                                                                                                                     995 @weak_cached_function(cache=128)  # automatically a staticmethod                                                    996 def __classcall__(cls, *args, **options):                                                                           997     """                                                                                                             998     Construct a new object of this class or reuse an existing one.                                                  999                                                                                                                    (...)                                                                                                                   1008         True                                                                                                       1009     """                                                                                                         -> 1010     instance = typecall(cls, *args, **options)                                                                     1011     assert isinstance(instance, cls)                                                                               1012     if instance.__class__.__reduce__ == CachedRepresentation.__reduce__:                                                                                                                                                                File ~/sage/sage/src/sage/misc/classcall_metaclass.pyx:471, in sage.misc.classcall_metaclass.typecall()                     469     2                                                                                                               470 """                                                                                                             --> 471 return (<PyTypeObject*>type).tp_call(cls, args, kwds)                                                               472                                                                                                                     473                                                                                                                                                                                                                                         File ~/sage/sage/local/var/lib/sage/venv-python3.11.8/lib/python3.11/site-packages/rec_sequences/CFiniteSequenceRing.py:2218, in CFiniteSequenceRing.__init__(self, field, time_limit, name, element_class, category)                              2214 # self._dom_root_table is used to save already computed results                                                    2215 # about which characteristic polynomials have a unique dominant root                                               2216 self._dom_root_table = dict()                                                                                   -> 2218 DFiniteSequenceRing.__init__(self, self._poly_ring, time_limit)                                                                                                                                                                         File ~/sage/sage/local/var/lib/sage/venv-python3.11.8/lib/python3.11/site-packages/rec_sequences/DFiniteSequenceRing.py:1608, in DFiniteSequenceRing.__init__(self, ring, time_limit, name, element_class, category)                               1605 self._var_ore_algebra = self._ore_algebra.variable_name()                                                          1606 field = self._ore_algebra.base_ring().base_ring()                                                               -> 1608 RecurrenceSequenceRing.__init__(self, field)                                                                                                                                                                                            File ~/sage/sage/local/var/lib/sage/venv-python3.11.8/lib/python3.11/site-packages/rec_sequences/RecurrenceSequenceRing.py:546, in RecurrenceSequenceRing.__init__(self, field, name, element_class, category)                                      541     raise TypeError("Recurrence sequences need to be defined "                                                      542                     "over a field")                                                                                 544 self._base_ring = field                                                                                         --> 546 CommutativeAlgebra.__init__(self, field,                                                                            547                             category=CommutativeAlgebras(field))                                                                                                                                                                        File ~/sage/sage/src/sage/rings/ring.pyx:1836, in sage.rings.ring.CommutativeAlgebra.__init__()                            1834 def __init__(self, base_ring, *args, **kwds):                                                                      1835     deprecation(37999, "use the category CommutativeAlgebras")                                                  -> 1836     super().__init__(*args, **kwds)                                                                                1837                                                                                                                    1838                                                                                                                                                                                                                                         File ~/sage/sage/src/sage/rings/ring.pyx:1029, in sage.rings.ring.CommutativeRing.__init__()                               1027 _default_category = _CommutativeRings                                                                              1028                                                                                                                 -> 1029 def __init__(self, base_ring, names=None, normalize=True, category=None):                                          1030     """                                                                                                            1031     Initialize ``self``.                                                                                                                                                                                                                TypeError: __init__() takes at least 1 positional argument (0 given)

Can you please tell me what the problem is?

edit retag flag offensive close merge delete

Comments

Which version of sage. On which os ? how installed ? Please copy the full traceback.

FrédéricC gravatar imageFrédéricC ( 2024-05-18 21:10:21 +0100 )edit

Sage 10.4 Windows 10. WSL: Ubuntu 22.04

There's a character limit here)

There's a warning before the error:

DeprecationWarning: use the category CommutativeAlgebras

Roman1988 gravatar imageRoman1988 ( 2024-05-19 15:09:30 +0100 )edit

It seems that the deprecation was not done carefully enough (mea culpa). The package itself should now switch to the new class Parent as CommutativeAlgebra is deprecated and will be removed.

FrédéricC gravatar imageFrédéricC ( 2024-05-22 08:22:55 +0100 )edit