Closed cheuberg closed 9 years ago
Needs to be rewritten to avoid using the recursion where the sequence is not defined.
Branch pushed to git repo; I updated commit sha1. New commits:
8a880be | Trac #17221: Add reference |
570cac5 | Trac #17221: Also deal with negative s. Well-posedness is now strictly enforced. |
6785007 | Trac #17221: Add doctest for paperfolding sequence |
b86e14f | Merge branch 'fsm/recursion/paperfolding-sequence' into fsm/generator-recursion |
57bad3c | Trac #17221: Replace one more occurrence of "2" by "base" |
e9bc72f | Trac #17221: Fix lifting of rules to higher exponents |
38b5341 | Trac #17221: Adapt doctests of paperfolding sequence to new output |
1ab837d | Trac #17221: Add reference and additional doctest for paperfolding sequence |
Description changed:
---
+++
@@ -1 +1,2 @@
-A new transducer generator for sequences given by a certain type of recursions.
+A new transducer generator for sequences given by recursions `a(q^K n + r) = a(q^k n + s_r) + t_r` for some `0<k<K`.
+
Branch pushed to git repo; I updated commit sha1. New commits:
12f7062 | Trac #17752: Move reference [HKW2014] to a global "References" block |
5dc81de | Trac #17752: Update reference [HKP2014] |
ec9264a | Merge branch 'fsm/references' into fsm/generator-recursion |
0ea253d | Trac #17221: Move reference [HKP2015] to a global "References" block |
Merged #17752 and adapted [HKP2015]
.
Dependencies: #17752
Review of 1ab837dc5f069e044af903439caa8807b9739102. Here are a couple of things that could be improved:
coercions mentioned w.r.t. output rings are conversions
maybe: range(base.abs()) --> srange(base.abs()) (in code and docstring)
I'm not sure if it is good to mention "Python int" at all (in docstring), since usually they shouldn't appear (maybe adapt your code (where necessary) to avoid Python-int output (if any appears; not checked by me))
T(expansion) ==f(n) is confusing, e.g. in the first example (binary sum of digits) you would have here [1,1,1] = T([1,1,1]) = f(7) = 3.
example binary sum of digits: Maybe (for a deeper understanding) it helps, if one could see the output of the transducer on a concrete example. Maybe also write one sentence why binary sum of digits gives the Identity-transducer and how one can see the sum of digits somewhere.
still example binary sum of digits: there is a lot about output_rings...is this needed in the first example already? Maybe make that a second example or at least separate it from the first example, so that it is clear, this is not needed to understand in the introductory example.
example nonadjacent form: it would be good to include concrete examples here as well, so that one sees a NAF and its weight. Also: at the moment digits -1 are not considered, but in the wiki-article they are mentioned at the top; this could lead to some confusion.
Apart from those things: code looks good, doc builds, tests pass. I did not check the math of the ticket, only the examples (these seem to be correct). I would be happy if someone else could help with this part.
I've also made a couple of small changes (PEP8; docstrings) which I'll upload soon.
Reviewer: Daniel Krenn
Changed branch from u/cheuberg/fsm/generator-recursion to u/dkrenn/fsm/generator-recursion
Added a small reviewer patch.
New commits:
5bfa80b | two fullstops at end of lines added |
81bb95b | Merge branch 'u/cheuberg/fsm/generator-recursion' of trac.sagemath.org:sage into t/17221/fsm/generator-recursion |
5c811af | Merge branch 'u/cheuberg/fsm/generator-recursion' of trac.sagemath.org:sage into t/17221/fsm/generator-recursion |
bbd1b7e | reviewer-patch: PEP8, minor rewritings in docstrings |
53bbb91 | Merge branch 't/17221/fsm/generator-recursion-review' into t/17221/fsm/generator-recursion |
Cross-reviewed your reviewer patch, is fine, thank you.
Changed branch from u/dkrenn/fsm/generator-recursion to u/cheuberg/fsm/generator-recursion
Last 10 new commits:
85efb10 | Trac #17221: Interpret "+" as addition of output words. |
4d160d7 | Trac #17221: move parsing of equation to a different method |
aeaebf1 | Trac #17221: replace "coercion" by "conversion" where appropriate |
969160c | Trac #17221: range(base.abs()) --> srange(base.abs()) |
f891643 | Trac #17221: remove "Python int" from docstring |
83f1c03 | Trac #17221: Replace example on binary sum of digits by weight of ternary expansion |
aa37aaf | Trac #17221: Move examples on ``output_rings`` to the end |
9594dca | Trac #17221: More explanations on the NAF, concrete examples |
446f8f4 | Trac #17221: Allow alternative input format (rules) |
25e02eb | Trac #17221: Allow negative residues r in recursion rules. |
Replying to @dkrenn:
Review of 1ab837dc5f069e044af903439caa8807b9739102. Here are a couple of things that could be improved:
- coercions mentioned w.r.t. output rings are conversions
done: aeaebf1
- maybe: range(base.abs()) --> srange(base.abs()) (in code and docstring)
done: 969160c
- I'm not sure if it is good to mention "Python int" at all (in docstring), since usually they shouldn't appear (maybe adapt your code (where necessary) to avoid Python-int output (if any appears; not checked by me))
done: f891643
In fact, as a by-product of 85efb10, Python int cannot occur any more.
- T(expansion) ==f(n) is confusing, e.g. in the first example (binary sum of digits) you would have here [1,1,1] = T([1,1,1]) = f(7) = 3.
This lead to a new concept for the whole method: it is more general to interpret +
as addition of words than to interpret it in a ring. So this has been changed in 85efb10. I somehow reworded this sentence you mention here, please check whether it is clearer now.
- example binary sum of digits: Maybe (for a deeper understanding) it helps, if one could see the output of the transducer on a concrete example. Maybe also write one sentence why binary sum of digits gives the Identity-transducer and how one can see the sum of digits somewhere.
I replaced the example by the weight of the ternary expansion; here it should be clearer. Concrete example and more explanations added (83f1c03).
- still example binary sum of digits: there is a lot about output_rings...is this needed in the first example already? Maybe make that a second example or at least separate it from the first example, so that it is clear, this is not needed to understand in the introductory example.
Done: aa37aaf
- example nonadjacent form: it would be good to include concrete examples here as well, so that one sees a NAF and its weight. Also: at the moment digits -1 are not considered, but in the wiki-article they are mentioned at the top; this could lead to some confusion.
Done: 9594dca
Apart from that, I made three more changes:
4d160d7 Trac #17221: move parsing of equation to a different method
transducers.Recursions had two major parts: parsing the symbolic equations and actual construction of the transducer. These first part has now been refactored into a new method.
446f8f4 Trac #17221: Allow alternative input format (rules)
Allow to enter the recursions in the form of rules as they are stored internally. In that case, no symbolic function and no variable are needed, so the order of the parameters has been changed.
25e02eb Trac #17221: Allow negative residues r in recursion rules.
Changed branch from u/cheuberg/fsm/generator-recursion to u/dkrenn/fsm/generator-recursion
Changed keywords from recursion to recursion, sd66
Looks good. Tests pass. Docstrings good. Positive!
New commits:
2cd08fb | Trac #17221: minor changes in docstring (reviewer patch) |
Changed branch from u/dkrenn/fsm/generator-recursion to u/skropf/fsm/generator-recursion
Branch pushed to git repo; I updated commit sha1. New commits:
2e62790 | Trac #17221: Minor changes in the documentation |
For me, it is also ok. Positive review.
Changed reviewer from Daniel Krenn to Daniel Krenn, Sara Kropf
For the record: The doctest removed in 2e62790 was a duplicate. This explains its removal.
Changed branch from u/skropf/fsm/generator-recursion to 2e62790
Replying to @sagetrac-git:
Branch pushed to git repo; I updated commit sha1. New commits:
2e62790
Trac #17221: Minor changes in the documentation
This last commit has not been merged, see the discussion at sage-devel. Follow-up ticket is #18206.
A new transducer generator for sequences given by recursions
a(q^K n + r) = a(q^k n + s_r) + t_r
for some0<k<K
.Depends on #17752
CC: @sagetrac-skropf @dkrenn
Component: finite state machines
Keywords: recursion, sd66
Author: Clemens Heuberger
Branch:
2cd08fb
Reviewer: Daniel Krenn, Sara Kropf
Issue created by migration from https://trac.sagemath.org/ticket/17221