Ask Your Question

Olivier R.'s profile - activity

2020-08-31 23:40:43 +0100 commented answer Iteration over a Combinations(alist, 5).list()

Oh, merci (que je me sens cruche :) ! Mais soulagé !)

2020-08-30 15:52:38 +0100 asked a question Iteration over a Combinations(alist, 5).list()

Dear all,

I have a big set built as : Combinations([1,2,3,4,5,6,7], 5).list() through which I need to iterate. In real life, the list [1,2,3,4,5,6,7] has 72 components. I don't need this set of combinations, only to iterate through it. I did not find the proper way to do that with the combinat package, but I have the feeling I overlooked something.

Many thanks if you have infos on this issue!

Best, O.

2020-08-02 18:40:17 +0100 commented answer Timing : are hurwitz_zeta values cached?

Thanks for the syntax in Arb to get the Hurwitz-zeta!

2020-08-02 18:37:53 +0100 received badge  Autobiographer
2020-08-02 12:50:38 +0100 asked a question Timing : are hurwitz_zeta values cached?

Dear all, It seems the values of hurwitz_zeta are cached in some way. This makes sense, but I couldn't find documentation on that issue, and in particular, on how to clear the cache: I want to time several instances of a script and need to start afresh each time. Here is an ECM:

import sys
from timeit import default_timer as timer
def ECM(prec):
    start, CF = timer(), ComplexField(prec)
    hurwitz_zeta(s = CF(2), x = CF(0.5)) 
    end = timer()    
return end-start

for i in range(0,20):


Then start afresh, get a similar answer. I am pretty sure this system-caching mechanism is explained somewhere but my morning queries drew a blank --

Pointers would be appreciated! Best, Olivier

2020-08-02 00:12:42 +0100 asked a question change_ring for DirichletGroup: some initialisation is required for ComplexIntervalField?

Dear all,

A code will better explain my predicament:

myCIF = ComplexIntervalField( 200 )                                                                   
myD = DirichletGroup(5)                                                                               
myDCIF = myD.change_ring(myCIF)                                                                           
[e.values() for e in myDCIF] 
--> NotImplementedError followed by lots of shouting involving in particular 'cachefunc.pyx'

Then do it a second time:

[e.values() for e in myDCIF] 
--> Good result!

The mystery gets more mysterious if one tries it with 'ComplexField' rather than with 'ComplexIntervalField': everything goes smoothly. Here is thus my way out:

myCF =  ComplexField( 200 + 1)
myCIF = ComplexIntervalField( 200 )                                                                   
myD = DirichletGroup(5)                                                                               
myDCF = myD.change_ring(myCF)                                                                           
[[myCIF(v) for v in e.values()] for e in myDCF]

Maybe there is something simple I didn't get that would avoid the above manipulation?

Many thanks in advance! Olivier

2020-07-31 12:47:54 +0100 commented answer Complex roots of non-squarefree real polynomial

Oups, many thanks, 'p.roots()' works like a charm! I guess 'complex_roots(p)' must be kept for more specific usage. Best, O.

2020-07-31 09:34:25 +0100 asked a question Complex roots of non-squarefree real polynomial

Dear all, I need in my script the maximum of the absolute value of the roots of a polynomial. I don't know the polynomial the user will introduce, so it may well be non squarefree and with non-integer coefficients. Here is something that baffled me for some time:

x = var('x')
R0X = PolynomialRing(RealField(40), x) 
P0 = 1 + 2*x + x ^2
P  = R0X( P0)
--> ok, good result
P0 = 1-2*x-7*x^2-4*x^3 # -4 * (x-1/4) * (x + 1)^2
P  = R0X( P0)
--> waiting, waiting ....

The mystery is not so hard to pierce, I think:

 sage: -4.0000*x^3 - 7.0000*x^2 - 2.0000*x + 1.0000

But then, I still have my initial problem! I can use some apriori bound for these roots. I'm still unhappy of not being able to get a better numerical approximation --

Many thanks for your lights! Olivier

2020-07-19 16:06:48 +0100 commented answer Spline interpolation varies hugely when variables are rescaled in 3d-lists ?

Ok, now I understand that aspect_ratio modifies only the rendering and has no effect on the datas produced.

I also tried adding

C = ComplexField(200)

and replacing

zeta(fx(x/nx) + I*fy(y/ny))


C(zeta(fx(x/nx) + I*fy(y/ny)))

with the same output.

2020-07-12 11:56:35 +0100 received badge  Nice Question (source)
2020-07-12 01:52:41 +0100 received badge  Student (source)
2020-07-11 15:06:35 +0100 received badge  Editor (source)
2020-07-11 15:05:32 +0100 asked a question Spline interpolation varies hugely when variables are rescaled in 3d-lists ?

Dear all,

Here is a short script:

(nbx, nby) = (74, 90)

def fx(x):
    return (0.5 + x/2.5)

def fy(y):
    return (40*y)

zetaPlot = list_plot3d([(30 * (fx(x/nbx)-1/2)+1/2 ,  fy(y/nby), 5 * abs(zeta(fx(x/nbx) + I*fy(y/nby)))) 

                        for x in range(-nbx, nbx+1) for y in range(-nby, nby+1)], 

                        interpolation_type = 'spline')

Now modify the z-coordinate: replace "5 * abs(zeta...)" by "abs(zeta...)" The resulting graph is essentially flat. Can anyone tell me what is happening there? Also, I would like to get rid of my scaling parameters 30 and 5 by using frame_aspect_ratio, to get cleaner code and a better annoted frame, but I don't seem to understand how to do it.

A great many thanks for anyone who would take the time to teach me that, it is some hours that I'm struggling with some docs and examples without having reached much --

Best, Olivier

2019-08-07 14:05:06 +0100 asked a question unable to simplify to a complex interval approximation

Dear all,

Once simplified, here is the problem. This is something that goes smoothly with Sage 8.6 and not with Sage 8.1. It turns out that Sage 8.1 is the one bundled with Ubuntu 18.04 LTS so I'm interested in solving this issue. I'm also interested in this question in itself. Here it is:

C = ComplexIntervalField(200)


That work's just fine in Sage 8.6 but Sage 8.1 answers:

TypeError: unable to simplify to a complex interval approximation

Of course C(psi(1/3)) works just fine. Many thanks in advance