James Wanless on Thu, 17 May 2012 11:48:20 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: "Unknown function" message for compiled function


Last login: Tue May 15 12:02:44 on ttys004
Desmond:~ james$ gp
                  GP/PARI CALCULATOR Version 2.3.5 (released)
                i386 running darwin (ix86 kernel) 32-bit version
            compiled: Mar  1 2010, gcc-4.0.1 (Apple Inc. build 5490)
    (readline v6.2 enabled [was v6.1 in Configure], extended help available)

                     Copyright (C) 2000-2006 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and 
comes WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.

parisize = 4000000, primelimit = 500000
? polforcedshrink(paul,var,a,b,l)=
{
    local(local_runner,local_c,local_adj,answer);
    answer=[];
    local_runner=paul;
    for(k=1,length(l),\
        local_c=l[k];\
        answer=concat([subst(local_runner,var,local_c)],answer);\
        local_adj=1-2*(local_c==b);\
        local_runner=local_adj*((local_runner-subst(local_runner,var,local_c))/(var-local_c));\
    );
    return(answer);
}
? g1=5+6*x+7*(x^2)+8*(x^3)
%1 = 8*x^3 + 7*x^2 + 6*x + 5
? test1=polforcedshrink(g1,x,0,1,[1,0,0,0,0])
%2 = [0, -8, -15, -21, 26]

On 17 May 2012, at 10:30, Ewan Delanoy wrote:

Hello all,

  I have a function below (called "polforcedshrink") that does not work (whenever I call it I get the error message " ***   unknown function or error in formal parameters: "), although the interpreter remains silent at compile time.

  Can anyone tell me what's wrong with the code ?

  Thanks in advance,

 Ewan

The code :

polforcedshrink(paul,var,a,b,l)=
{
    local(local_runner,local_c,local_adj,answer);
    answer=[];
    local_runner=paul;
    for(k=1,length(l),\
        local_c=l[k];\
        answer=concat([subst(local_runner,var,local_c)],answer);\
        local_adj=1-2*(local_c==b);\
        local_runner=local_adj*((local_runner-subst(local_runner,var,local_c))/(var-local_c));\
    );
    return(answer);
}


An example of what I get with the GP interpreter :

                  GP/PARI CALCULATOR Version 2.3.2 (released)
                 PowerPC running darwin (PPC kernel) 32-bit version
         compiled: Oct 30 2007, gcc-4.0.1 (Apple Computer, Inc. build 5247)
                  (readline v5.2 enabled, extended help available)

                       Copyright (C) 2000-2006 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and comes
WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.

parisize = 4000000, primelimit = 500000
? polforcedshrink(paul,var,a,b,l)=local(local_runner,local_c,local_adj,answer);answer=[];local_runner=paul;for(k=1,length(l),local_c=l[k];answer=concat([subst(local_runner,var,local_c)],answer);local_adj=1-2*(local_c==b);local_runner=local_adj*((local_runner-subst(local_runner,var,local_c))/(var-local_c)););return(answer);
? g1=5+6*x+7*(x^2)+8*(x^3)
%1 = 8*x^3 + 7*x^2 + 6*x + 5
? test1=paulforcedshrink(g1,x,0,1,[1,0,0,0,0])
  ***   unknown function or error in formal parameters: test1=paulforcedshrink(g1,