McLaughlin, James on Fri, 20 Feb 2004 23:38:09 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
peculiar parenthesis problem. |
I have a question concerning the use of { and }. I am using GP/PARI CALCULATOR Version 2.2.7 (development CHANGES-1.844) i686 running cygwin (ix86 kernel) 32-bit version compiled: Oct 28 2003, gcc-3.3.1 (cygming special) (readline v4.3 enabled, extended help available) Copyright (C) 2003 The PARI Group I have some code that runs fine as it is below, with the start parenthesis in the middle as shown (after the "N=100;" line). I have stripped the original code as much as possible to isolate and show the problem. I need the "{ }" because of the "for" loop running over several lines. If I move the ${$ to the start of the code, which seems the logical place to put it(see the second piece of code below), I get no output. I suspect the problem lies with the way I defined d(n) and subsequently g(n) and h(n). I want something that lets me evaluate these functions at different values of n. As it is, just doing g(33) etc works. The only problem is with the { and }. Can anyone tell me how to fix this? Jimmy Mc Laughlin. d(n)=n^13+n^2+5; g(n) = (d(n)*d(n-1)+(n)^k*(d(n-1)-d(n))); h(n)=d(n)*d(n-2)*((n-1)^k+n^k)+(n^k)*((n-1)^k)*(d(n-2)-d(n)); N=100; { for(i = 3,N, default(realprecision,28); print ([i,1.0*d(i-1)]); ); } ********************** second bit of code below ********************** { d(n)=n^13+n^2+5; g(n) = (d(n)*d(n-1)+(n)^k*(d(n-1)-d(n))); h(n)=d(n)*d(n-2)*((n-1)^k+n^k)+(n^k)*((n-1)^k)*(d(n-2)-d(n)); N=100; for(i = 3,N, default(realprecision,28); print ([i,d(i-1)]); ); }