![]() |
|
Lucas sequences V2 - Printable Version +- XOR Userforum (https://forum.xor.eu) +-- Forum: Products (https://forum.xor.eu/forumdisplay.php?fid=3) +--- Forum: NerdSEQ (https://forum.xor.eu/forumdisplay.php?fid=6) +---- Forum: Project / Mapping Exchange (https://forum.xor.eu/forumdisplay.php?fid=30) +----- Forum: Mappings (https://forum.xor.eu/forumdisplay.php?fid=33) +----- Thread: Lucas sequences V2 (/showthread.php?tid=1763) |
Lucas sequences V2 - mgd - 01-27-2024 Hi! The attached mapping does (since the update to V2 ) create arbitrary Lucas Sequences, or more precisely the modulo values of such sequences.The possibly well known Fibonacci series is one of many different Lucas Sequences. In general a Lucas Sequence is created by the following formulas:
U(n) and V(n) are the n-th members of the series and U(n-1), U(n-2) and V(n-1), V(n-2) are the two preceding values. Both U(n) and V(n) very quickly can get very big. One way to limit these numbers is applying the modulo function (MOD) to them. For this mapping I'm computing a slightly modified version of the above formulas. It can be shown that if
Applied to the above formulas:
The mapping makes use of 3 sliders from a F8R, Sweet Sixteen mkII or a 16N (whatever is available) connected via I2C to the Multi I/O Expander:
This results in 64*64*61 = 249856 different pairs of U(n)/V(n) series. Using larger ranges for P and/or Q would require to reduce the range for m (and vice versa) because these are multiplied and the math in mappings is at most 12-bit. The mapping is invoked by placing one of
Attached is the mapping file in its current and to the best of my knowledge functional state as well as an annotated listing of all the commands. The previous annotated listing contains a few rows that don't have a Row number in front of them. These are the lines that were missing from the initial V1 to make it functional as intended. V2 has these lines included and removes all the code that did compute MODS. I tried to explain the algorithm. Feel free to ask any questions. I also tried to make it as dense as I could. If you spot places where the mapping could be shortened I'm eager to hear about them. Last not least while I did do some testing (and I do think the mapping works) there obviously might be some undetected errors. If you spot any errors please notify me about them. Update for NerdSEQ Firmware V2.01: Thanks to the new MODS function I could reduce the number of lines by 24!!! It is now working. For those interested in the evolution of the script I left the initial and non functional commented version attached to this post. Version 2 leaves quite a few lines that could be used to add additional generative functionality. Feel free to improve on the code (and I'm happy to hear if it is useful for you one way or another). Have fun, Michael |