On Wed, Aug 24, 2022 at 09:42:54AM +0200, Ralf Hemmecke wrote:
> 
> 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.

Well, at top level this is general expression, not different
from other expressions.  You can get at details using 'kernels',
'operator' and 'arguments':

(8) -> guess([2,3,5,7,11,13,17,19])             

   (8)
   [
               s  - 1  p  - 1    s  - 1
       n - 1    8       7         6
        --+    ++-++    --+      ++-++
        >       | |     >      -  | |    [f(p ): (p  - 1)f(p ) + p  - 1 = 0] + 2
        --+     | |     --+       | |        5     5        5     5
       s  = 0  p  = 0  s  = 0    p  = 0
        8       7       6         5
     + 
       2
     ]
                                              Type: List(Expression(Integer))
(9) -> res := %(1)

   (9)
           s  - 1  p  - 1    s  - 1
   n - 1    8       7         6
    --+    ++-++    --+      ++-++
    >       | |     >      -  | |    [f(p ): (p  - 1)f(p ) + p  - 1 = 0] + 2 + 2
    --+     | |     --+       | |        5     5        5     5
   s  = 0  p  = 0  s  = 0    p  = 0
    8       7       6         5
                                                    Type: Expression(Integer)
(10) -> kernels(res)

   (10)
            s  - 1  p  - 1    s  - 1
    n - 1    8       7         6
     --+    ++-++    --+      ++-++
   [ >       | |     >      -  | |    [f(p ): (p  - 1)f(p ) + p  - 1 = 0] + 2]
     --+     | |     --+       | |        5     5        5     5
    s  = 0  p  = 0  s  = 0    p  = 0
     8       7       6         5
                                      Type: List(Kernel(Expression(Integer)))
(11) -> k1 := kernels(res)(1)

   (11)
           s  - 1  p  - 1    s  - 1
   n - 1    8       7         6
    --+    ++-++    --+      ++-++
    >       | |     >      -  | |    [f(p ): (p  - 1)f(p ) + p  - 1 = 0] + 2
    --+     | |     --+       | |        5     5        5     5
   s  = 0  p  = 0  s  = 0    p  = 0
    8       7       6         5
                                            Type: Kernel(Expression(Integer))
(12) -> operator(k1)

   (12)  %defsum
                                                          Type: BasicOperator
(13) -> argument(k1)

   (13)
            p  - 1    s  - 1
    %M - 1   7         6
    ++-++    --+      ++-++
   [ | |     >      -  | |    [f(p ): (p  - 1)f(p ) + p  - 1 = 0] + 2, %M, s ,
     | |     --+       | |        5     5        5     5                    8
    p  = 0  s  = 0    p  = 0
     7       6         5
    0, n - 1]
                                              Type: List(Expression(Integer))


For inner reccurence it is a bit more tricky as several interesting
things are hidden inside operator.

One can better see structure converting to InputForm:

(14) -> res::InputForm

   (14)
   (+

     (sum

       (product

         (+

           (sum

             (*  - 1

               (product  (rootOfRec %J (%inforec2))
                (equation %J (SEGMENT 0 (+ %K - 1))))
               )

            (equation %K (SEGMENT 0 (+ %L - 1))))

          2)

        (equation %L (SEGMENT 0 (+ %M - 1))))

      (equation %M (SEGMENT 0 (+ n - 1))))

    2)
                                                              Type: InputForm

You can also use OutputForm, but it is more verbose and slightly
less informative.  Note that OutputForm is OK, display problems
are in formatters.

-- 
                              Waldek Hebisch

-- 
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/20220824125345.GA10024%40fricas.math.uni.wroc.pl.

Reply via email to