Maybe it was clear, but the offending part is
 
g = coef02[M]
for i in [M-1..2,step=-1]:
    g = x*g+coef02[i]

Something like

P = PolynomialRing(RRR,"x")
g = P(coef02[2:])

works without any problem.




On Friday, 9 February 2018 14:44:23 UTC+1, Nils Bruin wrote:
>
> On Friday, February 9, 2018 at 11:03:11 AM UTC, Marco Caliari wrote:
>>
>> Hi, the following script
>>
>> def test(m,c,precision):
>>     M = 3*m
>>     RRR = RealField(prec = precision)
>>     coef02 = [RRR(1/i) for i in [1..M+1]]
>>     g = coef02[M]
>>     for i in [M-1..2,step=-1]:
>>         g = x*g+coef02[i]
>>     ME = 32
>>     disk = [exp (2*pi.n(precision)*I*i/ME) for i in range(ME)]
>>     epsilon1 = max([abs(g(x=z)) for z in disk])
>>     return
>> m = 40
>> for c in [1/2..10,step=1/2]:
>>     for ell in [1..10]:
>>         test(m,c,165)
>>
>> Indeed, comparing the objects on the heap that weren't there before the 
> loop I find:
>
> [(<type 'builtin_function_or_method'>, 1),
>  (<type 'sage.rings.rational.Rational'>, 1),
>  (<type 'instancemethod'>, 1),
>  (<type 'set'>, 1),
>  (<type 'dict'>, 1),
>  (<type 'tuple'>, 3),
>  (<type 'list'>, 3),
>  (<type 'frame'>, 3),
>  (<type 'weakref'>, 28),
>  (<type 'sage.rings.real_mpfi.RealIntervalFieldElement'>, 6200),
>  (<type 'sage.rings.real_mpfr.RealNumber'>, 29999),
>  (<type 'sage.rings.complex_number.ComplexNumber'>, 1457000)]
>
> The real numbers mostly seem to be approximations to pi. Using 
> objgraph.show_backrefs I'm not getting anything useful. We're definitely 
> leaking but I wasn't able to identify a cache that's keeping references. Is 
> that any change that we're doing something wrong with an INCREF/DECREF ?
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to