I do not know how to take the result apart for further computations.  What 
you can do is "eval(result, n=17)".  Also, there is "getEq$RECOP" which 
gives you the equation of a recurrence.

The result is obtained by taking quotients and differences and then 
applying interpolation to the resulting sequence.  The degrees for 
interpolation are chosen so that the last term of the sequence can be used 
for checking.  I think the default is that the degrees are chosen as evenly 
as possible.  You have some control on the choice of degrees by using 
options.  For example, setting allDegrees to true will try all possible 
degree combinations.

In the case at hand, applying differences, quotients, differences, 
quotients (in this order) to [2, 3, 5, 7, 11, 13, 17, 19] you will obtain
[-1, -3/2, -1, -1]

Next, we apply a recurrence relation guesser to this list.  We successively 
try larger orders for the recurrence relation.  With order one, we are 
looking for a relation of the form
p(n) f(n) + q(n) = 0, with polynomials p and q.

Since we have 3 terms for the interpolation, we can choose p(n) and q(n) of 
degree 1, since this gives 3 unknowns a0, b1, b0 (note that we can multiply 
the equation with any nonzero number), i.e.,
(n + a0) f(n) + (b1 n + b0) = 0 for n=0, n=1 and n=2.

This gives
-a0 + b0 = 0, 
-3/2 - 3/2 a0 + b1 + b0 = 0 and 
-2 - a0 + 2 b1 + b0 = 0 
and thus the result.  Since the final term of the original sequence also 
matches, guess yields the answer.

Martin
On Wednesday, 24 August 2022 at 09:42:55 UTC+2 ra...@hemmecke.org wrote:

> > The reason that the innermost terms (i.e., the factors in the product
> > indexed by p_5 in your output) are given as a recurrence rather than the
> > seemingly equivalent function f(p_5) = 1 is that they are in fact not
> > equivalent.
>
> Yes, I understand this recurrence aspect.
>
> > The recurrence (p - 1) f(p) + p - 1 = 0 is satisfied also by f(0) = 1, 
> f(1)
> > = 1783, f(2) = f(3) = 1:
> > 
> > guessRec([1,1783,1,1])
> > [[f(n): (- n + 1)f(n) + n - 1 = 0]]
>
> > In general, if you get such a result, it is very likely wrong, but we
> > cannot exclude the possibility that it is correct.
>
> That raises the question, whether for the inner sequence you can do 
> something with initial values or do "arbitrary" values just appear and 
> are "summmed-away" by the possible outer sums?
>
> A recurrence for the primes is of course a dream, but why does guess 
> gives me something for
>
> guess([2,3,5,7,11,13])
>
> and
>
> guess([2,3,5,7,11,13,17,19])
>
> but returns the empty list for guess([2,3,5,7,11,13,17])?
> Is ist that you have not enough values to come up with the same formula 
> as with guess([2,3,5,7,11,13,17,19]) and one value too much to verify 
> that the formula for guess([2,3,5,7,11,13]) does not generate 
> [2,3,5,7,11,13,17]?
>
> Still there is the question, how am I supposed to take the result apart 
> for further computation. That should be explained somewhere. You cannot 
> expect your users to know how the internals of Expression(Integer) are 
> to be handled.
>
> Ralf
>

-- 
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/2e8ba848-9f4b-4969-8f0a-f9a99593e7aan%40googlegroups.com.

Reply via email to