On Wed, 8 Dec 2021 at 14:31, Neven Sajko <nsa...@gmail.com> wrote: > > Suppose I have code like this: > > l := [44, 178, 412, 746, 1168, 1669, 2260, 2941, 3712, 4573, 5524, 6565] > guess(l).1 > > Replacing the "guess" with a "guessRat" is essentially the same thing AFAIU. > > The above code returns a value of type Expression(Integer) that > represents (visually, at least) a recurrence relation. The recurrence > relation obviously defines a rational function, which means the > operation was technically a success. > > The problem is that if I try to convert the Expression to an actual > rational function in a naive manner, as illustrated in the following, > the conversion fails: > > guess(l).1::Fraction(Polynomial(Integer)) > > So, how difficult would it be to accomplish what I want, either by > improving the Guess package or by writing my own code? Note that I am > able to do the conversion in my head, what I'm asking about is how to > do it in Fricas, mechanically. > > My motivation for this is that I want to do iterative guessing, i.e. > guess (using GuessInteger) a rational function for each member of a > List(List(Integer)), and then use GuessPolynomialInteger on the list > of rational functions.
After reading up on Kernels and Expressions, I feel like it should be possible to take apart the Expression(Integer) that represents the recurrence. But it seems that is not possible in that particular case. Suppose I have the result of some invocation of guess$GuessInteger in a variable called g. None of these seem to be useful at all, that is I don't see how to extract the polynomials: kernels(g.1) operator(mainKernel(g.1)) argument(mainKernel(g.1)) >From the above I can tell that there's only a single Kernel in the Expression, and that the Kernel has an operator and two arguments, but I don't see what to do with them. Any help? Thanks, Neven -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/CAL%2BbK4Mmi8uVPEdQERHE3d%2BCGaSg2Vnx9Z63NE93Ci9BDP5%3DLQ%40mail.gmail.com.