Ask Your Question

roland's profile - activity

2021-12-15 13:58:55 +0200 received badge  Notable Question (source)
2021-08-28 23:55:52 +0200 received badge  Famous Question (source)
2021-07-22 15:21:30 +0200 received badge  Editor (source)
2021-07-22 15:21:30 +0200 edited question TypeError: dist must be a Distribution instance

TypeError: dist must be a Distribution instance Hi, Suddenly, using Cython magic, I got the message "TypeError: dist m

2021-07-22 10:33:18 +0200 asked a question TypeError: dist must be a Distribution instance

TypeError: dist must be a Distribution instance Hi, Suddenly, using Cython magic, I got the message "TypeError: dist m

2021-07-09 13:53:49 +0200 received badge  Notable Question (source)
2020-12-06 23:20:42 +0200 received badge  Popular Question (source)
2020-09-21 17:10:40 +0200 received badge  Popular Question (source)
2020-04-28 16:37:29 +0200 received badge  Nice Question (source)
2020-04-28 16:33:25 +0200 received badge  Nice Question (source)
2020-04-28 15:39:12 +0200 commented answer How to add extensions to Jupyter?


I got the message: error: command 'gcc' failed with exit status 1

2020-04-28 14:03:35 +0200 asked a question How to add extensions to Jupyter?


One can add extensions to Jupyter, as explained on the jupyter-contrib-nbextensions installation page, for instance with the instruction:

pip install jupyter_contrib_nbextensions

But this instruction does not work using the SageMath 9.0 Shell (in Windows)... Any idea what to do?


2019-06-04 13:01:34 +0200 received badge  Popular Question (source)
2019-06-04 13:01:34 +0200 received badge  Notable Question (source)
2019-03-03 10:07:55 +0200 received badge  Famous Question (source)
2019-03-03 09:03:52 +0200 asked a question Iterator: amazing behavior

I came across the following example:

  def count(start=0):
      num = start
      while True:
          yield num
          num += 1

When I try to apply it (Sage 8.6), the result is different than I expected:

print [count().next() for i in range(18)]
print next(count())
print next(count())

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Can someone please elucidate why the output is not equal to:

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]

2017-07-15 13:17:59 +0200 asked a question How to test an identity of rational numbers?


Why is there a difference in output between:

 print 5-1 == 0
 print 3^(1/3) - 3^(1/5) == 0

 3^(1/3) - 3^(1/5) == 0

What can I do if $x,y,s,t \in \mathbb Q$, and I want to test $x^y == s^t$?

Thanks for your support!


2017-03-03 21:36:35 +0200 received badge  Famous Question (source)
2016-11-17 09:56:15 +0200 received badge  Famous Question (source)
2016-08-26 20:33:03 +0200 received badge  Notable Question (source)
2016-05-31 20:26:44 +0200 received badge  Notable Question (source)
2016-02-21 03:16:48 +0200 received badge  Popular Question (source)
2015-12-21 22:43:37 +0200 asked a question Why (11+2/3)%2=1 and (11+1/3)%2=0?

I did not expect this behavior... For instance, I would expect an error message or a warning.

Is there an explanation?

2015-12-14 20:42:08 +0200 asked a question Sage and Excel: export / import files via Windows


Please help. The purpose is to export easily a csv file from Sage to Excel (Windows) and via versa. I use VirtualBox. The reason is that Sage is excellent to calculate and Excel is (sometimes) handy to report.

I followed the instructions of 4. Sharing files between Sage and Windows, but I do not understand the last instruction "The files will be in /media/sf_<<volume name="">>".

An example code of reading and writing to a shared map would be great. Thanks!

2015-11-21 20:00:04 +0200 asked a question How to load a R data file?

How can I load a R data file?

I have uploaded Data2.csv. I tried:

  DataInit<-read.table(DATA+"Data2.csv", header=TRUE, sep=",")

This yields an error:

Traceback (most recent call last):    DataInit<-read.table(DATA+'Data2.csv', header=TRUE, sep=",")
  File "", line 1, in <module>

  File "/home/sage/sage-6.9/local/lib/python2.7/site-packages/sagenb-0.11.4-  py2.7.egg/sagenb/misc/", line 438, in syseval
