Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #33158: doctest fix and original issued posted on ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrenn committed Jan 13, 2022
1 parent 79e17c5 commit daaf4d6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/sage/combinat/k_regular_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,34 @@ def parse_recurrence(self, equations, function, var):
sage: RP.parse_recurrence([f(2*n) == 0, f(2*n + 1) == 0], f, n)
(1, 0, {}, {})
We check that the output is of the correct type (:trac:`33158`)::
sage: RP = RecurrenceParser(2, QQ)
sage: equations = [
....: f(4*n) == 5/3*f(2*n) - 1/3*f(2*n + 1),
....: f(4*n + 1) == 4/3*f(2*n) + 1/3*f(2*n + 1),
....: f(4*n + 2) == 1/3*f(2*n) + 4/3*f(2*n + 1),
....: f(4*n + 3) == -1/3*f(2*n) + 5/3*f(2*n + 1),
....: f(0) == 1, f(1) == 2]
sage: M, m, coeffs, initial_values = RP.parse_recurrence(equations, f, n)
sage: M.parent()
Integer Ring
sage: m.parent()
Integer Ring
sage: all(v.parent() == QQ for v in coeffs.values())
True
sage: all(v.parent() == QQ for v in initial_values.values())
True
This results in giving the correct (see :trac:`33158`) minimization in::
sage: Seq2 = kRegularSequenceSpace(2, QQ)
sage: P = Seq2.from_recurrence(equations, f, n)
sage: P
2-regular sequence 1, 2, 3, 3, 4, 5, 5, 4, 5, 7, ...
sage: P.minimized()
2-regular sequence 1, 2, 3, 3, 4, 5, 5, 4, 5, 7, ...
"""
from sage.arith.srange import srange
from sage.functions.log import log
Expand Down

0 comments on commit daaf4d6

Please sign in to comment.