The results of all GP command are stored in an array named 'sage' inside
GP. If you execute too many commands, this array apparently isn't enlarged
anymore. I suspect that this is because GP runs out of stack space and
that Sage's GP interface does not notice this.
I don't see a quick and easy solution. You could try to divide your
calculation in shorter pieces and starting with a fresh GP instance after
each piece using the following command:
gp = Gp()
It would actually be better if the following could be made to work:
sage: T=pari("n->n+1")
sage: for n in [ 1 .. 2**20]:
a=T(n)
print n
This would use the PARI library rather than an interface to a PARI/GP
program running outside Sage. Unfortunately the above syntax isn't
supported yet.
Peter
Op zondag 17 november 2013 08:31:43 UTC schreef Georgi Guninski:
>
> Is there something wrong or a workaround for this.
> Simplified testcase:
>
> sage: gp("{T(n)=n+1}")
> sage: for n in [ 1 .. 2**20]:
> a=gp.T(n)
> print n
>
> #wait some time..
> ...
> 65535
> 65536
> ---------------------------------------------------------------------------
>
> TypeError
>
> TypeError: Error executing code in GP:
> CODE:
> sage[131074]=65537;
> PARI/GP ERROR:
> *** at top-level: sage[131074]=65537
> *** ^--------------
> *** array index (131074) out of allowed range [1-131073].
>
> after this trying:
> sage: gp.T(1)
>
> again raises exception.
>
> The constants near 2^16 might indicate some wrong C/C++ type
> (just a guess).
>
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.