That looks like a good start. I would try to represent the sequence symbolically instead of via a function so that it can be manipulated.
Aaron Meurer On Mon, Aug 27, 2018 at 2:48 PM, Robert Dougherty-Bliss <[email protected]> wrote: > The new recurrences submodule isn't quite what I had in mind. If I'm reading > it right, it expands a C-finite recurrence into a linear combination of the > initial values. This is good, but not a fully-fledged class. (I would like > for this and related features to be a method of such a class.) > > My proof of concept of this idea looks like this: > https://gist.github.com/rwbogl/06dab1e3b9935b292354b240e1807e75 > > I'm not sure that SeqBase itself could be modified for recursive sequences > without losing generality. > > On Monday, August 27, 2018 at 2:50:50 PM UTC-4, Aaron Meurer wrote: >> >> There has been some work on recurrences, if you search the issue >> tracker and pull request list for "recurrence" you can find some of >> it. I'm not aware of any work along the lines of what you are >> suggesting. >> >> Regarding the evaluation of recurrences, there has been some work in >> the new sympy.discrete.recurrences submodule. >> >> Making SeqBase support recursive sequences sounds like a good idea. >> One would need to make sure that all the methods work properly when >> the sequence is recursive. >> >> Aaron Meurer >> >> On Sun, Aug 26, 2018 at 1:02 PM, Robert Dougherty-Bliss >> <[email protected]> wrote: >> > I have recently been working with linear recurrence relations with >> > constant >> > and / or polynomial coefficients w.r.t. the index. (These are called >> > C-finite and P-recursive sequences, respectively.) These sequences have >> > some >> > nice properties, such as easy closed-form expressions in the C-finite >> > case >> > from Binet's formula. Ultimately, I would like to do things in the vein >> > of >> > Doron Zeilberger's GuessHolo package for P-recursive sequences, as >> > described >> > in this paper. >> > >> > Has anyone looked into creating a subclass of SeqBase (or something more >> > appropriate) for recursive sequences? Perhaps specifically for C-finite >> > and >> > P-recursive sequences? It seems like this would be convenient in >> > general. >> > For instance, every sequence implements a method to guess a C-finite >> > sequence that it might be (find_linear_recurrence()), but then just >> > returns >> > a list of coefficients rather than a complete sequence object. Outside >> > of >> > C-finite sequences, memoization could be baked in to make the evaluation >> > of >> > less-trivial recursive sequences nicer. >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "sympy" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to [email protected]. >> > To post to this group, send email to [email protected]. >> > Visit this group at https://groups.google.com/group/sympy. >> > To view this discussion on the web visit >> > >> > https://groups.google.com/d/msgid/sympy/d8c5f383-ee72-4c9a-b9a9-4c18fb91f8dd%40googlegroups.com. >> > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/9f96e0fc-e82a-4a28-b45a-a06cb462ac92%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6K0b%3D2kuQeWA-wSSBOHuXxmr2-KjM7mtYAd60snJb5XXg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