return system.eval(cmd, sage_globals, locals = sage_globals)
TypeError: unbound method eval() must be called with R instance as first argument (got str instance instead)

Thanks for your kind support!

2015-08-24 07:29:45 +0200 received badge  Enthusiast
2015-07-27 18:28:05 +0200 received badge  Notable Question (source)
2015-02-21 05:02:31 +0200 received badge  Notable Question (source)
2015-01-23 22:04:40 +0200 received badge  Popular Question (source)
2014-06-29 16:56:38 +0200 received badge  Famous Question (source)
2014-06-20 18:55:58 +0200 received badge  Notable Question (source)
2013-08-17 10:40:58 +0200 received badge  Notable Question (source)
2013-06-07 09:53:40 +0200 received badge  Popular Question (source)
2013-03-17 23:25:54 +0200 received badge  Popular Question (source)
2012-09-18 10:23:37 +0200 received badge  Popular Question (source)
2012-07-21 01:28:13 +0200 received badge  Taxonomist
2011-11-27 14:13:26 +0200 commented answer Is there a routine to find a integer base?

Jason and John, thanks for your reply. However, I probably was not quite clear regarding my question. You both assumed that I would know cc, but what is the answer to my question if you don't now cc? More general: I have to rows (in QQ), what is the smallest row of integers I can get? It is always possible to generate a row with integers, but the hard part is that I'm looking for the smallest.

2011-11-26 12:59:56 +0200 asked a question Is there a routine to find a integer base?

Hi, Sage fans. Probably a simple Sage routine does the job, but I tried hard to find it but yet without success…

My problem. Consider two rows (in QQ):



How to find (x,y) such that [(xaa[i]+ybb[i]) for i in xrange(7)] yields the row [3, -3, -3, 3, -4, 7, -3] with the smallest set integers?

For the above example (x,y)=(3,3) does the job, but is there a general routine to find the optimal (x,y)?

Many thanks in advance for your suggestions! Roland

2011-11-18 13:56:16 +0200 received badge  Popular Question (source)
2011-05-26 17:52:16 +0200 commented question Criteria new computer

Based upon the request to be more specific, I would appreciate some guidance on the following two questions: 1) On for instance various benchmarks are mentioned. Which are most suitable for me (Sage user) to compare configurations? 2) What improvements can I expect using currently (i) 2 Quad CPU Q6700@2.67Hz 6GB DDR2-800 with Windows 7 and VMWare, versus (ii) Intel Core i7-200k 3,4Gzh 8Mb, 16 G DDR-1333 with 120SSD (Windows+VMWare/Sage 32bit) + 60SSD (Sage 64bit/Ubuntu 11.04)?

2011-05-26 17:48:47 +0200 commented answer Criteria new computer

Thanks for your explanation. As a non native speaker, it occurred to me that FAQ encourages people to ask questions which address issues of more general interest than addressing a personal issue. I misinterpreted this guidance, and I'm sorry for any inconvenience or irritation caused. N.B.: I'm somewhat puzzled about the difference between ASKSAGE and Sage-Support (general help and support on using Sage, e.g. installation, usage, functions, syntax, etc.)

2011-05-25 17:07:41 +0200 asked a question Criteria new computer

Hi, technology changes rapidly, and after a few years everyone has to make a choice about new hardware. Now it is my turn...

I could not find many guidance via Google besides some very specific questions and answers on ASKBOT, Sage-support or Sage-devel. Most related are and (

What are reasonable standards today? What is nice, but not overdone? What is student level, semi-serious, and top-of-the-bill? What are criteria to buy now, or to wait for say 3-6-9 months? Is the Windows experience tool handy? Many related questions.

Based on the above suggestions: 1) Sage is single core: duo core or 4 core seems also good, isn't it? 2) 16G. Does Windows 7 + VMWARE (32bit) or Ubuntu (64bit) need it? 3) SSD is still. But does it increase speed? Value for money? 4) Are there different requirements for integer MIPS, floating point MIPS, specific applications? 5) Any other considerations, as internet speed?

The same questions, but asked differently. What is nice, but not overdone, for: a) Some integer, floating point or symbolic computations (calculation up to 15 minutes, memory usage < 30Mb)? b) Same as a), but calculations of 8 hours (mainly Cython) and a lot to save?

