€csage.server.notebook.notebook Notebook q)q}q(U_Notebook__worksheetsq}q(U(csage.server.notebook.worksheet Worksheet qoq}q(U_Worksheet__filenameq U_U_Worksheet__cellsq ]q ((csage.server.notebook.cell Cell q oq }q(U _Cell__inqU2+3qU_Cell__introspect_htmlqU!
qU_Cell__worksheetqhU_Cell__completionsq‰U_Cell__introspectq‰U_Cell__out_htmlqUU	_Cell__idqMU_Cell__is_htmlq‰U_before_preparseqURos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/0")
2+3qU
_Cell__dirqU"sage_notebook/worksheets/_/cells/0qU
_Cell__outqU
5

qUhas_new_outputq‰U_Cell__versionq KU_Cell__sageq!csage.interfaces.sage0
reduce_load_Sage
q")Rq#U_Cell__typeq$Uwrapq%U_Cell__timeq&‰U_Cell__interruptedq'‰ub(hoq(}q)(U	_Cell__inq*U2+5q+hU!
q,U_Cell__worksheetq-hU_Cell__completionsq.‰h‰U_Cell__out_htmlq/UU	_Cell__idq0Mh‰hURos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/1")
2+5q1U
_Cell__dirq2U"sage_notebook/worksheets/_/cells/1q3U
_Cell__outq4U
7

q5Uhas_new_outputq6‰U_Cell__versionq7Kh!h#U_Cell__typeq8h%h&‰U_Cell__interruptedq9‰ub(hoq:}q;(h*U$E = magma.EllipticCurve([1,2,3,4,5])qq=h-hh.‰h‰h/Uh0Mh‰hUsos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/2")
E = magma.EllipticCurve([1,2,3,4,5])q>h2U"sage_notebook/worksheets/_/cells/2q?h4U

q@h6‰h7Kh!h#h8h%h&‰h9‰ub(hoqA}qB(U	_Cell__inqCU%sh

ps ax |grep magmaqDU_Cell__introspect_htmlqEU!
qFU_Cell__worksheetqGhU_Cell__completionsqH‰U_Cell__introspectqI‰U_Cell__out_htmlqJUU	_Cell__idqKM
U_Cell__is_htmlqL‰U_before_preparseqMUfos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/13")
%sh

ps ax |grep magmaqNU
_Cell__dirqOU#sage_notebook/worksheets/_/cells/13qPU
_Cell__outqQU…
  687  p4  S+     0:00.00 grep magma
  682  p5  Ss+    0:01.65 /Users/was/local/magma/magma.exe -n
/Users/was/talks/2007-01-05-msr

qRUhas_new_outputqS‰U_Cell__sageqTh#U_Cell__versionqUKU_Cell__typeqVh%U_Cell__timeqW‰U_Cell__interruptedqX‰ub(hoqY}qZ(h*UEhU!
q[h-hh.‰h‰h/Uh0Mh‰hUPos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/3")
Eq\h2U"sage_notebook/worksheets/_/cells/3q]h4UX
Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field

q^h6‰h7Kh!h#h8h%h&‰h9‰ub(hoq_}q`(h*Utype(E)qahU!
qbh-hh.‰h‰h/Uh0Mh‰hUVos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/4")
type(E)qch2U"sage_notebook/worksheets/_/cells/4qdh4U/


qeh6‰h7Kh!h#h8h%h&‰h9‰ub(hoqf}qg(hCUE.TorsionSubgroup()qhhEU!
qihGhhH‰hI‰hJUhKMhL‰hMUcos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/14")
E.TorsionSubgroup()qjU_word_being_completedqkUE.TorsionSuqlhOU#sage_notebook/worksheets/_/cells/14qmhQU
Abelian Group of order 1

qnhS‰hTh#hUKhVh%hW‰hX‰ub(hoqo}qp(hCUa = magma(-5/6)qqhEU!
qrhGhhH‰hI‰hJUhKMhL‰hMU_os.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/16")
a = magma(-5/6)qshOU#sage_notebook/worksheets/_/cells/16qthQU

quhS‰hTh#hUKhVh%hW‰hX‰ub(hoqv}qw(hCUahEU!
qxhGhhH‰hI‰hJUhKMhL‰hMUQos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/17")
aqyhOU#sage_notebook/worksheets/_/cells/17qzhQU
-5/6

q{hS‰hTh#hUKhVh%hW‰hX‰ub(hoq|}q}(hCU	b = gp(a)q~hEU!
qhGhhH‰hI‰hJUhKMhL‰hMUYos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/18")
b = gp(a)q€hOU#sage_notebook/worksheets/_/cells/18qhQU

q‚hS‰hTh#hUKhVh%hW‰hX‰ub(hoqƒ}q„(hCUbhEU!
q…hGhhH‰hI‰hJUhKMhL‰hMUQos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/19")
bq†hOU#sage_notebook/worksheets/_/cells/19q‡hQU
-5/6

qˆhS‰hTh#hUKhVh%hW‰hX‰ub(hoq‰}qŠ(hCU
s = str(a)q‹hEU!
qŒhGhhH‰hI‰hJUhKMhL‰hMUZos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/20")
s = str(a)qhOU#sage_notebook/worksheets/_/cells/20qŽhQU

qhS‰hTh#hUKhVh%hW‰hX‰ub(hoq}q‘(hCUshEU!
q’hGhhH‰hI‰hJUhKMhL‰hMUQos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/21")
sq“hOU#sage_notebook/worksheets/_/cells/21q”hQU	
'-5/6'

q•hS‰hTh#hUKhVh%hW‰hX‰ub(hoq–}q—(hCUsage_eval(s)q˜hEU!
q™hGhhH‰hI‰hJUhKMhL‰hMU\os.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/22")
sage_eval(s)qšhOU#sage_notebook/worksheets/_/cells/22q›hQU
-5/6

qœhS‰hTh#hUKhVh%hW‰hX‰ub(hoq}qž(hCUmagma.eval('2^10')qŸhEU!
q hGhhH‰hI‰hJUhKMhL‰hMUbos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/_/cells/15")
magma.eval('2^10')q¡hOU#sage_notebook/worksheets/_/cells/15q¢hQU	
'1024'

q£hS‰hTh#hUKhVh%hW‰hX‰ub(hoq¤}q¥(h*UE.name()q¦hU!
q§h-hh.‰h‰h/Uh0Mh‰hUaos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/_/cells/5")
E.name()q¨h2U"sage_notebook/worksheets/_/cells/5q©h4U
'_sage_[7]'

qªh6‰h7Kh!h")Rq«h8Uwrapq¬h&‰h9‰ub(hoq­}q®(h*UE.Rank()q¯hU!
q°h-hh.‰h‰h/Uh0Mh‰hUaos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/_/cells/6")
E.Rank()q±h2U"sage_notebook/worksheets/_/cells/6q²h4U
1

q³h6‰h7Kh!h«h8h¬h&‰h9‰ub(hoq´}qµ(h*Ua = maple('2007')q¶hU!
q·h-hh.‰h‰h/Uh0Mh‰hUjos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/_/cells/7")
a = maple('2007')q¸h2U"sage_notebook/worksheets/_/cells/7q¹h4U

qºh6‰h7Kh!h«h8h¬h&‰h9‰ub(hoq»}q¼(h*UahU!
q½h-hh.‰h‰h/Uh0Mh‰hUZos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/_/cells/8")
aq¾h2U"sage_notebook/worksheets/_/cells/8q¿h4U
2007

qÀh6‰h7Kh!h«h8h¬h&‰h9‰ub(hoqÁ}qÂ(h*Ua.ifactor()qÃhU!
qÄh-hh.‰h‰h/Uh0M	h‰hUdos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/_/cells/9")
a.ifactor()qÅh2U"sage_notebook/worksheets/_/cells/9qÆh4U
``(3)^2*``(223)

qÇh6‰h7Kh!h«h8h¬h&‰h9‰ub(hoqÈ}qÉ(h*Ua.name()qÊhU!
qËh-hh.‰h‰h/Uh‰h0M
U_word_being_completedqÌUa.ifacqÍhUbos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/_/cells/10")
a.name()qÎh2U#sage_notebook/worksheets/_/cells/10qÏh4U

'sage1'

qÐh6‰h7Kh!h«h8h¬h&‰h9‰ub(hoqÑ}qÒ(h*Ufor i in range(5):
    print iqÓhU!
qÔh-hh.‰h‰h/Uh0Mh‰hUxos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/_/cells/11")
for i in range(5):
    print iqÕh2U#sage_notebook/worksheets/_/cells/11qÖh4U
0
1
2
3
4

q×h6‰h7Kh!h«h8h¬h&‰h9‰ub(hoqØ}qÙ(h*Uh-hh.‰h/Uh0Mh2U#sage_notebook/worksheets/_/cells/12qÚh4Uh6‰h7Kh8h¬h9‰ubeU_Worksheet__synchroqÛK$U_Worksheet__comp_is_runningq܉U_Worksheet__dirqÝUsage_notebook/worksheets/_qÞU_Worksheet__variablesqß]qà(U$E-sage.interfaces.magma.MagmaElementqáU$a-sage.interfaces.magma.MagmaElementqâUb-sage.interfaces.gp.GpElementqãUs-strqäeU_Worksheet__attachedqå}qæU_Worksheet__queueqç]qèU_Worksheet__next_idqéMU_Worksheet__sageqêh#U_Worksheet__passcryptqëˆU_Worksheet__nameqìUU_Worksheet__saltqíU1165187731.576083qîU_Worksheet__notebookqïhU_Worksheet__idqðKU_Worksheet__next_block_idqñKU_Worksheet__systemqòNU_Worksheet__passcodeqóU
11G3BJNEUV/PkqôubUqsieveqõ(hoqö}q÷(U_Worksheet__filenameqøUqsieveqùU_Worksheet__cellsqú]qû((hoqü}qý(U	_Cell__inqþU/n = next_prime(10^32)*next_prime(10^33)
print nqÿU_Cell__introspect_htmlrU!
rU_Cell__worksheetrhöU_Cell__completionsr‰U_Cell__introspectr‰U_Cell__out_htmlrUU
_Cell__outrUE
100000000000000000000000000000055100000000000000000000000000002989

rU	_Cell__idrM`U_Cell__is_htmlr	‰U_before_preparser
Uƒos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/qsieve/cells/0")
n = next_prime(10^32)*next_prime(10^33)
print nrU
_Cell__dirrU'sage_notebook/worksheets/qsieve/cells/0r
U_word_being_completedrUqsirUhas_new_outputr‰U_Cell__versionrKU_Cell__sagerh«U_Cell__typerUwraprU_Cell__timer‰U_Cell__interruptedr‰ub(hor}r(hþUtime factor(n)   rjU!
rjhöj‰j‰jUjM`j	‰j
Uˆos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/qsieve/cells/1")
__SAGE_t__=cputime()
__SAGE_w__=walltime()
factor(n)rjU'sage_notebook/worksheets/qsieve/cells/1rjUp
100000000000000000000000000000049 * 1000000000000000000000000000000061
CPU time: 64.23 s,  Wall time: 87.90 s

rj‰jKjh«jjjˆj‰ub(hor}r(hþU+F, t = qsieve(n, time=True)
print F
print tr jU!
r!jhöj‰j‰jUjUx
[100000000000000000000000000000049, 1000000000000000000000000000000061]
80.95 real        45.56 user         0.49 sys

r"jM`j	‰j
Uos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/qsieve/cells/2")
F, t = qsieve(n, time=True)
print F
print tr#jU'sage_notebook/worksheets/qsieve/cells/2r$jUqsir%j‰jKjh«jjj‰j‰ub(hor&}r'(hþU%q = qsieve(n, time=True, block=False)r(jU!
r)jhöj‰j‰jUjM`j	‰j
Uyos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/qsieve/cells/3")
q = qsieve(n, time=True, block=False)r*jU'sage_notebook/worksheets/qsieve/cells/3r+jU

r,j‰jKjh«jjj‰j‰ub(hor-}r.(hþUqjU!
r/jhöj‰j‰jUjU
([], '')

r0jM`j	‰j
UUos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/qsieve/cells/4")
qr1jU'sage_notebook/worksheets/qsieve/cells/4r2jUq.cpur3j‰jKjh«jjj‰j‰ub(hor4}r5(hþU2+2r6jU!
r7jhöj‰j‰jUjM`j	‰j
UWos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/qsieve/cells/5")
2+2r8jU'sage_notebook/worksheets/qsieve/cells/5r9jU
4

r:j‰jKjh«jjj‰j‰ub(hor;}r<(hþU
print q.log()r=jU!
r>jhöj‰j‰jUjT”	
Input number to factor [ >=40 decimal digits]: 100000000000000000000000000000055100000000000000000000000000002989



100 relations, 9 partials.
1260 curves.
200 relations, 15 partials.
2520 curves.
300 relations, 25 partials.
400 relations, 38 partials.
3780 curves.
500 relations, 46 partials.
600 relations, 55 partials.
5040 curves.
700 relations, 61 partials.
6300 curves.
800 relations, 70 partials.
900 relations, 81 partials.
7560 curves.
1000 relations, 90 partials.
8820 curves.
1100 relations, 96 partials.
1200 relations, 106 partials.
10080 curves.
1300 relations, 109 partials.
11340 curves.
1400 relations, 121 partials.
1500 relations, 135 partials.
12600 curves.
1600 relations, 151 partials.
13860 curves.
1700 relations, 162 partials.
15120 curves.
1800 relations, 172 partials.
1900 relations, 181 partials.
16380 curves.
2000 relations, 194 partials.
17640 curves.
2100 relations, 203 partials.
2200 relations, 213 partials.
18900 curves.
2300 relations, 225 partials.
20160 curves.
2400 relations, 237 partials.
2500 relations, 247 partials.
21420 curves.
2600 relations, 255 partials.
22680 curves.
2700 relations, 273 partials.
2800 relations, 280 partials.
23940 curves.
2900 relations, 298 partials.
25200 curves.
3000 relations, 307 partials.
3100 relations, 318 partials.
26460 curves.
3200 relations, 324 partials.
27720 curves.
3300 relations, 334 partials.
3400 relations, 340 partials.
28980 curves.
3500 relations, 350 partials.
3600 relations, 363 partials.
30240 curves.
3700 relations, 374 partials.
31500 curves.
3800 relations, 389 partials.
32760 curves.
3900 relations, 398 partials.
4000 relations, 415 partials.
34020 curves.
4100 relations, 429 partials.
4200 relations, 438 partials.
35280 curves.
4300 relations, 453 partials.
36540 curves.
4400 relations, 461 partials.
4500 relations, 473 partials.
37800 curves.
4600 relations, 486 partials.
39060 curves.
4700 relations, 498 partials.
40320 curves.
4800 relations, 507 partials.
4900 relations, 526 partials.
41580 curves.
5000 relations, 540 partials.
42840 curves.
5100 relations, 555 partials.
5200 relations, 565 partials.
44100 curves.
5300 relations, 574 partials.
45360 curves.
5400 relations, 587 partials.
5500 relations, 597 partials.
46620 curves.
5600 relations, 604 partials.
47880 curves.
5700 relations, 614 partials.
5800 relations, 623 partials.
49140 curves.
5900 relations, 634 partials.
50400 curves.
6000 relations, 645 partials.


r?jM`j	‰j
Uaos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/qsieve/cells/6")
print q.log()r@jU'sage_notebook/worksheets/qsieve/cells/6rAjUq.rBj‰jKjh«jjj‰j‰ub(horC}rD(hþUq.quit()rEjU!
rFjhöj‰j‰jUjM`j	‰j
U\os.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/qsieve/cells/7")
q.quit()rGjU'sage_notebook/worksheets/qsieve/cells/7rHjU

rIj‰jKjh«jjj‰j‰ub(horJ}rK(hþUjhöj‰jUjM`jU'sage_notebook/worksheets/qsieve/cells/8rLjUj‰jKjjj‰ubeU_Worksheet__synchrorMK1U_Worksheet__namerNUqsieverOU_Worksheet__attachedrP}rQU_Worksheet__saltrRU1168019690.935546rSU_Worksheet__dirrTUsage_notebook/worksheets/qsieverUU_Worksheet__queuerV]rWU_Worksheet__next_idrXM	`U_Worksheet__passcryptrYˆU_Worksheet__comp_is_runningrZ‰U_Worksheet__passcoder[U
11G3BJNEUV/Pkr\U_Worksheet__notebookr]hU_Worksheet__idr^KU_Worksheet__next_block_idr_KU_Worksheet__systemr`NubUboothbyra(horb}rc(U_Worksheet__filenamerdUboothbyreU_Worksheet__cellsrf]rg((horh}ri(hCU(A = MatrixSpace(ZZ,100).random_element()rjhEU!
rkhGjbhH‰hI‰hJUhKKhL‰hMU}os.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/boothby/cells/0")
A = MatrixSpace(ZZ,100).random_element()rlhOU(sage_notebook/worksheets/boothby/cells/0rmhQU

rnhS‰hTh")RrohUKhVh%hW‰hX‰ub(horp}rq(hCUA.characteristic_polynomial()rrhET™rshGjbhH‰hI‰hJUhKKhL‰hMUros.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/boothby/cells/1")
A.characteristic_polynomial()rthkUA.charuhOU(sage_notebook/worksheets/boothby/cells/1rvhQUhS‰hTNhUKhVh%hW‰hXˆub(horw}rx(hCUhGjbhH‰hJUhKKhOU(sage_notebook/worksheets/boothby/cells/2ryhQUhS‰hUKhVh%hX‰ubeU_Worksheet__synchrorzKU_Worksheet__comp_is_runningr{‰U_Worksheet__dirr|U sage_notebook/worksheets/boothbyr}U_Worksheet__attachedr~}rU_Worksheet__passcoder€U
11G3BJNEUV/PkrU_Worksheet__queuer‚]rƒU_Worksheet__next_idr„Khß]r…U7A-sage.matrix.matrix_integer_dense.Matrix_integer_denser†aU_Worksheet__passcryptr‡ˆU_Worksheet__namerˆUboothbyr‰U_Worksheet__saltrŠU1168036645.916354r‹U_Worksheet__notebookrŒhU_Worksheet__next_block_idrKU_Worksheet__idrŽKhêjoU_Worksheet__systemrNubUgraphr(hor‘}r’(h	Ugraphr“h
]r”((hor•}r–(U	_Cell__inr—U*time b = bernoulli(10000, algorithm='gap')r˜U_Cell__introspect_htmlr™U!
ršU_Cell__worksheetr›j‘U_Cell__completionsrœ‰U_Cell__introspectr‰U_Cell__out_htmlržUU	_Cell__idrŸM0U_Cell__is_htmlr ‰U_before_preparser¡U®os.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/14")
__SAGE_t__=cputime()
__SAGE_w__=walltime()
b = bernoulli(10000, algorithm='gap')r¢U
_Cell__dirr£U'sage_notebook/worksheets/graph/cells/14r¤U_word_being_completedr¥Ubernr¦Uhas_new_outputr§‰U_Cell__versionr¨KU_Cell__sager©NU_Cell__interruptedrªˆU_Cell__typer«Uwrapr¬U_Cell__timer­ˆU
_Cell__outr®Uub(hor¯}r°(j—U+time b = bernoulli(10000, algorithm='pari')r±j™U!
r²j›j‘jœ‰j‰jžUjŸM0j ‰j¡U¯os.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/15")
__SAGE_t__=cputime()
__SAGE_w__=walltime()
b = bernoulli(10000, algorithm='pari')r³j£U'sage_notebook/worksheets/graph/cells/15r´j®U'
CPU time: 0.24 s,  Wall time: 0.26 s

rµj§‰j¨Kj©h«j«j¬j­ˆjª‰ub(hor¶}r·(j—UE = EllipticCurve('389a')r¸j™U!
r¹j›j‘jœ‰j‰jžUjŸM
0j ‰j¡Uwos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/10")
E = EllipticCurve('389a')rºj£U'sage_notebook/worksheets/graph/cells/10r»j¥UEllr¼j§‰j¨Kj©h«jª‰j«j¬j­‰j®U

r½ub(hor¾}r¿(j—UL = E.Lseries_zeros(5)rÀj™U!
rÁj›j‘jœ‰j‰jžUjŸM0j ‰j¡Utos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/11")
L = E.Lseries_zeros(5)rÂj£U'sage_notebook/worksheets/graph/cells/11rÃj¥U
E.Lseries_zerrÄj§‰j¨Kj©h«jª‰j«j¬j­‰j®U

rÅub(horÆ}rÇ(j—ULj™U!
rÈj›j‘jœ‰j‰jžUjŸM0j ‰j¡U_os.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/12")
LrÉj£U'sage_notebook/worksheets/graph/cells/12rÊj®UA
[0.000000000, 0.000000000, 2.87609907, 4.41689608, 5.79340263]

rËj§‰j¨Kj©h«j«j¬j­‰jª‰ub(horÌ}rÍ(hUg = graphs.PetersenGraph()rÎU_Cell__introspect_htmlrÏU!
rÐhj‘h‰U_Cell__introspectrщhUhM0U_Cell__is_htmlrÒ‰U_before_preparserÓUwos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/0")
g = graphs.PetersenGraph()rÔhU&sage_notebook/worksheets/graph/cells/0rÕU_word_being_completedrÖU
graphs.Petr×h‰h KU_Cell__sagerØh«h'‰h$UwraprÙU_Cell__timerÚ‰hU

rÛub(horÜ}rÝ(hUshow(g)rÞjÏU!
rßhj‘h‰jщhU>ràhM0jÒ‰jÓUdos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/1")
show(g)ráhU&sage_notebook/worksheets/graph/cells/1râhU

rãh‰h KjØh«h$jÙjÚ‰h'‰ub(horä}rå(hU(g = graphs.CompleteBipartiteGraph(5,100)ræhU!
rçhj‘h‰h‰hUh‰hM0hÌUgraphs.CompleteBirèhU…os.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/2")
g = graphs.CompleteBipartiteGraph(5,100)réhU&sage_notebook/worksheets/graph/cells/2rêhU

rëh‰h Kh!h«h$j¬h&‰h'‰ub(horì}rí(h*Ugraphs.CompleteBipartiteGraphrîhT?
File: /Volumes/HOME/s/local/lib/python2.5/site-packages/sage/graphs/graph_database.py
Source Code (starting at line 566):
    def CompleteBipartiteGraph(self, n1, n2):
        """
        Returns a Complete Bipartite Graph sized n1+n2, with each of the
        nodes [0,(n1-1)] connected to each of the nodes [n1,(n2-1)] and
        vice versa.
        
        A Complete Bipartite Graph is a graph with its vertices partitioned
        into two groups, V1 and V2.  Each v in V1 is connected to every v
        in V2, and vice versa.  
        
        PLOTTING:
        Upon construction, the position dictionary is filled to override
        the spring-layout algorithm. By convention, each complete bipartite
        graph will be displayed with the first n1 nodes on the top row (at
        y=1) from left to right.  The remaining n2 nodes appear at y=0,
        also from left to right.  The shorter row (partition with fewer
        nodes) is stretched to the same length as the longer row, unless
        the shorter row has 1 node; in which case it is centered.  The x
        values in the plot are in domain [0,max{n1,n2}].  
                
        In the Complete Bipartite graph, there is a visual difference in
        using the spring-layout algorithm vs. the position dictionary used
        in this constructor.  The position dictionary flattens the graph
        and separates the partitioned nodes, making it clear which nodes
        an edge is connected to.  The Complete Bipartite graph plotted with
        the spring-layout algorithm tends to center the nodes in n1 (see
        spring_med in examples below), thus overlapping its nodes and edges,
        making it typically hard to decipher.
        
        Filling the position dictionary in advance adds O(n) to the
        constructor.  Feel free to race the constructors below in the
        examples section.  The much larger difference is the time added by
        the spring-layout algorithm when plotting.  (Also shown in the
        example below).  The spring model is typically described as O(n^3),
        as appears to be the case in the NetworkX source code.
        
        EXAMPLES:
            # The following examples require NetworkX (to use default)
            sage: import networkx as NX
            
            # Compare the constructors (results will vary)
            sage.: time n = NX.complete_bipartite_graph(389,157); spring_big = Graph(n)
            # CPU time: 9.28 s,  Wall time: 11.02 s
            sage.: time posdict_big = graphs.CompleteBipartiteGraph(389,157)
            # CPU time: 10.72 s,  Wall time: 13.84 s

            # Compare the plotting speeds (results will vary)
            sage: n = NX.complete_bipartite_graph(11,17)
            sage: spring_med = Graph(n)
            sage: posdict_med = graphs.CompleteBipartiteGraph(11,17)
            # Notice here how the spring-layout tends to center the nodes of n1
            sage.: time spring_med.show()
            # CPU time: 3.84 s,  Wall time: 4.49 s
            sage.: time posdict_med.show()
            # CPU time: 0.96 s,  Wall time: 1.14 s

            # View many Complete Bipartite graphs with a SAGE Graphics Array            
            
            # With this constructor (i.e., the position dictionary filled)
            sage: g = []
            sage: j = []
            sage: for i in range(9):
            ...    k = graphs.CompleteBipartiteGraph(i+1,4)
            ...    g.append(k)
            ...
            sage: for i in range(3):
            ...    n = []
            ...    for m in range(3):
            ...        n.append(g[3*i + m].plot(node_size=50, with_labels=False))
            ...    j.append(n)
            ...
            sage: G = sage.plot.plot.GraphicsArray(j)
            sage.: G.show()

            # Compared to plotting with the spring-layout algorithm
            sage: g = []
            sage: j = []
            sage: for i in range(9):
            ...    spr = NX.complete_bipartite_graph(i+1,4)       
            ...    k = Graph(spr)
            ...    g.append(k)
            ...
            sage: for i in range(3):
            ...    n = []
            ...    for m in range(3):
            ...        n.append(g[3*i + m].plot(node_size=50, with_labels=False))
            ...    j.append(n)
            ...
            sage: G = sage.plot.plot.GraphicsArray(j)
            sage.: G.show()
        """
        pos_dict = {}
        c1 = 1 # scaling factor for top row
        c2 = 1 # scaling factor for bottom row
        c3 = 0 # pad to center if top row has 1 node
        c4 = 0 # pad to center if bottom row has 1 node
        if n1 > n2:
            if n2 == 1:
                c4 = (n1-1)/2
            else:
                c2 = ((n1-1)/(n2-1))
        elif n2 > n1:
            if n1 == 1:
                c3 = (n2-1)/2
            else:
                c1 = ((n2-1)/(n1-1))
        for i in range(n1):
            x = c1*i + c3
            y = 1
            pos_dict[i] = [x,y]
        for i in range(n1+n2)[n1:]:
            x = c2*(i-n1) + c4
            y = 0
            pos_dict[i] = [x,y]
        G = NX.complete_bipartite_graph(n1,n2)
        return graph.Graph(G, pos=pos_dict, name="Complete bipartite graph on %d vertices"%(n1+n2))
rïh-j‘h.‰h]rð(Ugraphs.CompleteBipartiteGraph??rñUeh/U>ròh‰h0M0hÌUgraphs.CompleteBiróhU|os.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/3") graphs.CompleteBipartiteGraph??rôh2U&sage_notebook/worksheets/graph/cells/3rõh4U röh6‰h7Kh!h«h8h¬h&‰h9‰ub(h or÷}rø(j—Ugj™U!
rùj›j‘jœ‰j‰jžUjŸM0j ‰j¡U^os.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/5")
grúj£U&sage_notebook/worksheets/graph/cells/5rûj®UK
Complete bipartite graph on 105 vertices: a simple graph on 105 vertices

rüj§‰j¨Kj©h«j«j¬j­‰jª‰ub(horý}rþ(h*Ug.save('mygraph')rÿj™U!
rh-j‘h.‰j‰h/Uh0M0j ‰j¡Unos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/4")
g.save('mygraph')rh2U&sage_notebook/worksheets/graph/cells/4rh4U

rh6‰h7Kj©h«h8j¬j­‰h9‰ub(hor}r(j—U5P = plot(sin, 0, 10, rgbcolor=(0,0.5,0), thickness=5)rj™U!
rj›j‘jœ‰j‰jžUjŸM0j ‰j¡U’os.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/6")
P = plot(sin, 0, 10, rgbcolor=(0,0.5,0), thickness=5)rj£U&sage_notebook/worksheets/graph/cells/6r	j®U

r
j§‰j¨Kj©h«j«j¬j­‰jª‰ub(hor}r(j—UPj™U!
r
j›j‘jœ‰j‰jžUjŸM0j ‰j¡U^os.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/7")
Prj£U&sage_notebook/worksheets/graph/cells/7rj®U5
Graphics object consisting of 1 graphics primitive

rj§‰j¨Kj©h«j«j¬j­‰jª‰ub(hor}r(j—UP.show()rj™U!
rj›j‘jœ‰j‰jžU>rjŸM0j ‰j¡Ueos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/graph/cells/8")
P.show()rj£U&sage_notebook/worksheets/graph/cells/8rj®U

rj§‰j¨Kj©h«j«j¬j­‰jª‰ub(hor}r(j—Uj›j‘jœ‰jžUjŸM	0j£U&sage_notebook/worksheets/graph/cells/9rj®Uj§‰j¨Kj«j¬jª‰ubeU_Worksheet__synchrorKr,hGj%hH‰hI‰hJUhKMphL‰hMU}os.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/boothby2/cells/0")
A = MatrixSpace(ZZ,20).random_element()r-hOU)sage_notebook/worksheets/boothby2/cells/0r.hQU

r/hS‰hTh")Rr0hUKhVh%hW‰hX‰ub(hor1}r2(hCU#%time
A.characteristic_polynomial()r3hEU!
r4hGj%hH‰hI‰hJUhKMphL‰hMUžos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/boothby2/cells/1")
__SAGE_t__=cputime()
__SAGE_w__=walltime()
A.characteristic_polynomial()r5hkUA.char6hOU)sage_notebook/worksheets/boothby2/cells/1r7hQT`
x^20 + x^19 - 48*x^18 - 248*x^17 + 4281*x^16 - 6925*x^15 - 48119*x^14 - 707292*x^13 + 6241051*x^12 + 10172390*x^11 - 121169427*x^10 - 296266733*x^9 + 1505434256*x^8 + 3541680905*x^7 - 3496581918*x^6 - 191335962487*x^5 + 377854814060*x^4 + 1684293041404*x^3 - 12520145979924*x^2 - 8695150961834*x + 50834179507692
CPU time: 0.12 s,  Wall time: 0.19 s

r8hS‰hTj0hUKhVh%hWˆhX‰ub(hor9}r:(hCU.%time
a = latex(A.characteristic_polynomial())r;hEU!
r<hGj%hH‰hI‰hJUhKMphL‰hMU©os.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/boothby2/cells/2")
__SAGE_t__=cputime()
__SAGE_w__=walltime()
a = latex(A.characteristic_polynomial())r=hOU)sage_notebook/worksheets/boothby2/cells/2r>hQU'
CPU time: 0.00 s,  Wall time: 0.00 s

r?hS‰hTj0hUKhVh%hWˆhX‰ub(hor@}rA(hCUsave ArBhEU!
rChGj%hH‰hI‰hJUhKMphL‰hMU\os.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/boothby2/cells/3")
save ArDhkUsh.evalrEhOU)sage_notebook/worksheets/boothby2/cells/3rFhQU

rGhS‰hTj0hUKhVh%hW‰hX‰ub(horH}rI(hCUhEU!
rJhGj%hH‰hI‰hJUhKMphL‰hMUVos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/boothby2/cells/4")
rKhOU)sage_notebook/worksheets/boothby2/cells/4rLhQU

rMhS‰hTj0hUKhVh%hW‰hX‰ub(horN}rO(hCUhEU!
rPhGj%hH‰hI‰hJUhKMphL‰hMUVos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/boothby2/cells/5")
rQhOU)sage_notebook/worksheets/boothby2/cells/5rRhQU

rShS‰hTj0hUKhVh%hW‰hX‰ub(horT}rU(hCUplot(sin, 0,2*pi).show()rVhEU!
rWhGj%hH‰hI‰hJUArXhKMphL‰hMUnos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/boothby2/cells/6")
plot(sin, 0,2*pi).show()rYhOU)sage_notebook/worksheets/boothby2/cells/6rZhQU

r[hS‰hTj0hUKhVh%hW‰hX‰ub(hor\}r](hCUhGj%hH‰hJUhKMphOU)sage_notebook/worksheets/boothby2/cells/7r^hQUhS‰hUKhVh%hX‰ubejzKj{‰j|U!sage_notebook/worksheets/boothby2r_j~}r`j€U
11G3BJNEUV/Pkraj‚]rbj„Mphß]rc(U7A-sage.matrix.matrix_integer_dense.Matrix_integer_denserdUa-sage.misc.latex.LatexExprreej‡ˆjˆUboothby2rfjŠU1168037013.779448rgjŒhjKjŽKhêj0jNubUbernoull_modrh(hori}rj(h	Ubernoull_modrkh
]rl((horm}rn(hU(time v=bernoulli_mod_p(next_prime(10^5))rojÏT
File: /Users/was/s/local/lib/python/site-packages/sage/rings/bernoulli_mod_p.pyx
Source Code (starting at line 202):
def bernoulli_mod_p(int p):
    r"""
    Returns the bernoulli numbers $B_0, B_2, ... B_{p-3}$ modulo $p$.

    INPUT:
        p -- integer, a prime
    
    OUTPUT:
        list -- Bernoulli numbers modulo $p$ as a list
                of integers [B(0), B(2), ... B(p-3)].

    ALGORITHM:
        Described in accompanying latex file.
    
    PERFORMANCE:
        Should be complexity $O(p \log p)$.

    EXAMPLES:
    Check the results against PARI's C-library implemention (that
    computes exact rationals) for $p = 37$:
    
        sage: bernoulli_mod_p(37)
         [1, 31, 16, 15, 16, 4, 17, 32, 22, 31, 15, 15, 17, 12, 29, 2, 0, 2]
        sage: [bernoulli(n) % 37 for n in xrange(0, 36, 2)]
         [1, 31, 16, 15, 16, 4, 17, 32, 22, 31, 15, 15, 17, 12, 29, 2, 0, 2]

    Boundary case:
        sage: bernoulli_mod_p(3)
         [1]
        
    AUTHOR:
        -- David Harvey (2006-08-06)
    
    """

    if p <= 2:
        raise ValueError, "p (=%s) must be a prime >= 3"%p

    if not sage.libs.pari.gen.pari(p).isprime():
        raise ValueError, "p (=%s) must be a prime"%p

    ntl.set_modulus(ntl.ZZ(p))

    cdef int g, gSqr, gInv, gInvSqr, isOdd

    g = sage.rings.arith.primitive_root(p)
    gInv = arith_int.c_inverse_mod_int(g, p)
    gSqr = ((<llong> g) * g) % p
    gInvSqr = ((<llong> gInv) * gInv) % p
    isOdd = ((p-1)/2) % 2

    # STEP 1: compute the polynomials G(X) and J(X)

    # These hold g^{i-1} and g^{-i} at the beginning of each iteration
    cdef llong gPower, gPowerInv
    gPower = gInv
    gPowerInv = 1
    
    # "constant" is (g-1)/2 mod p
    cdef int constant
    if g % 2:
        constant = (g-1)/2
    else:
        constant = (g+p-1)/2
    
    # fudge holds g^{i^2}, fudgeInv holds g^{-i^2}
    cdef int fudge, fudgeInv
    fudge = fudgeInv = 1
    
    cdef ntl_ZZ_pX G, J
    G = ntl.ZZ_pX()
    J = ntl.ZZ_pX()
    G.preallocate_space((p-1)/2)
    J.preallocate_space((p-1)/2)

    cdef int i
    cdef llong temp, h
    for i from 0 <= i < (p-1)/2:
        # compute h = h(g^i)/g^i  (h(x) is as in latex notes)
        temp = g * gPower
        h = ((p + constant - (temp / p)) * gPowerInv) % p
        gPower = temp % p
        gPowerInv = (gPowerInv * gInv) % p
        
        # store the coefficient  g^{i^2} h(g^i)/g^i
        G.setitem_from_int(i, <int> ((h * fudge) % p))
        

        # store the coefficient  g^{-i^2}
        J.setitem_from_int(i, fudgeInv)
        
        # update fudge and fudgeInv
        fudge = (((fudge * gPower) % p) * ((gPower * g) % p)) % p
        fudgeInv = (((fudgeInv * gPowerInv) % p) * ((gPowerInv * g) % p)) % p
        
    J.setitem_from_int(0, 0)

    # STEP 2: multiply the polynomials

    cdef ntl_ZZ_pX product
    product = G * J
    
    # STEP 3: assemble the result
    
    cdef int gSqrPower, value
    output = [1]
    gSqrPower = gSqr
    fudge = g
    for i from 1 <= i < (p-1)/2:
        value = product.getitem_as_int(i + (p-1)/2)

        if isOdd:
            value = (G.getitem_as_int(i) + product.getitem_as_int(i) - value + p) % p
        else:
            value = (G.getitem_as_int(i) + product.getitem_as_int(i) + value) % p
        
        value = (((4 * i * (<llong> fudge)) % p) * (<llong> value)) % p
        value = ((<llong> value) * (arith_int.c_inverse_mod_int(1 - gSqrPower, p))) % p

        output.append(value)
        
        gSqrPower = ((<llong> gSqrPower) * g) % p
        fudge = ((<llong> fudge) * gSqrPower) % p
        gSqrPower = ((<llong> gSqrPower) * g) % p

    return output
rphjih‰jÑ]rq(Utime v=bernoulli_mod_p??rrUehUhM jÒ‰jÓUros.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/bernoull_mod/cells/0") time v=bernoulli_mod_p??rshU-sage_notebook/worksheets/bernoull_mod/cells/0rtjÖU bernoulli_moruh‰h KU _Cell__sagervh")Rrwh'‰h$h%jÚ‰hU' CPU time: 0.75 s, Wall time: 0.78 s rxub(h ory}rz(U _Cell__inr{U)time v=bernoulli_mod_p(next_prime(50000))r|U_Cell__introspect_htmlr}U!
r~U_Cell__worksheetrjiU_Cell__completionsr€‰U_Cell__introspectr‰U_Cell__out_htmlr‚UU	_Cell__idrƒM U_Cell__is_htmlr„‰U_before_preparser…U³os.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/bernoull_mod/cells/1")
__SAGE_t__=cputime()
__SAGE_w__=walltime()
v=bernoulli_mod_p(next_prime(50000))r†U
_Cell__dirr‡U-sage_notebook/worksheets/bernoull_mod/cells/1rˆU_word_being_completedr‰Ubernoulli_morŠUhas_new_outputr‹‰U_Cell__versionrŒKjvh«U_Cell__interruptedr‰U_Cell__typerŽjÙU_Cell__timerˆU
_Cell__outrU'
CPU time: 0.44 s,  Wall time: 0.47 s

r‘ub(hor’}r“(j{Ulen(v)r”j}U!
r•jjij€‰j‰j‚UjƒM j„‰j…Ujos.chdir("/Volumes/HOME/talks/2006-12-waterloo/sage/sage_notebook/worksheets/bernoull_mod/cells/2")
len(v)r–j‡U-sage_notebook/worksheets/bernoull_mod/cells/2r—jU
25010

r˜j‹‰jŒKjvh«jŽjÙj‰j‰ub(hor™}rš(j{Ujjij€‰j‚UjƒM j‡U-sage_notebook/worksheets/bernoull_mod/cells/4r›jUj‹‰jŒKjŽjÙj‰ubejKh܉hå}rœhß]rUv-listržahÝU%sage_notebook/worksheets/bernoull_modrŸhç]r héM hêjwhëˆhìUbernoull_modr¡híU1165187752.734722r¢hïhhðKj"KhòNhóU
11G3BJNEUV/Pkr£ubUboothby3r¤(hor¥}r¦(jdUboothby3r§jf]r¨((hor©}rª(hCUload Ar«hEU!
r¬hGj¥hH‰hI‰hJUhKM€hL‰hMU\os.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/boothby3/cells/0")
load Ar­hOU)sage_notebook/worksheets/boothby3/cells/0r®hQU

r¯hS‰hTh")Rr°hUKhVh%hW‰hX‰ub(hor±}r²(hCU
A.height()r³hEU!
r´hGj¥hH‰hI‰hJUhKM€hL‰hMU`os.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/boothby3/cells/1")
A.height()rµhkUA.r¶hOU)sage_notebook/worksheets/boothby3/cells/1r·hQU
2

r¸hS‰hTj°hUKhVh%hW‰hX‰ub(hor¹}rº(hCUhGj¥hH‰hJUhKM€hOU)sage_notebook/worksheets/boothby3/cells/2r»hQUhS‰hUKhVh%hX‰ubejzKj{‰j|U!sage_notebook/worksheets/boothby3r¼j~}r½j€U
11G3BJNEUV/Pkr¾j‚]r¿j„M€hß]rÀ(U7A-sage.matrix.matrix_integer_dense.Matrix_integer_denserÁU7a-sage.matrix.matrix_integer_dense.Matrix_integer_denserÂej‡ˆjˆUboothby3rÃjŠU1168037684.457517rÄjŒhjKjŽKhêj°jNubUfactorrÅ(horÆ}rÇ(U_Worksheet__filenamerÈUfactorrÉU_Worksheet__cellsrÊ]rË((csage.server.notebook.cell
TextCell
rÌorÍ}rÎ(U_TextCell__worksheetrÏjÆU_TextCell__textrÐUú

Factor Tree Worksheet

This worksheet uses the SAGE Notebook to illustrate integer factorization as a product of primes using the ``factor trees'' that students learn about in school.rÑU _TextCell__idrÒM@ub(h orÓ}rÔ(hþTÙ%hideall #auto # The source code to draw factorization trees... import random def factor_tree(n, font=10): rows = [] v = [(n,None,0)] ftree(rows, v, 0, factor(n)) return draw_ftree(rows, font) def ftree(rows, v, i, F): if len(v) > 0: # add a row to g at the ith level. rows.append(v) w = [] for i in range(len(v)): k, _,_ = v[i] if k is None or is_prime(k): w.append((None,None,None)) else: d = random.choice(divisors(k)[1:-1]) w.append((d,k,i)) e = k//d if e == 1: w.append((None,None)) else: w.append((e,k,i)) if len(w) > len(v): ftree(rows, w, i+1, F) def draw_ftree(rows,font): g = Graphics() for i in range(len(rows)): cur = rows[i] for j in range(len(cur)): e, f, k = cur[j] if not e is None: if is_prime(e): c = (1,0,0) else: c = (0,0,.4) g += text(str(e), (j*2-len(cur),-i), fontsize=font, rgbcolor=c) if not k is None and not f is None: g += line([(j*2-len(cur),-i), (k*2-len(rows[i-1]),-i+1)], alpha=0.4, thickness=1) return g def factor_trees(n, cols=4, rows=3, font=10): return graphics_array([[factor_tree(n,font) for _ in range(cols)] for _ in range(rows)])rÕjU!
rÖjjÆj‰jUjM@j	‰j
TYos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/factor/cells/21")
__SAGE_t__=cputime()
__SAGE_w__=walltime()
%hideall
#auto

# The source code to draw factorization trees...

import random

def factor_tree(n, font=10):
    rows = []
    v = [(n,None,0)]
    ftree(rows, v, 0, factor(n))
    return draw_ftree(rows, font)

def ftree(rows, v, i, F):
    if len(v) > 0:
        # add a row to g at the ith level. 
        rows.append(v)
    w = []
    for i in range(len(v)):
        k, _,_ = v[i]
        if k is None or is_prime(k):
            w.append((None,None,None))
        else:
            d = random.choice(divisors(k)[1:-1])
            w.append((d,k,i))
            e = k//d
            if e == 1:
                w.append((None,None))
            else:
                w.append((e,k,i))
    if len(w) > len(v):
        ftree(rows, w, i+1, F)


def draw_ftree(rows,font):
    g = Graphics()
    for i in range(len(rows)):
        cur = rows[i]
        for j in range(len(cur)):
            e, f, k = cur[j]
            if not e is None:
                if is_prime(e):
                     c = (1,0,0)
                else:
                     c = (0,0,.4)
                g += text(str(e), (j*2-len(cur),-i), fontsize=font, rgbcolor=c)
                if not k is None and not f is None:
                    g += line([(j*2-len(cur),-i), (k*2-len(rows[i-1]),-i+1)], alpha=0.4, thickness=1) 
    return g

def factor_trees(n, cols=4, rows=3, font=10):
    return graphics_array([[factor_tree(n,font) for _ in range(cols)] for _ in range(rows)])r×jU(sage_notebook/worksheets/factor/cells/21rØjU'
CPU time: 0.00 s,  Wall time: 0.00 s

rÙj‰jKjh")RrÚj‰ub(jÌorÛ}rÜ(jÏjÆjÐU
rÝjÒM@ub(h orÞ}rß(hþUQF = factor_trees(2007, rows=1, cols=1, font=8) F.show(axes=False, figsize=[10,6])ràjU!
rájjÆj‰j‰jU@râjM@j‰j	‰j
U¦os.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/factor/cells/23")
F = factor_trees(2007, rows=1, cols=1, font=8)
F.show(axes=False, figsize=[10,6])rãjU(sage_notebook/worksheets/factor/cells/23räjU

råj‰jKjjÚjh%j‰ub(horæ}rç(hþUbF = factor_tree(prod(primes(40)))
F.show(xmin=-3,xmax=7,ymin=-5,ymax=0.5,figsize=[8,2],axes=False)rèjU!
réjjÆj‰j‰jU@rêjM@j‰j	‰j
U·os.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/factor/cells/24")
F = factor_tree(prod(primes(40)))
F.show(xmin=-3,xmax=7,ymin=-5,ymax=0.5,figsize=[8,2],axes=False)rëjU(sage_notebook/worksheets/factor/cells/24rìjU

ríj‰jKjh«jjj‰ub(horî}rï(hþU9show(factor_trees(1200,cols=3,rows=3),axes=False,dpi=100)rðjU!
rñjjÆj‰j‰jU@ròjM@j‰j	‰j
UŽos.chdir("/Users/was/talks/2007-01-05-msr/sage_notebook/worksheets/factor/cells/25")
show(factor_trees(1200,cols=3,rows=3),axes=False,dpi=100)rójU(sage_notebook/worksheets/factor/cells/25rôjU

rõj‰jKjh«jjj‰ub(horö}r÷(hþUjjÆj‰jUjM@jU(sage_notebook/worksheets/factor/cells/26røjUj‰jKjjj‰ubeU_Worksheet__synchrorùKU_Worksheet__comp_is_runningrú‰U_Worksheet__attachedrû}rühß]rý(UF-sage.plot.plot.GraphicsArrayrþUdraw_ftree-functionrÿUfactor_tree-functionrUfactor_trees-functionrUftree-functionrU
random-modulereU_Worksheet__dirrUsage_notebook/worksheets/factorrU_Worksheet__queuer]rU_Worksheet__next_idrM@hêjÚU_Worksheet__passcryptr	ˆU_Worksheet__namer
UfactorrU_Worksheet__saltrU1165225547.833440r
U_Worksheet__notebookrhU_Worksheet__idrKU_Worksheet__next_block_idrKU_Worksheet__systemrNU_Worksheet__passcoderU
11G3BJNEUV/PkrubUtestr(hor}r(U_Worksheet__filenamerUtestrU_Worksheet__cellsr]r(hor}r(j{Ujjj€‰j‚UjƒMPj‡U%sage_notebook/worksheets/test/cells/0rjUj‹‰jŒKjŽjÙj‰ubaU_Worksheet__namerUtestrU_Worksheet__attachedr }r!U_Worksheet__dirr"Usage_notebook/worksheets/testr#U_Worksheet__queuer$]r%U_Worksheet__next_idr&MPU_Worksheet__passcryptr'ˆU_Worksheet__comp_is_runningr(‰U_Worksheet__saltr)U1165250401.859302r*U_Worksheet__notebookr+hU_Worksheet__idr,KU_Worksheet__systemr-NU_Worksheet__passcoder.U
11G3BJNEUV/Pkr/ubuU_Notebook__historyr0]r1(U¨# Worksheet 'graph' (2006-12-03 at 15:35)
sage: g = graphs.StarGraph()
Traceback (most recent call last):
...
TypeError: StarGraph() takes exactly 2 arguments (1 given)r2UK# Worksheet 'graph' (2006-12-03 at 15:35)
sage: g = graphs.PetersenGraph()
r3U8# Worksheet 'graph' (2006-12-03 at 15:35)
sage: show(g)
r4T¶# Worksheet 'factor' (2006-12-04 at 01:46)
sage: %hide
sage: print "CLICK ABOVE FOR THE SOURCE CODE"
sage: # The source code to draw factorization trees...
sage: import random
sage: def factor_tree(n, font=10):
...    rows = []
...    v = [(n,None,0)]
...    ftree(rows, v, 0, factor(n))
...    return draw_ftree(rows, font)
...
sage: def ftree(rows, v, i, F):
...    if len(v) > 0:
...        # add a row to g at the ith level. 
...        rows.append(v)
...    w = []
...    for i in range(len(v)):
...        k, _,_ = v[i]
...        if k is None or is_prime(k):
...            w.append((None,None,None))
...        else:
...            d = random.choice(divisors(k)[1:-1])
...            w.append((d,k,i))
...            e = k//d
...            if e == 1:
...                w.append((None,None))
...            else:
...                w.append((e,k,i))
...    if len(w) > len(v):
...        ftree(rows, w, i+1, F)
...
sage: def draw_ftree(rows,font):
...    g = Graphics()
...    for i in range(len(rows)):
...        cur = rows[i]
...        for j in range(len(cur)):
...            e, f, k = cur[j]
...            if not e is None:
...                if is_prime(e):
...                     c = (1,0,0)
...                else:
...                     c = (0,0,.4)
...                g += text(str(e), (j*2-len(cur),-i), fontsize=font, rgbcolor=c)
...                if not k is None and not f is None:
...                    g += line([(j*2-len(cur),-i), (k*2-len(rows[i-1]),-i+1)], alpha=0.4, thickness=0.4) 
...    return g
...
sage: def factor_trees(n, cols=4, rows=3, font=10):
...    return graphics_array([[factor_tree(n,font) for _ in range(cols)] for _ in range(rows)])
CLICK ABOVE FOR THE SOURCE CODEr5UŽ# Worksheet 'factor' (2006-12-04 at 01:46)
sage: F = factor_trees(300000000, rows=1, cols=1, font=8)
sage: F.show(axes=False, figsize=[10,6])
r6Uš# Worksheet 'factor' (2006-12-04 at 01:46)
sage: F = factor_tree(prod(primes(30)))
sage: F.show(xmin=-3,xmax=7,ymin=-5,ymax=0.5,figsize=[8,2],axes=False)
r7Uk# Worksheet 'factor' (2006-12-04 at 01:46)
sage: show(factor_trees(1200,cols=3,rows=3),axes=False,dpi=100)
r8U,# Worksheet 'factor' (2006-12-04 at 01:46)

r9U,# Worksheet 'factor' (2006-12-04 at 01:46)

r:UK# Worksheet 'graph' (2006-12-04 at 08:38)
sage: g = graphs.PetersenGraph()
r;U8# Worksheet 'graph' (2006-12-04 at 08:38)
sage: show(g)
r<UK# Worksheet 'graph' (2006-12-04 at 08:38)
sage: g = graphs.PetersenGraph()
r=U8# Worksheet 'graph' (2006-12-04 at 08:38)
sage: show(g)
r>T´# Worksheet 'factor' (2006-12-04 at 08:38)
sage: %hide
sage: print "CLICK ABOVE FOR THE SOURCE CODE"
sage: # The source code to draw factorization trees...
sage: import random
sage: def factor_tree(n, font=10):
...    rows = []
...    v = [(n,None,0)]
...    ftree(rows, v, 0, factor(n))
...    return draw_ftree(rows, font)
...
sage: def ftree(rows, v, i, F):
...    if len(v) > 0:
...        # add a row to g at the ith level. 
...        rows.append(v)
...    w = []
...    for i in range(len(v)):
...        k, _,_ = v[i]
...        if k is None or is_prime(k):
...            w.append((None,None,None))
...        else:
...            d = random.choice(divisors(k)[1:-1])
...            w.append((d,k,i))
...            e = k//d
...            if e == 1:
...                w.append((None,None))
...            else:
...                w.append((e,k,i))
...    if len(w) > len(v):
...        ftree(rows, w, i+1, F)
...
sage: def draw_ftree(rows,font):
...    g = Graphics()
...    for i in range(len(rows)):
...        cur = rows[i]
...        for j in range(len(cur)):
...            e, f, k = cur[j]
...            if not e is None:
...                if is_prime(e):
...                     c = (1,0,0)
...                else:
...                     c = (0,0,.4)
...                g += text(str(e), (j*2-len(cur),-i), fontsize=font, rgbcolor=c)
...                if not k is None and not f is None:
...                    g += line([(j*2-len(cur),-i), (k*2-len(rows[i-1]),-i+1)], alpha=0.4, thickness=1) 
...    return g
...
sage: def factor_trees(n, cols=4, rows=3, font=10):
...    return graphics_array([[factor_tree(n,font) for _ in range(cols)] for _ in range(rows)])
CLICK ABOVE FOR THE SOURCE CODEr?UŽ# Worksheet 'factor' (2006-12-04 at 08:38)
sage: F = factor_trees(300000000, rows=1, cols=1, font=8)
sage: F.show(axes=False, figsize=[10,6])
r@Uš# Worksheet 'factor' (2006-12-04 at 08:38)
sage: F = factor_tree(prod(primes(30)))
sage: F.show(xmin=-3,xmax=7,ymin=-5,ymax=0.5,figsize=[8,2],axes=False)
rAUš# Worksheet 'factor' (2006-12-04 at 08:39)
sage: F = factor_tree(prod(primes(40)))
sage: F.show(xmin=-3,xmax=7,ymin=-5,ymax=0.5,figsize=[8,2],axes=False)
rBUš# Worksheet 'factor' (2006-12-04 at 08:39)
sage: F = factor_tree(prod(primes(40)))
sage: F.show(xmin=-3,xmax=7,ymin=-5,ymax=0.5,figsize=[8,2],axes=False)
rCUŽ# Worksheet 'bernoull_mod' (2006-12-04 at 08:43)
sage: bernoulli_mod_p(37)
[1, 31, 16, 15, 16, 4, 17, 32, 22, 31, 15, 15, 17, 12, 29, 2, 0, 2]rDU„# Worksheet 'bernoull_mod' (2006-12-04 at 08:43)
sage: time v=bernoulli_mod_p(next_prime(5000))
CPU time: 0.03 s,  Wall time: 0.07 srEUB# Worksheet 'bernoull_mod' (2006-12-04 at 08:44)
sage: len(v)
2501rFT# Worksheet 'bernoull_mod' (2006-12-04 at 08:44)
sage: v
[1, 834, 2835, 2978, 2835, 3108, 2285, 835, 4888, 2243, 4580, 2458, 756, 496, 1317, 2489, 3478, 4680, 3187, 2262, 2324, 4505, 4911, 2558, 4545, 905, 8, 377, 3917, 4639, 3600, 117, 2518, 229, 2505, 1860, 1165, 3868, 1535, 3272, 3541, 2424, 2600, 4612, 4701, 2935, 709, 2363, 2790, 1538, 1367, 1803, 2090, 4292, 3056, 2545, 2590, 1578, 1042, 3748, 1051, 3430, 125, 3684, 1830, 3890, 3630, 2170, 4351, 50, 2361, 3842, 1265, 2985, 3199, 11, 4662, 2269, 833, 2141, ...rGU…# Worksheet 'bernoull_mod' (2006-12-04 at 08:44)
sage: time v=bernoulli_mod_p(next_prime(50000))
CPU time: 0.44 s,  Wall time: 0.47 srHUC# Worksheet 'bernoull_mod' (2006-12-04 at 08:44)
sage: len(v)
25010rIUŽ# Worksheet 'bernoull_mod' (2006-12-04 at 08:44)
sage: bernoulli_mod_p(37)
[1, 31, 16, 15, 16, 4, 17, 32, 22, 31, 15, 15, 17, 12, 29, 2, 0, 2]rJU0# Worksheet '' (2006-12-04 at 13:44)
sage: 2+3
5rKU0# Worksheet '' (2006-12-04 at 13:44)
sage: 2+5
7rLUP# Worksheet '' (2006-12-04 at 13:44)
sage: E = magma.EllipticCurve([1,2,3,4,5])
rMU‚# Worksheet '' (2006-12-04 at 13:44)
sage: E
Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational FieldrNU_# Worksheet '' (2006-12-04 at 13:44)
sage: type(E)
rOU?# Worksheet '' (2006-12-04 at 13:45)
sage: E.name()
'_sage_[7]'rPU5# Worksheet '' (2006-12-04 at 13:45)
sage: E.Rank()
1rQU<# Worksheet '' (2006-12-04 at 13:45)
sage: a = maple('2+3')
rRU.# Worksheet '' (2006-12-04 at 13:45)
sage: a
5rSU=# Worksheet '' (2006-12-04 at 13:46)
sage: a = maple('2007')
rTU1# Worksheet '' (2006-12-04 at 13:46)
sage: a
2007rUUF# Worksheet '' (2006-12-04 at 13:46)
sage: a.ifactor()
``(3)^2*``(223)rVU;# Worksheet '' (2006-12-04 at 13:46)
sage: a.name()
'sage1'rWUV# Worksheet '' (2006-12-04 at 13:47)
sage: for i in range(5):
...    print i
0
1
2
3
4rXUY# Worksheet 'graph' (2006-12-04 at 14:09)
sage: g = graphs.CompleteBipartiteGraph(5,100)
rYU8# Worksheet 'graph' (2006-12-04 at 14:09)
sage: show(g)
rZU{# Worksheet 'graph' (2006-12-04 at 14:16)
sage: g
Traceback (most recent call last):
...
NameError: name 'g' is not definedr[UY# Worksheet 'graph' (2006-12-04 at 14:16)
sage: g = graphs.CompleteBipartiteGraph(5,100)
r\Uz# Worksheet 'graph' (2006-12-04 at 14:16)
sage: g
Complete bipartite graph on 105 vertices: a simple graph on 105 verticesr]UB# Worksheet 'graph' (2006-12-04 at 14:16)
sage: g.save('mygraph')
r^UW# Worksheet 'graph' (2006-12-04 at 14:18)
sage: P = plot(sin, 0, 10, rgbcolor=(1,1,0))
r_Ud# Worksheet 'graph' (2006-12-04 at 14:18)
sage: P
Graphics object consisting of 1 graphics primitiver`U9# Worksheet 'graph' (2006-12-04 at 14:18)
sage: P.show()
raUY# Worksheet 'graph' (2006-12-04 at 14:18)
sage: P = plot(sin, 0, 10, rgbcolor=(0,0.5,0))
rbUd# Worksheet 'graph' (2006-12-04 at 14:18)
sage: P
Graphics object consisting of 1 graphics primitivercU9# Worksheet 'graph' (2006-12-04 at 14:18)
sage: P.show()
rdUf# Worksheet 'graph' (2006-12-04 at 14:18)
sage: P = plot(sin, 0, 10, rgbcolor=(0,0.5,0), thickness=5)
reUd# Worksheet 'graph' (2006-12-04 at 14:18)
sage: P
Graphics object consisting of 1 graphics primitiverfU9# Worksheet 'graph' (2006-12-04 at 14:18)
sage: P.show()
rgU™# Worksheet 'graph' (2006-12-04 at 14:25)
sage: bernoulli(100)
-94598037819122125295227433069493721872702841533066936133385696204311395415197247711/33330rhUJ# Worksheet 'graph' (2006-12-04 at 14:25)
sage: E = EllipticCurve('389a')
riUG# Worksheet 'graph' (2006-12-04 at 14:25)
sage: L = E.Lseries_zeros(2)
rjUL# Worksheet 'graph' (2006-12-04 at 14:25)
sage: L
[0.000000000, 0.000000000]rkUG# Worksheet 'graph' (2006-12-04 at 14:25)
sage: L = E.Lseries_zeros(5)
rlUp# Worksheet 'graph' (2006-12-04 at 14:26)
sage: L
[0.000000000, 0.000000000, 2.87609907, 4.41689608, 5.79340263]rmU~# Worksheet 'graph' (2006-12-04 at 14:27)
sage: time b = bernoulli(1000, algorithm='gap')
CPU time: 0.06 s,  Wall time: 4.59 srnU~# Worksheet 'graph' (2006-12-04 at 14:27)
sage: time b = bernoulli(1000, algorithm='gap')
CPU time: 0.01 s,  Wall time: 0.01 sroU~# Worksheet 'graph' (2006-12-04 at 14:27)
sage: time b = bernoulli(1002, algorithm='gap')
CPU time: 0.02 s,  Wall time: 0.03 srpU€# Worksheet 'graph' (2006-12-04 at 14:28)
sage: time b = bernoulli(10000, algorithm='pari')
CPU time: 0.44 s,  Wall time: 0.48 srqU€# Worksheet 'graph' (2006-12-04 at 14:28)
sage: time b = bernoulli(10000, algorithm='pari')
CPU time: 0.24 s,  Wall time: 0.27 srrU€# Worksheet 'graph' (2006-12-04 at 14:28)
sage: time b = bernoulli(10000, algorithm='pari')
CPU time: 0.24 s,  Wall time: 0.26 srsU€# Worksheet 'graph' (2006-12-04 at 14:28)
sage: time b = bernoulli(10000, algorithm='pari')
CPU time: 0.24 s,  Wall time: 0.26 srtU0# Worksheet '' (2007-01-05 at 09:53)
sage: 2+3
5ruU0# Worksheet '' (2007-01-05 at 09:53)
sage: 2+5
7rvTþ# Worksheet 'factor' (2007-01-05 at 09:54)
sage: %hideall
sage: #auto
sage: 
sage: # The source code to draw factorization trees...
sage: 
sage: import random
sage: 
sage: def factor_tree(n, font=10):
...    rows = []
...    v = [(n,None,0)]
...    ftree(rows, v, 0, factor(n))
...    return draw_ftree(rows, font)
...
sage: 
sage: def ftree(rows, v, i, F):
...    if len(v) > 0:
...        # add a row to g at the ith level. 
...        rows.append(v)
...    w = []
...    for i in range(len(v)):
...        k, _,_ = v[i]
...        if k is None or is_prime(k):
...            w.append((None,None,None))
...        else:
...            d = random.choice(divisors(k)[1:-1])
...            w.append((d,k,i))
...            e = k//d
...            if e == 1:
...                w.append((None,None))
...            else:
...                w.append((e,k,i))
...    if len(w) > len(v):
...        ftree(rows, w, i+1, F)
...
sage: 
sage: 
sage: def draw_ftree(rows,font):
...    g = Graphics()
...    for i in range(len(rows)):
...        cur = rows[i]
...        for j in range(len(cur)):
...            e, f, k = cur[j]
...            if not e is None:
...                if is_prime(e):
...                     c = (1,0,0)
...                else:
...                     c = (0,0,.4)
...                g += text(str(e), (j*2-len(cur),-i), fontsize=font, rgbcolor=c)
...                if not k is None and not f is None:
...                    g += line([(j*2-len(cur),-i), (k*2-len(rows[i-1]),-i+1)], alpha=0.4, thickness=1) 
...    return g
...
sage: 
sage: def factor_trees(n, cols=4, rows=3, font=10):
...    return graphics_array([[factor_tree(n,font) for _ in range(cols)] for _ in range(rows)])
CPU time: 0.00 s,  Wall time: 0.00 srwUŽ# Worksheet 'factor' (2007-01-05 at 09:54)
sage: F = factor_trees(300000000, rows=1, cols=1, font=8)
sage: F.show(axes=False, figsize=[10,6])
rxUš# Worksheet 'factor' (2007-01-05 at 09:54)
sage: F = factor_tree(prod(primes(40)))
sage: F.show(xmin=-3,xmax=7,ymin=-5,ymax=0.5,figsize=[8,2],axes=False)
ryUk# Worksheet 'factor' (2007-01-05 at 09:54)
sage: show(factor_trees(1200,cols=3,rows=3),axes=False,dpi=100)
rzUY# Worksheet 'qsieve' (2007-01-05 at 09:55)
sage: n = next_prime(10^21)*next_prime(10^22)
r{U•# Worksheet 'qsieve' (2007-01-05 at 09:55)
sage: time factor(n)
1000000000000000000117 * 10000000000000000000009
CPU time: 0.53 s,  Wall time: 0.78 sr|Uœ# Worksheet 'qsieve' (2007-01-05 at 09:55)
sage: time qsieve(n)
([1000000000000000000117, 10000000000000000000009], '')
CPU time: 0.00 s,  Wall time: 0.53 sr}UY# Worksheet 'qsieve' (2007-01-05 at 09:55)
sage: n = next_prime(10^22)*next_prime(10^24)
r~U˜# Worksheet 'qsieve' (2007-01-05 at 09:55)
sage: time factor(n)
10000000000000000000009 * 1000000000000000000000007
CPU time: 0.95 s,  Wall time: 1.51 srUŸ# Worksheet 'qsieve' (2007-01-05 at 09:55)
sage: time qsieve(n)
([10000000000000000000009, 1000000000000000000000007], '')
CPU time: 0.01 s,  Wall time: 0.81 sr€UY# Worksheet 'qsieve' (2007-01-05 at 09:55)
sage: n = next_prime(10^24)*next_prime(10^26)
rUœ# Worksheet 'qsieve' (2007-01-05 at 09:55)
sage: time factor(n)
1000000000000000000000007 * 100000000000000000000000067
CPU time: 2.30 s,  Wall time: 3.65 sr‚U£# Worksheet 'qsieve' (2007-01-05 at 09:55)
sage: time qsieve(n)
([1000000000000000000000007, 100000000000000000000000067], '')
CPU time: 0.01 s,  Wall time: 2.08 srƒU°# Worksheet 'qsieve' (2007-01-05 at 09:55)
sage: qsieve(n, time=True)
([1000000000000000000000007, 100000000000000000000000067], '2.55 real         1.46 user         0.01 sys')r„UY# Worksheet 'qsieve' (2007-01-05 at 09:56)
sage: n = next_prime(10^25)*next_prime(10^27)
r…Už# Worksheet 'qsieve' (2007-01-05 at 09:56)
sage: time factor(n)
10000000000000000000000013 * 1000000000000000000000000103
CPU time: 3.60 s,  Wall time: 5.46 sr†Uœ# Worksheet 'qsieve' (2007-01-05 at 09:56)
sage: n = next_prime(10^25)*next_prime(10^27)
sage: print n
10000000000000000000000014030000000000000000000001339r‡U²# Worksheet 'qsieve' (2007-01-05 at 09:56)
sage: qsieve(n, time=True)
([10000000000000000000000013, 1000000000000000000000000103], '2.71 real         2.06 user         0.01 sys')rˆUÐ# Worksheet 'qsieve' (2007-01-05 at 09:56)
sage: F, t = qsieve(n, time=True)
sage: print F
sage: print t
[10000000000000000000000013, 1000000000000000000000000103]
2.73 real         2.06 user         0.01 sysr‰Už# Worksheet 'qsieve' (2007-01-05 at 09:56)
sage: n = next_prime(10^26)*next_prime(10^28)
sage: print n
1000000000000000000000000703100000000000000000000022177rŠU # Worksheet 'qsieve' (2007-01-05 at 09:56)
sage: time factor(n)
100000000000000000000000067 * 10000000000000000000000000331
CPU time: 5.33 s,  Wall time: 8.05 sr‹UÒ# Worksheet 'qsieve' (2007-01-05 at 09:56)
sage: F, t = qsieve(n, time=True)
sage: print F
sage: print t
[100000000000000000000000067, 10000000000000000000000000331]
4.96 real         3.46 user         0.02 sysrŒU¡# Worksheet 'qsieve' (2007-01-05 at 09:58)
sage: n = next_prime(10^27)*next_prime(10^30)
sage: print n
1000000000000000000000000103057000000000000000000000005871rU¥# Worksheet 'qsieve' (2007-01-05 at 09:58)
sage: time factor(n)
1000000000000000000000000103 * 1000000000000000000000000000057
CPU time: 12.82 s,  Wall time: 19.37 srŽUÖ# Worksheet 'qsieve' (2007-01-05 at 09:59)
sage: F, t = qsieve(n, time=True)
sage: print F
sage: print t
[1000000000000000000000000103, 1000000000000000000000000000057]
12.09 real         8.88 user         0.06 sysrU¤# Worksheet 'qsieve' (2007-01-05 at 09:59)
sage: n = next_prime(10^29)*next_prime(10^31)
sage: print n
1000000000000000000000000003193300000000000000000000000010527rU¨# Worksheet 'qsieve' (2007-01-05 at 10:00)
sage: time factor(n)
100000000000000000000000000319 * 10000000000000000000000000000033
CPU time: 27.28 s,  Wall time: 41.15 sr‘UÙ# Worksheet 'qsieve' (2007-01-05 at 10:00)
sage: F, t = qsieve(n, time=True)
sage: print F
sage: print t
[100000000000000000000000000319, 10000000000000000000000000000033]
22.45 real        15.22 user         0.11 sysr’U¬# Worksheet 'qsieve' (2007-01-05 at 10:19)
sage: n = next_prime(10^33)*next_prime(10^35)
sage: print n
100000000000000000000000000000006169000000000000000000000000000004209r“U©# Worksheet 'qsieve' (2007-01-05 at 10:21)
sage: n = next_prime(10^32)*next_prime(10^33)
sage: print n
100000000000000000000000000000055100000000000000000000000000002989r”UÞ# Worksheet 'qsieve' (2007-01-05 at 10:22)
sage: F, t = qsieve(n, time=True)
sage: print F
sage: print t
[100000000000000000000000000000049, 1000000000000000000000000000000061]
80.95 real        45.56 user         0.49 sysr•U­# Worksheet 'qsieve' (2007-01-05 at 10:24)
sage: time factor(n)
100000000000000000000000000000049 * 1000000000000000000000000000000061
CPU time: 64.23 s,  Wall time: 87.90 sr–UW# Worksheet 'qsieve' (2007-01-05 at 10:41)
sage: q = qsieve(n, time=True, block=False)
r—UL# Worksheet 'qsieve' (2007-01-05 at 10:41)
sage: q
Proper factors so far: []r˜U?# Worksheet 'qsieve' (2007-01-05 at 10:41)
sage: q.done()
Falser™U6# Worksheet 'qsieve' (2007-01-05 at 10:41)
sage: 2+2
4ršT# Worksheet 'qsieve' (2007-01-05 at 10:41)
sage: q.log()
'Input number to factor [ >=40 decimal digits]: 100000000000000000000000000000055100000000000000000000000000002989\r\n\r\n\r\n\r\n100 relations, 9 partials.\r\n1260 curves.\r\n200 relations, 15 partials.\r\n2520 curves.\r\n300 relations, 25 partials.\r\n400 relations, 38 partials.\r\n3780 curves.\r\n500 relations, 46 partials.\r\n600 relations, 55 partials.\r\n5040 curves.\r\n700 relations, 61 partials.\r\n6300 curves.\r\n800 relations, 70 partials.\r\n900...r›T# Worksheet 'qsieve' (2007-01-05 at 10:41)
sage: print q.log()
Input number to factor [ >=40 decimal digits]: 100000000000000000000000000000055100000000000000000000000000002989



100 relations, 9 partials.
1260 curves.
200 relations, 15 partials.
2520 curves.
300 relations, 25 partials.
400 relations, 38 partials.
3780 curves.
500 relations, 46 partials.
600 relations, 55 partials.
5040 curves.
700 relations, 61 partials.
6300 curves.
800 relations, 70 partials.
900 relations, 81 partials.
7560 curves.
1000 relations...rœU?# Worksheet 'qsieve' (2007-01-05 at 10:45)
sage: q.done()
FalserU?# Worksheet 'qsieve' (2007-01-05 at 10:45)
sage: q.done()
FalseržUL# Worksheet 'qsieve' (2007-01-05 at 10:45)
sage: q
Proper factors so far: []rŸT# Worksheet 'qsieve' (2007-01-05 at 10:46)
sage: print q.log()
Input number to factor [ >=40 decimal digits]: 100000000000000000000000000000055100000000000000000000000000002989



100 relations, 9 partials.
1260 curves.
200 relations, 15 partials.
2520 curves.
300 relations, 25 partials.
400 relations, 38 partials.
3780 curves.
500 relations, 46 partials.
600 relations, 55 partials.
5040 curves.
700 relations, 61 partials.
6300 curves.
800 relations, 70 partials.
900 relations, 81 partials.
7560 curves.
1000 relations...r T# Worksheet 'qsieve' (2007-01-05 at 10:46)
sage: print q.log()
Input number to factor [ >=40 decimal digits]: 100000000000000000000000000000055100000000000000000000000000002989



100 relations, 9 partials.
1260 curves.
200 relations, 15 partials.
2520 curves.
300 relations, 25 partials.
400 relations, 38 partials.
3780 curves.
500 relations, 46 partials.
600 relations, 55 partials.
5040 curves.
700 relations, 61 partials.
6300 curves.
800 relations, 70 partials.
900 relations, 81 partials.
7560 curves.
1000 relations...r¡U¡# Worksheet 'qsieve' (2007-01-05 at 10:46)
sage: q.stop()
Traceback (most recent call last):
...
AttributeError: qsieve_nonblock instance has no attribute 'stop'r¢U²# Worksheet 'qsieve' (2007-01-05 at 10:46)
sage: q.quit()
Traceback (most recent call last):
...
pexpect.ExceptionPexpect: close() could not terminate the child using terminate()r£U:# Worksheet 'qsieve' (2007-01-05 at 10:46)
sage: q.quit()
r¤U;# Worksheet 'qsieve' (2007-01-05 at 10:46)
sage: q
([], '')r¥Tþ# Worksheet 'factor' (2007-01-05 at 14:27)
sage: %hideall
sage: #auto
sage: 
sage: # The source code to draw factorization trees...
sage: 
sage: import random
sage: 
sage: def factor_tree(n, font=10):
...    rows = []
...    v = [(n,None,0)]
...    ftree(rows, v, 0, factor(n))
...    return draw_ftree(rows, font)
...
sage: 
sage: def ftree(rows, v, i, F):
...    if len(v) > 0:
...        # add a row to g at the ith level. 
...        rows.append(v)
...    w = []
...    for i in range(len(v)):
...        k, _,_ = v[i]
...        if k is None or is_prime(k):
...            w.append((None,None,None))
...        else:
...            d = random.choice(divisors(k)[1:-1])
...            w.append((d,k,i))
...            e = k//d
...            if e == 1:
...                w.append((None,None))
...            else:
...                w.append((e,k,i))
...    if len(w) > len(v):
...        ftree(rows, w, i+1, F)
...
sage: 
sage: 
sage: def draw_ftree(rows,font):
...    g = Graphics()
...    for i in range(len(rows)):
...        cur = rows[i]
...        for j in range(len(cur)):
...            e, f, k = cur[j]
...            if not e is None:
...                if is_prime(e):
...                     c = (1,0,0)
...                else:
...                     c = (0,0,.4)
...                g += text(str(e), (j*2-len(cur),-i), fontsize=font, rgbcolor=c)
...                if not k is None and not f is None:
...                    g += line([(j*2-len(cur),-i), (k*2-len(rows[i-1]),-i+1)], alpha=0.4, thickness=1) 
...    return g
...
sage: 
sage: def factor_trees(n, cols=4, rows=3, font=10):
...    return graphics_array([[factor_tree(n,font) for _ in range(cols)] for _ in range(rows)])
CPU time: 0.00 s,  Wall time: 0.00 sr¦U‰# Worksheet 'factor' (2007-01-05 at 14:28)
sage: F = factor_trees(2007, rows=1, cols=1, font=8)
sage: F.show(axes=False, figsize=[10,6])
r§UŽ# Worksheet 'bernoull_mod' (2007-01-05 at 14:28)
sage: bernoulli_mod_p(37)
[1, 31, 16, 15, 16, 4, 17, 32, 22, 31, 15, 15, 17, 12, 29, 2, 0, 2]r¨U¡# Worksheet 'bernoull_mod' (2007-01-05 at 14:29)
sage: time v=bernoulli_mod_p(10^4)
Traceback (most recent call last):
...
ValueError: p (=10000) must be a primer©U„# Worksheet 'bernoull_mod' (2007-01-05 at 14:29)
sage: time v=bernoulli_mod_p(next_prime(10^4))
CPU time: 0.06 s,  Wall time: 0.17 srªU„# Worksheet 'bernoull_mod' (2007-01-05 at 14:29)
sage: time v=bernoulli_mod_p(next_prime(10^5))
CPU time: 0.75 s,  Wall time: 0.78 sr«U0# Worksheet '' (2007-01-05 at 14:32)
sage: 2+3
5r¬U0# Worksheet '' (2007-01-05 at 14:32)
sage: 2+5
7r­UP# Worksheet '' (2007-01-05 at 14:33)
sage: E = magma.EllipticCurve([1,2,3,4,5])
r®UÉ# Worksheet '' (2007-01-05 at 14:33)
sage: %sh
sage: ps ax |grep magma
  687  p4  S+     0:00.00 grep magma
  682  p5  Ss+    0:01.65 /Users/was/local/magma/magma.exe -n
/Users/was/talks/2007-01-05-msrr¯U‚# Worksheet '' (2007-01-05 at 14:33)
sage: E
Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Fieldr°U_# Worksheet '' (2007-01-05 at 14:33)
sage: type(E)
r±UW# Worksheet '' (2007-01-05 at 14:34)
sage: E.TorsionSubgroup()
Abelian Group of order 1r²UD# Worksheet '' (2007-01-05 at 14:34)
sage: magma.eval('2^10')
'1024'r³U;# Worksheet '' (2007-01-05 at 14:35)
sage: a = magma(-5/6)
r´U1# Worksheet '' (2007-01-05 at 14:35)
sage: a
-5/6rµU5# Worksheet '' (2007-01-05 at 14:35)
sage: b = gp(a)
r¶U1# Worksheet '' (2007-01-05 at 14:35)
sage: b
-5/6r·U6# Worksheet '' (2007-01-05 at 14:36)
sage: s = str(a)
r¸U3# Worksheet '' (2007-01-05 at 14:36)
sage: s
'-5/6'r¹U<# Worksheet '' (2007-01-05 at 14:36)
sage: sage_eval(s)
-5/6rºU7# Worksheet 'boothby' (2007-01-05 at 14:40)
sage: 2+2
4r»U[# Worksheet 'boothby' (2007-01-05 at 14:44)
sage: A = MatrixSpace(ZZ,100).random_element()
r¼U\# Worksheet 'boothby2' (2007-01-05 at 14:45)
sage: A = MatrixSpace(ZZ,100).random_element()
r½U[# Worksheet 'boothby2' (2007-01-05 at 14:45)
sage: A = MatrixSpace(ZZ,10).random_element()
r¾Uç# Worksheet 'boothby2' (2007-01-05 at 14:45)
sage: %time
sage: A.characteristic_polynomial()
x^10 + 8*x^9 + 7*x^8 - 19*x^7 + 179*x^6 + 1177*x^5 + 5281*x^4 + 17998*x^3 + 303*x^2 + 80998*x - 59474
CPU time: 0.02 s,  Wall time: 0.11 sr¿U[# Worksheet 'boothby2' (2007-01-05 at 14:46)
sage: A = MatrixSpace(ZZ,20).random_element()
rÀTº# Worksheet 'boothby2' (2007-01-05 at 14:46)
sage: %time
sage: A.characteristic_polynomial()
x^20 - 8*x^19 + 6*x^18 - 214*x^17 + 1793*x^16 - 5075*x^15 + 48929*x^14 + 18144*x^13 - 3503664*x^12 + 21816786*x^11 - 128077072*x^10 + 204941895*x^9 - 575326349*x^8 + 153952082*x^7 + 50348199867*x^6 - 179830544090*x^5 + 653932820298*x^4 - 4414556160025*x^3 + 10322875513858*x^2 - 13965115307613*x + 39642628772487
CPU time: 0.13 s,  Wall time: 0.14 srÁUÆ# Worksheet 'boothby2' (2007-01-05 at 14:48)
sage: A.view()
Traceback (most recent call last):
...
AttributeError: 'sage.matrix.matrix_integer_dense.Matrix_integer_de' object has no attribute 'view'rÂUÆ# Worksheet 'boothby2' (2007-01-05 at 14:48)
sage: A.show()
Traceback (most recent call last):
...
AttributeError: 'sage.matrix.matrix_integer_dense.Matrix_integer_de' object has no attribute 'show'rÃT
# Worksheet 'boothby2' (2007-01-05 at 14:48)
sage: show(A)
\left(\begin{array}{rrrrrrrrrrrrrrrrrrrr} 2&-2&-1&-2&2&-1&-2&2&-2&1&-1&-2&1&2&-2&1&1&1&-1&2\\ -1&1&-1&1&1&-2&2&2&-1&-1&-1&-1&1&2&-1&-1&-1&2&2&-2\\ 1&-2&1&2&-1&-1&-2&1&-1&-1&1&1&-2&-2&2&2&1&-2&2&-1\\ -1&2&2&-2&1&2&2&1&-1&2&-1&-2&-1&1&-2&-2&1&-2&-2&-2\\ -1&2&-2&1&2&2&-2&-2&-2&-1&-1&-1&-2&2&-2&1&1&1&1&-1\\ 2&-2&-1&-1&2&1&2&-1&-2&-1&1&1&-2&1&-1&-1&-1&2&-2&-2\\ -2&2&-2&-2&2&2&2&1&-1&-1&1&-2&-1&-2&-1&-2&2&2&1&1\\ -1&-2&2&-2&1&-1&2&-1&1&2&...rÄTù# Worksheet 'boothby2' (2007-01-05 at 14:49) sage: %time sage: show(A.characteristic_polynomial())
x^{20} - 8x^{19} + 6x^{18} - 214x^{17} + 1793x^{16} - 5075x^{15} + 48929x^{14} + 18144x^{13} - 3503664x^{12} + 21816786x^{11} - 128077072x^{10} + 204941895x^{9} - 575326349x^{8} + 153952082x^{7} + 50348199867x^{6} - 179830544090x^{5} + 653932820298x^{4} - 4414556160025x^{3} + 10322875513858x^{2} - 13965115307613x + 39642628772487
CPU time: 0.00 s, Wall time: 0.00 srÅTÔ# Worksheet 'boothby2' (2007-01-05 at 14:49) sage: %time sage: latex(A.characteristic_polynomial()) x^{20} - 8x^{19} + 6x^{18} - 214x^{17} + 1793x^{16} - 5075x^{15} + 48929x^{14} + 18144x^{13} - 3503664x^{12} + 21816786x^{11} - 128077072x^{10} + 204941895x^{9} - 575326349x^{8} + 153952082x^{7} + 50348199867x^{6} - 179830544090x^{5} + 653932820298x^{4} - 4414556160025x^{3} + 10322875513858x^{2} - 13965115307613x + 39642628772487 CPU time: 0.00 s, Wall time: 0.00 srÆU[# Worksheet 'boothby2' (2007-01-05 at 14:52) sage: A = MatrixSpace(ZZ,20).random_element() rÇTº# Worksheet 'boothby2' (2007-01-05 at 14:52) sage: %time sage: A.characteristic_polynomial() x^20 + x^19 - 48*x^18 - 248*x^17 + 4281*x^16 - 6925*x^15 - 48119*x^14 - 707292*x^13 + 6241051*x^12 + 10172390*x^11 - 121169427*x^10 - 296266733*x^9 + 1505434256*x^8 + 3541680905*x^7 - 3496581918*x^6 - 191335962487*x^5 + 377854814060*x^4 + 1684293041404*x^3 - 12520145979924*x^2 - 8695150961834*x + 50834179507692 CPU time: 0.12 s, Wall time: 0.19 srÈUŒ# Worksheet 'boothby2' (2007-01-05 at 14:52) sage: %time sage: a = latex(A.characteristic_polynomial()) CPU time: 0.00 s, Wall time: 0.00 srÉU.# Worksheet 'boothby2' (2007-01-05 at 14:52) rÊU.# Worksheet 'boothby2' (2007-01-05 at 14:52) rËU.# Worksheet 'boothby2' (2007-01-05 at 14:52) rÌUw# Worksheet 'boothby2' (2007-01-05 at 14:53) sage: plot(sin, 0,2*pi) Graphics object consisting of 1 graphics primitiverÍUL# Worksheet 'boothby2' (2007-01-05 at 14:54) sage: plot(sin, 0,2*pi).show() rÎU:# Worksheet 'boothby2' (2007-01-05 at 14:54) sage: save A rÏU:# Worksheet 'boothby3' (2007-01-05 at 14:54) sage: load a rÐU:# Worksheet 'boothby3' (2007-01-05 at 14:54) sage: load A rÑU?# Worksheet 'boothby3' (2007-01-05 at 14:55) sage: A.height() 2rÒeU_Notebook__defaultsrÓ}rÔ(Ucell_output_colorrÕU#0000EErÖUmax_history_lengthr×MôUcell_input_colorrØU#0000000rÙUword_wrap_colsrÚKPuU_Notebook__worksheet_dirrÛUsage_notebook/worksheetsrÜU_Notebook__history_countrÝKU_Notebook__log_serverrÞ‰U_Notebook__filenamerßUsage_notebook/nb.sobjràU_Notebook__default_worksheetrá(horâ}rã(h U _scratch_räh ]rå(h oræ}rç(hUhjâh‰jUhKhU*sage_notebook/worksheets/_scratch_/cells/0rèhUh‰h Kjjh'‰ubah܉jP}réhÝU"sage_notebook/worksheets/_scratch_rêhç]rëhéKhïhhëˆhìU _scratch_rìhíU1165187727.127047ríhóU 11G3BJNEUV/PkrîhðKhòNubU_Notebook__server_logrï]rðU_Notebook__next_worksheet_idrñK U_Notebook__kill_idleròKU_Notebook__systemróNU_Notebook__show_debugrô‰U_Notebook__dirrõU sage_notebookröU_Notebook__authr÷U:U_Notebook__colorrøNU_Notebook__object_dirrùUsage_notebook/objectsrúU_default_filenamerûU5/Users/was/talks/2007-01-05-msr/sage_notebook/nb.sobjrüU_Notebook__splashpagerýˆub.