-
-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fixes error causing period function in BinaryRecurrenceSequence to stall and added enhancement #39546
base: develop
Are you sure you want to change the base?
Fixes error causing period function in BinaryRecurrenceSequence to stall and added enhancement #39546
Conversation
…rely periodic sequences.
…. Can now compute the period of sequences that are not purely periodic.
Documentation preview for this PR (built with commit 053245d; changes) is ready! 🎉 |
The fix is good, but I have some suggestions for the comments. In line 363, please add " (default: Also, I think the description of Furthermore, I think this line is over 80 characters, so needs to be broken. There is an editing error in line 397: "then we ignore then we calculate". Also, there is no need to explain the algorithm that you are using. Maybe just say something like: The example is more clear if (as in preceding examples) you print out a few of the terms.
Then T.period(10) gives the error, and T.period(10,eventual=True) gives an answer. Please also print out a few terms in the final example. I don't think there is much point in repeating an example as a test, so please change the example to something else (or just delete it). I think the NOTE block should come before the TESTS, not after. Immediately after line 436 ("if eventual is True:") is a good place to say a few words about the algorithm. Perhaps something like: For clarity, perhaps it would be good to explicitly add "eventual=False" in line 439. I think it would be better if the error message in lines 524-526 gives the actual value of m, instead of the letter "m". You can easily do this by using an f-string in line 525: |
Added fixes suggested by Dave Morris with minor changes. The default value is |
Sorry I wasn't clear. Instead of:
I meant to suggest:
Please change this. It makes it more clear that the |
The documentation failed to build, because of a formatting error. The lines
are a bullet point, so each one after the first needs additional indentation:
|
Added more changes suggested by Dave Morris. Fixed the indentation and moved eventual=False to the correct position. |
You need double backticks for ``False``, ``True``, and ``period(m)`` in the description of ``eventual`` so that they will be in the correct font in the documentation. I'm sorry I didn't notice this previously. Similarly, in "Letting `eventual` be `True`..." you need double backticks around ``eventual`` and ``True``. (You need double backticks around code snippets. Single backticks are for math formulas that should be typeset by latex.) At the end of this sentence ("...that is not purely periodic.::"), you need to end with either ". ::" (a space between the period and the double colons) or "::" (remove the period). In the documentation, the first one will give a period, and the second one will give a colon, instead of a period. Ending with ".::" prints both a period and a colon, which is not correct. (I didn't realize this until I looked at the documentation that was generated by this PR, and saw that there was a problem.) Please also merge the latest beta. |
Merged the branch with the new beta and added changes to the documentation and doctest suggested by Dave Morris. |
Fixes #38112. Fixed issue causing period function in BinaryRecurrenceSequence to stall. In the loop to calculate the period for the prime powers it now raises an error if you loop too many times. Added an enhancement to calculate the period of a not purely period BinaryRecurrenceSequence. To do this it basically just ignores the first m^2 terms and then calculates the period as normal.
📝 Checklist
⌛ Dependencies