Dear list, I want to construct a class of words and I get this error when I call Words from a function:
def randgoodword(m): > if m % 2 == 0: > print("We haven't implemented the even case yet. Come back later!") > return None > l = (m-1)/2 -1 > ws = Words(m,l) > i = randrange(m^l) > return Word([m]) + ws[i] > randgoodword(11) > #==> > --------------------------------------------------------------------------- > ValueError Traceback (most recent call last) > <ipython-input-138-127de63ad022> in <module> > ----> 1 randgoodword(Integer(11)) > <ipython-input-126-912d8fec37b3> in randgoodword(m) > 6 > 7 l = (m-Integer(1))/Integer(2) -Integer(1) > ----> 8 ws = Words(m,l) > 9 > 10 i = randrange(m**l) > ~/packages/sage-9.2/local/lib/python3.8/site-packages/sage/combinat/words/words.py > in Words(alphabet, length, finite, infinite) > 109 return Words_n(FiniteWords(alphabet), length) > 110 > --> 111 raise ValueError("do not know how to make a combinatorial > class of words from your input") > 112 > 113 > > ValueError: do not know how to make a combinatorial class of words from > your input > #<== If I do this manually in the command line it works: i = randrange(11^4); i #==> 3230 > Word([11]) + Words(11, 4)[i] #==> word: 11,3,5,8,8 What am I doing wrong? version() #==> 'SageMath version 9.2, Release Date: 2020-10-24' Thanks for any help, Nikos -- Οι ελαφροί ας με λέγουν ελαφρόν. Στα σοβαρά πράγματα ήμουν πάντοτε επιμελέστατος. The frivolous can call me frivolous. In serious matters I've always been most diligent. K. P. Kavafy -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CAO2SUmKmwr-4DTPY53Bm8T%3DKoMXw8yyJ8Qo_NOT1gPuA4aqwMA%40mail.gmail.com.