![]() |
[QUOTE=CRGreathouse;253213]I see what you're saying. Yes, the documentation is in error; M(n,m) should be equal to M(n)%m.[/QUOTE]
I got it working to the definition completely in post 2220 is my code, the reason I knew to pursue this argument is because I had tested it and I knew that M(x,x) should return 1 and it didn't so I knew at least something was up. Then I found the rest of the errors I listed, nice battle CRG. |
I'm glad you got it to do what you wanted. I specifically did not want that behavior because it makes the function do two unrelated things depending on the argument given, where my version does two very much related things. (You can see an omitted argument as using an 'infinite' m, if you like...)
|
[QUOTE=CRGreathouse;253215]I'm glad you got it to do what you wanted. I specifically did not want that behavior because it makes the function do two unrelated things depending on the argument given, where my version does two very much related things. (You can see an omitted argument as using an 'infinite' m, if you like...)[/QUOTE]
okay it's a multi-tool, thanks for the game of find the error. Does the missing argument use up a lot of extra memory ? |
[QUOTE=science_man_88;253216]okay it's a multi-tool, thanks for the game of find the error. Does the missing argument use up a lot of extra memory ?[/QUOTE]
Any optional argument that you don't give to gp is passed to PARI as null. This value takes up wordsize -- 4 bytes on 32-bit systems and 8 bytes on 64-bit systems. So no, it takes almost exactly no memory. |
could :
[CODE]createvar(x,y) = v=v;v=concat(v,[x]);v=concat(v,[y]);[/CODE] and [CODE]questionvar(x) = d=0;forstep(c=1,#v-1,[2],if(v[c]==x,return(v[c+1]),d=d+1;if(d==#v/2,error("no variable found"))))[/CODE] qualify for the create a variable on a fly script needed in the list ? I know I should also make sure they can alter them, I could make another script altervar(x) if need be. edit never mind I don't see one like I thought but I do see a use in one sense. |
[QUOTE=science_man_88;254030]could :
[CODE]createvar(x,y) = v=v;v=concat(v,[x]);v=concat(v,[y]);[/CODE] and [CODE]questionvar(x) = d=0;forstep(c=1,#v-1,[2],if(v[c]==x,return(v[c+1]),d=d+1;if(d==#v/2,error("no variable found"))))[/CODE] qualify for the create a variable on a fly script needed in the list ? I know I should also make sure they can alter them, I could make another script altervar(x) if need be. edit never mind I don't see one like I thought but I do see a use in one sense.[/QUOTE] I don't know what these are intended to do. The first is equivalent to [CODE]createvar(x,y) = v=concat(v,[x,y])[/CODE] and the second (apart from the gratuitous variable-clobbering) to [CODE]questionvar(x) = forstep(c=1,#v-1,2,if(v[c]==x,return(v[c+1])));error("no variable found")[/CODE] Both rely on a global variable v to do... something. Actually it looks like v is a lookup table of sorts. (In other languages you'd use a hash table to do this.) |
[QUOTE=CRGreathouse;254063]I don't know what these are intended to do. The first is equivalent to
[CODE]createvar(x,y) = v=concat(v,[x,y])[/CODE] and the second (apart from the gratuitous variable-clobbering) to [CODE]questionvar(x) = forstep(c=1,#v-1,2,if(v[c]==x,return(v[c+1])));error("no variable found")[/CODE] Both rely on a global variable v to do... something. Actually it looks like v is a lookup table of sorts. (In other languages you'd use a hash table to do this.)[/QUOTE] basically the name and value go into v together the questionvar(x) checks to see if variable x is in v ( the forstep comes from skipping values the variables should be equal to). If the variable name is found it returns the value, else it returns an error telling them they are looking up a non existent variable within the variables in v). I was thinking of making one to change a value in v (so they can be changed as they are wanted to be variable). |
I made a lucas sequence code if I haven't already ( I couldn't find it if I did).
[CODE]lucas(T,p,q,x)= if(T==1,v=[0,1],v=[2,p]);for(y=3,x,v=concat(v,p*v[y-1]-q*v[y-2]));v=vector(x,i,v[i]); addhelp(lucas,"lucas(T,p,q,x): returns lucas sequence of type T, 1 is U, 2 is V, for p and q to x length")[/CODE] of course this could probably be done better. |
[CODE]pieces=[N,B,K,R,Q,a,b,c,d,e,f,g,h];files=[a,b,c,d,e,f,g,h];rows=[1,2,3,4,5,6,7,8];captures=[x,""];for(piece=1,#pieces,for(capture=1,#captures,for(file=1,#files,for(row=1,#rows,print1(pieces[piece]captures[capture]files[file]rows[row]",")))))[/CODE]
once again I had it working ( i thought) but can't find my error this code is for: [url]http://www.mersenneforum.org/showthread.php?p=259371[/url] accidently defined c as a vector that's part of it. |
[QUOTE=science_man_88;259782][CODE]pieces=[N,B,K,R,Q,a,b,c,d,e,f,g,h];files=[a,b,c,d,e,f,g,h];rows=[1,2,3,4,5,6,7,8];captures=[x,""];for(piece=1,#pieces,for(capture=1,#captures,for(file=1,#files,for(row=1,#rows,print1(pieces[piece]captures[capture]files[file]rows[row]",")))))[/CODE]
once again I had it working ( i thought) but can't find my error this code is for: [url]http://www.mersenneforum.org/showthread.php?p=259371[/url] accidently defined c as a vector that's part of it.[/QUOTE] okay I've fixed one. |
[CODE]pick(n,k)=if(n>=k,return(n!/(k!*(n-k)!)),return((n+k-1)!/((k!)*(n-1)!)))[/CODE]
just thought I'd post one again. |
| All times are UTC. The time now is 23:00. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.