strange sum error

32 views
Skip to first unread message

Martin R

unread,
Feb 5, 2019, 11:00:47 AM2/5/19
to FriCAS - computer algebra system
I think I found something rather strange:

(1) -> sum(sum(a^k, a=1..k), k=1..n)
   - log(%C)
 
   >> Error detected within library code:
   Hidden constant detected

Best,

Martin

Riccardo GUIDA

unread,
Feb 5, 2019, 2:19:52 PM2/5/19
to fricas...@googlegroups.com
Reproduced in 1.3.4
ric
PS btw thanks Waldek and you all for 1.3.5

FriCAS Computer Algebra System
Version: FriCAS 1.3.4
Timestamp: Wed Jun 27 13:40:07 CEST 2018
-----------------------------------------------------------------------------
Issue )copyright to view copyright notices.
Issue )summary for a summary of useful system commands.
Issue )quit to leave FriCAS and return to shell.
-----------------------------------------------------------------------------

Type: Void

(1) -> sum(sum(a^k, a=1..k), k=1..n)
- log(%C)

>> Error detected within library code:
Hidden constant detected

(1) -> sum(sum(a^k, a=1..k), k=1..10)
- log(%C)

>> Error detected within library code:
Hidden constant detected

(1) -> sum(a^k, a=1..k)

k
──┐ k
(1) > a
──┘
a = 1
Type: Expression(Integer)
(2) -> f(k)==sum(a^k, a=1..k)
Type: Void
(3) -> sum(f(k), k=1..n)
Compiling function f with type Variable(k) -> Expression(Integer)
- log(%C)

>> Error detected within library code:
Hidden constant detected

(3) -> f(3)
Compiling function f with type PositiveInteger -> Fraction(
Polynomial(Integer))

(3) 36
Type: Fraction(Polynomial(Integer))
(4) ->

Martin R

unread,
Feb 18, 2019, 4:14:41 PM2/18/19
to FriCAS - computer algebra system
Here is a simplification of the problem:

(1) -> ex := sum(a^k,a=1..k); ex1 := ex/eval(ex, k=k-1);

                                                    Type: Expression(Integer)
(2) -> )tr EFSTRUC )math
 
   Packages traced: 
      ElementaryFunctionStructurePackage(Integer,Expression(
            Integer))
   Parameterized constructors traced:
      EFSTRUC
