Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

list_plot() not working in a terminal session

Hello,

list_plot() does not produce any plot when I run a script in a terminal (pure text) session. But it does when I run the same script in SAGE's graphical ("notebook()") environment. However, in both ways the execution ends normally (no error messages).

Curiously, if I type list_plot(...array name goes here...) in the terminal after the execution of the aforementioned script, a plot is produced.

Any explanation for that? The script is quite simple and short as shown below.

Thanks for any help.

import time
from sage.all import *
import math

n = [19, 31, 61, 127]
l=len(n)
c = []

for i in range(l-1):
    for k in range(i+1,l):
        ai = 2**n[i]-1
        ak = 2**n[k]-1
        temp = ai*ak
        print ai, ak, ai*ak
        start_cpu = time.clock()
        divs = prime_divisors(temp)     
        cpu_t = time.clock() - start_cpu
        c.append((math.log10(1.0*ai*ak),cpu_t))
        print divs
        print 'CPU time = %.3e \n' % (cpu_t)

list_plot(c)