New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Efficient Arbitrary Sequence Generator #8342
Comments
comment:2
You need to upload a patch. As it now stands, I cannot work out how you want to integrate your implementation into the Sage library. See this section of the Developer's Guide for more information. |
Adds the construct_sequence function. |
comment:3
Attachment: construct_sequence.patch.gz |
comment:4
Why does this function use a dictionary instead of a list? Is it done for functions that can get values for "large" n without computing all of the previous? Since it does use a dictionary, why does it assume The documentation is not quite clear to me. I don't understand what exactly does the description of Finally, the examples test only that the function does not crush. There should be comparison with expected output. E.g. show that it is possible to compute Fibonacci numbers that were not given as input and that actually even required computing some intermediate ones! As a possible improvement to consider (but I don't know if it should be done): what about admissible indices? What is the (-10)-th Fibonacci number? Infinite recursion? Maybe there should an optional parameter for a function that will check that there exists the corresponding element. And maybe there can be some way to see which values are already computed to determine if they will be enough to evaluate the new one or in case when it is possible to use several ways. |
comment:5
Sparseness. Some sequences jump around... a lot. I have no clue how you could write an implementation using a list: you'd need to calculate the terms in order which is often not possible!
This is perhaps a poor design choice. I'll make it so you can give
OK. I'll try to make this more clear.
You mean like: sage: fib = construct_sequence([1,1],lambda t: lambda n: t(n-1)+t(n-2) )
Depends on the sequence, ideally.
It isn't possible to tell from the function. Testing whether a function will necessarily exit from its definition is NP. We could have an option to give the sequences domain. One nice thing about the dictionary is the flexibility it gives: the index could be reals, or just about anything else.
See above. |
comment:6
Is there any interest in continuing work on this ticket?.. |
Component: numerical
Keywords: sequence, generator
Author: colah
Issue created by migration from https://trac.sagemath.org/ticket/8342
The text was updated successfully, but these errors were encountered: