Meanwhile, I found one answer myself.
https://fricas.github.io/api/RecurrenceOperator

ROZE==>RecurrenceOperator(Integer, Expression Integer)
getEq(res)$ROZE

I do not like this abbreviated name. That goes against the usual rule of
having fully expanded names. We have ==> to abbreviate.



Other question...

aList(n)==[n*factorial(n+2*k-1)/(factorial(n + k)*factorial(k))*(-1)^k_
           for k in 0..14];
g := guessPRec(aList 1)

  [[f(n): (n+2)*f(n+1)+(4*n+2)*f(n)=0, f(0)=1]]

rec := getEq(first g)$ROZE

  (n+2)*f(n+1)+(4*n+2)*f(n)=0

Such a recurrence cries for turning it into a program that can compute
the elements of the sequence.

Of course, it doesn't work to simply define

fexpr := subst(f(n+1)-rec/(n+2),n=n-1)
f(0) == 1
f(n) == fexpr

because then f(1) would return exactly the expression involving n.

also

f(k) == subst(fexpr, n=k)

doesn't work, since it does not trigger recursion.

(1) Is it actually possible to turn an expression into a program?
(2) How do I transform rec to an expression of the form
    f(n) = ... f(n-1) + ... f(n-2)
    but NOT doing by hand.
(3) Can I extract the initial values from the result of guessPRec?

Thank you
Ralf


On 10/6/20 11:30 AM, Ralf Hemmecke wrote:
> Suppose I have
> 
> aList(n)==[n*factorial(n+2*k-1)/(factorial(n + k)*factorial(k))*(-1)^k_
>            for k in 0..14]
> res := guessAlg(aList 1)
> 
> The result shows as:
> 
>     n             2                                   2      3      4
> [[[x ]f(x): x f(x)  + f(x) - 1 = 0, f(x) = 1 - x + 2 x  - 5 x  + O(x )]]
> 
> with type List(Expression(Integer)).
> 
> I can do
> 
> (7) -> k := first rest tower res.1
> 
>    n             2                                   2      3      4
> [[x ]f(x): x f(x)  + f(x) - 1 = 0, f(x) = 1 - x + 2 x  - 5 x  + O(x )]
>                             Type: Kernel(Expression(Integer))
> (8) -> operator k
> 
>    (8)  rootOfADE
>                             Type: BasicOperator
> (9) -> argument k
> 
>    (9)  [n, %infoser0()]
>                             Type: List(Expression(Integer))
> 
> But if I want the equation? How do I get it from res?
> 
> In general it would also for the other guess functions to be able to do
> something with the result other than displaying it.
> 
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/2e42a57c-2ef0-c807-1979-7a80e581a1c3%40hemmecke.org.

Reply via email to