Saturday, 15 June 2013

debugging - Variable name expected -



debugging - Variable name expected -

i creating programme in gp/pari

foo()= { coefficient = vector(2); coefficient[1] = 1; coefficient[2] = 2; usernum = vector(2); usernum[1] = 1; usernum[2] = 2; n=2; for( r=1,n, sum = coefficient[r]* usernum[r]^r ); }

why compilation error :

variable name not expected

it appears error lies in loop cant tell whats wrong loop , can help me !!!

the name sum reserved pari/gp's built-in function. utilize name. code can improved follows.

foo() = { coefficient = [1, 2]; usernum = [1, 2]; for(r = 1, 2, var = coefficient[r] * usernum[r]^r); }

debugging for-loop pari-gp

No comments:

Post a Comment