Ewan Delanoy on Thu, 17 May 2012 13:16:36 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re : Re: "Unknown function" message for compiled function |
Â
----- Message d'origine -----
De : Karim Belabas
EnvoyÃs : 17.05.12 11:46
à : Ewan Delanoy
Objet : Re: "Unknown function" message for compiled function
* Ewan Delanoy [2012-05-17 11:31]: > 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); > } > ? test1=paulforcedshrink(g1,x,0,1,[1,0,0,0,0]) ^^^^ replace by pol, it will work :-) Cheers, K.B. P.S: Some minor comments: - you don't need the trailing \ (since the multi-line text is already enclosed within braces { }) - why the 'local_' prefix in your (indeed, local) variable names; (to my taste) it makes the script a little harder to read. - I am not too fond of (valid) cryptic constructs like local_adj=1-2*(local_c==b); (ab)using boolean truth values as integers. Why not local_adj = if (local_c==b, -1, 1); ? - any particular reason to stick to pari-2.3.2 ? -- Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17 Universite Bordeaux 1 Fax: (+33) (0)5 40 00 69 50 351, cours de la Liberation http://www.math.u-bordeaux1.fr/~belabas/ F-33405 Talence (France) http://pari.math.u-bordeaux1.fr/ [PARI/GP] `