(2) -> normalize(ex1)
 1<enter ElementaryFunctionStructurePackage.normalize,192 : 
            k
           --+    k
           >     a
           --+
          a = 1
 arg1 = -------------
        k - 1
         --+    k - 1
         >     a
         --+
        a = 1
  1<enter ElementaryFunctionStructurePackage.normalize,191 : 
              k
             --+    k
             >     a
             --+
            a = 1
  arg1 = [-------------]
          k - 1
           --+    k - 1
           >     a
           --+
          a = 1
  arg2 = []
   1<enter ElementaryFunctionStructurePackage.realElementary,23 : 
              k
             --+    k
             >     a
             --+
            a = 1
   arg1 = -------------
          k - 1
           --+    k - 1
           >     a
           --+
          a = 1
    1<enter ElementaryFunctionStructurePackage.rmap,18 : 
    arg1 = theMap(EFSTRUC;realElem!0,655)
               k
              --+    k
              >     a
              --+
             a = 1
    arg2 = -------------
           k - 1
            --+    k - 1
            >     a
            --+
           a = 1
     2<enter ElementaryFunctionStructurePackage.rmap,18 : 
     arg1 = theMap(EFSTRUC;realElem!0,655)
              k
     arg2 = %C
      3<enter ElementaryFunctionStructurePackage.rmap,18 : 
      arg1 = theMap(EFSTRUC;realElem!0,655)
      arg2 = %C
      3>exit  ElementaryFunctionStructurePackage.rmap,18 : 
      %C
      3<enter ElementaryFunctionStructurePackage.rmap,18 : 
      arg1 = theMap(EFSTRUC;realElem!0,655)
      arg2 = k
      3>exit  ElementaryFunctionStructurePackage.rmap,18 : 
      k
     2>exit  ElementaryFunctionStructurePackage.rmap,18 : 
       k log(%C)
     %e
     2<enter ElementaryFunctionStructurePackage.rmap,18 : 
     arg1 = theMap(EFSTRUC;realElem!0,655)
     arg2 = %C
     2>exit  ElementaryFunctionStructurePackage.rmap,18 : 
     %C
     2<enter ElementaryFunctionStructurePackage.rmap,18 : 
     arg1 = theMap(EFSTRUC;realElem!0,655)
     arg2 = a
     2>exit  ElementaryFunctionStructurePackage.rmap,18 : 
     a
     2<enter ElementaryFunctionStructurePackage.rmap,18 : 
     arg1 = theMap(EFSTRUC;realElem!0,655)
     arg2 = 1
     2>exit  ElementaryFunctionStructurePackage.rmap,18 : 
     1
     2<enter ElementaryFunctionStructurePackage.rmap,18 : 
     arg1 = theMap(EFSTRUC;realElem!0,655)
     arg2 = k
     2>exit  ElementaryFunctionStructurePackage.rmap,18 : 
     k
     2<enter ElementaryFunctionStructurePackage.rmap,18 : 
     arg1 = theMap(EFSTRUC;realElem!0,655)
              k - 1
     arg2 = %C
      3<enter ElementaryFunctionStructurePackage.rmap,18 : 
      arg1 = theMap(EFSTRUC;realElem!0,655)
      arg2 = %C
      3>exit  ElementaryFunctionStructurePackage.rmap,18 : 
      %C
      3<enter ElementaryFunctionStructurePackage.rmap,18 : 
      arg1 = theMap(EFSTRUC;realElem!0,655)
      arg2 = k - 1
      3>exit  ElementaryFunctionStructurePackage.rmap,18 : 
      k - 1
     2>exit  ElementaryFunctionStructurePackage.rmap,18 : 
       (k - 1)log(%C)
     %e
     2<enter ElementaryFunctionStructurePackage.rmap,18 : 
     arg1 = theMap(EFSTRUC;realElem!0,655)
     arg2 = %C
     2>exit  ElementaryFunctionStructurePackage.rmap,18 : 
     %C
     2<enter ElementaryFunctionStructurePackage.rmap,18 : 
     arg1 = theMap(EFSTRUC;realElem!0,655)
     arg2 = a
     2>exit  ElementaryFunctionStructurePackage.rmap,18 : 
     a
     2<enter ElementaryFunctionStructurePackage.rmap,18 : 
     arg1 = theMap(EFSTRUC;realElem!0,655)
     arg2 = 1
     2>exit  ElementaryFunctionStructurePackage.rmap,18 : 
     1
     2<enter ElementaryFunctionStructurePackage.rmap,18 : 
     arg1 = theMap(EFSTRUC;realElem!0,655)
     arg2 = k - 1
     2>exit  ElementaryFunctionStructurePackage.rmap,18 : 
     k - 1
    1>exit  ElementaryFunctionStructurePackage.rmap,18 : 
         k
        --+     k log(a)
        >     %e
        --+
       a = 1
    ----------------------
    k - 1
     --+     (k - 1)log(a)
     >     %e
     --+
    a = 1
   1>exit  ElementaryFunctionStructurePackage.realElementary,23 : 
        k
       --+     k log(a)
       >     %e
       --+
      a = 1
   ----------------------
   k - 1
    --+     (k - 1)log(a)
    >     %e
    --+
   a = 1
   1<enter ElementaryFunctionStructurePackage.rischNormalize,174 : 
                k
               --+     k log(a)
               >     %e
               --+
              a = 1
   arg1 = [----------------------]
           k - 1
            --+     (k - 1)log(a)
            >     %e
            --+
           a = 1
   arg2 = []
    2<enter ElementaryFunctionStructurePackage.rischNormalize,174 : 
                   k
                  --+     k log(a)
                  >     %e
                  --+
                 a = 1
    arg1 = [---------------------------]
            k - 1
             --+     - log(a)  k log(a)
             >     %e        %e
             --+
            a = 1
    arg2 = []
   - log(%C)
 
   >> Error detected within library code:
   Hidden constant detected

(2) -> 

Martin R

unread,
Feb 19, 2019, 2:39:52 PM2/19/19
to FriCAS - computer algebra system
Dear Waldek,

I'm afraid I cannot help much further.  At first I thought that normalize might expect that the dummy variables in
sum(a^k, a=1..k) and eval(sum(a^k, a=1..k), k=k-1) should be different, but this doesn't help:

(1) -> ex := sum(a^k,a=1..k); ex2 := sum(a^(k-1),a=1..k-1);

                                                    Type: Expression(Integer)
(2) -> [tower kernels ex, tower kernels ex2]

                    k                      k - 1
               k   --+    k         k - 1   --+    k - 1
   (2)  [[k, %C ,  >     a ], [k, %D     ,  >     a     ]]
                   --+                      --+
                  a = 1                    a = 1
                                Type: List(List(Kernel(Expression(Integer))))
(3) -> normalize(ex/ex2)
   log(%D)
 
   >> Error detected within library code:
   Hidden constant detected

So, maybe normalize should somehow know that the dummy variables are dummy variables?

Martin
Reply all
Reply to author
Forward
0 new messages