A third approach is budget related. If your budget is $300,400,500,750,1000,... What are the main issues to consider? (N.B.: Europe is more expensive). Is it just mainly Sage or it is a multipurpose machine. Last: simple PC will do, and heavy stuff possible via sagenb / KAIST (and maybe cloud)? Or should I wait for (multi-core) Cygwin?

Many different questions, but some guidance would be appreciated. For me heavy tasks as gaming, video , photo and music are not relevant. Up till now it seems that Intel Core i7-200k 3,4Gzh 8Mb, 16 G memory with 120SSD+60SSD will do. I can use two OS. But makes it sense? Thanks in advance for your support!

(It may be an idea to have a sage page for it, because it seems to me that it is a general question relevant over time for many).

2010-12-07 13:56:07 +0200 answered a question When does notebook save worksheets persistently?

Hi, I experienced this several times. So I decided to 'save' my work every 10-30 minutes by (i) go to "text", (ii) select and copy all, (iii) store it in a word file. I do not know how to work with Linux, otherwise I would add a routine to do it. Clumsy, but I have certainty. "Save worksheet to file" (*.sws) is a unreliable option especially if the file size exceeds 12Mb. In general, the text files are small in size. The reason this type of 'lifelines' is not added as a standard notebook action is maybe because I noticed over time that almost all developers are not using Windows but only Linux. Roland

2010-11-14 16:20:11 +0200 answered a question Service Temporarily Unavailable


I FOUND A SOLUTION. My problem was that both config.pickle and user.pickle were empty.

I copied both "standard" files from a earlier version of Sage.

This happens more often; see sage user forum

Maybe the developers could add an exeption handler just like IOError in / in __init__(self, dir).

In that case a "basic" copy of both files are read.


2010-11-09 16:34:23 +0200 asked a question Service Temporarily Unavailable


I got the following message using Firefox with Sage 4.5.3 via VM 3.1.1 build-282343.

Service Temporarily Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Apache/2.2.12 (Ubuntu) Server at Port 80

Also starting Sage in VM-player (Ubuntu) is strange. It shows only a flash of comments (can't read it) and then the application closes.

I'm especially worried that I cannot reach anymore my workbook files....

Any help is much appreciated!


2010-11-02 02:08:45 +0200 asked a question How to define a smart class using cython?

Hi, I managed to rewrite my problem so I only have to represent numbers in the following way: [(2,3),(3,3),(13,1)] like in list(factor(82713)). Thus [(prime,exponent), (prime,exponent), ...].

With such a representation multiplying is easy, and I can skip to factor numbers (again). What I'm looking for is a fast cython approach with a class where I can define a function for multiplying, but also where I'm able to store and retrieve a large set of numbers efficiently (within the program). I looked for examples in the Cython Tutorial et cetera, but I could not find an approach which helped me. Maybe someone is willing and able to share his/her expertise? Thanks in advance! Roland

2010-10-25 14:44:07 +0200 answered a question Speedup commonly used Sage functions?

Oeps! Apologies for any inconvenience caused.

I typed the examples above.... not a good idea. Still the point raised is valid.

def test1():
    for k in xmrange([10]*3): k

def test2():

    for k1 in xrange(10):
        for k2 in xrange(10):
            for k3 in xrange(10): [k1,k2,k3]



625 loops, best of 3: 1.22 ms per loop

625 loops, best of 3: 256 µs per loop

2010-10-23 07:16:20 +0200 asked a question Speedup commonly used Sage functions?


Sage has many nice shorthand functions. This makes programming easy (to read, to debug). But it comes with a price! For instance:

def test1():

    for k in xmrange([100]*3): return k

def test2():

    for k1 in xrange(100):
        for k2 in xrange(100):
            for k3 in xrange(100): 
                return [k1,k2,k3]



>>625 loops, best of 3: 45.9 µs per loop
>>625 loops, best of 3: 1.59 µs per loop

Four questions:

  • Can we inform users that "it comes with a price?"

  • Can we speed up common, often used functions (easily)?

  • For more advanced users, can we provide them with a Cython equivalent? (named for instance cxmrange)

  • Maybe there is a better approach I'm not aware of?