Differences between revisions 5 and 17 (spanning 12 versions)
Revision 5 as of 2006-10-09 21:45:21
Size: 1008
Editor: anonymous
Comment:
Revision 17 as of 2008-11-14 13:42:08
Size: 2309
Editor: anonymous
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Describe dmr/notebookwiki here. Copy cells from wiki-form window in sage worksheet and paste directly into wiki edit.
Line 5: Line 5:
{{{
code
code
///
}}}
Line 12: Line 6:
# Worksheet: _scratch_ # Wiki form worksheet (with prompt): _scratch_
Line 17: Line 11:
{{{a = 5 {{{#!python
sage:
a = 5
Line 20: Line 15:
{{{a
# 5}}}
{{{#!python
sage:
a
5}}}
Line 23: Line 19:
{{{sage.server.notebook.worksheet.Cell.worksheet.im_class.files_html()
# Traceback (most recent call last):
    sage.server.notebook.worksheet.Cell.worksheet.im_class.files_html()
# File "/home/dorian/sage/sage-1.4/local/lib/python2.5/", line 1, in <module>
# TypeError: unbound method files_html() must be called with Cell instance as first argument (got nothing instead)}}}
{{{#!python
sage: for i in range(10):
... print i*i - 2
-2
-1
2
7
14
23
34
47
62
79}}}
Line 29: Line 33:
{{{_scratch___plain__
# Traceback (most recent call last):
    _scratch___plain__
# File "/home/dorian/sage/sage-1.4/local/lib/python2.5/", line 1, in <module>
# NameError: name '_scratch___plain__' is not defined}}}
{{{#!python
sage: c=0
sage: for i in range(200):
... a = 2^i -1
... if a.is_prime():
... c += 1
... print str(c)+': '+str(a)
1: 3
2: 7
3: 31
4: 127
5: 8191
6: 131071
7: 524287
8: 2147483647
9: 2305843009213693951
10: 618970019642690137449562111
11: 162259276829213363391578010288127
12: 170141183460469231731687303715884105727}}}
Line 35: Line 53:
{{{s='strf' {{{#!python
sage: a.is_prime()
True}}}

{{{#!python
Line 38: Line 61:
{{{s += '}}}' ################################################################################
# Wiki form worksheet: _scratch_
################################################################################



{{{#!python
Line 41: Line 71:
{{{s = '{{{'+s {{{#!python
b=10
Line 44: Line 75:
{{{s
# '{{{strf}}}'}}}
{{{#!python
a.is_prime()
out: True}}}
Line 47: Line 79:
{{{ {{{#!python
a
out: 5}}}

{{{#!python
Line 49: Line 86:

{{{#!python
a = 5
}}}

{{{#!python

}}}

{{{#!python
a
out: 5}}}

{{{#!python
for i in range(10):
    print i*i - 2
out: -2
 -1
 2
 7
 14
 23
 34
 47
 62
 79}}}

{{{#!python
c=0
for i in range(200):
    a = 2^i -1
    if a.is_prime():
        c += 1
        print str(c)+': '+str(a)
out: 1: 3
 2: 7
 3: 31
 4: 127
 5: 8191
 6: 131071
 7: 524287
 8: 2147483647
 9: 2305843009213693951
 10: 618970019642690137449562111
 11: 162259276829213363391578010288127
 12: 170141183460469231731687303715884105727}}}

{{{#!python
t = Tachyon(xres=512,yres=512, camera_center=(5,0,0))
t.light((4,3,2), 0.2, (1,1,1))
t.texture('t0', ambient=0.1, diffuse=0.9, specular=0.5, opacity=1.0, color=(1.0,0,0))
t.texture('t1', ambient=0.1, diffuse=0.9, specular=0.3, opacity=1.0, color=(0,1.0,0))
t.texture('t2', ambient=0.2, diffuse=0.7, specular=0.5, opacity=0.7, color=(0,0,1.0))
k=0
for i in srange(-5,1.5,0.1):
    k += 1
    t.sphere((i,i^2-0.5,i^3), 0.1, 't%s'%(k%3))

t.show()
}}}

{{{#!python

}}}

Copy cells from wiki-form window in sage worksheet and paste directly into wiki edit.

# Wiki form worksheet (with prompt): _scratch_

   1 sage: a = 5

   1 sage: a
   2 5

   1 sage: for i in range(10):
   2 ...    print i*i - 2
   3 -2
   4 -1
   5 2
   6 7
   7 14
   8 23
   9 34
  10 47
  11 62
  12 79

   1 sage: c=0
   2 sage: for i in range(200):
   3 ...    a = 2^i -1
   4 ...    if a.is_prime():
   5 ...        c += 1
   6 ...        print str(c)+': '+str(a)
   7 1: 3
   8 2: 7
   9 3: 31
  10 4: 127
  11 5: 8191
  12 6: 131071
  13 7: 524287
  14 8: 2147483647
  15 9: 2305843009213693951
  16 10: 618970019642690137449562111
  17 11: 162259276829213363391578010288127
  18 12: 170141183460469231731687303715884105727

   1 sage: a.is_prime()
   2 True

   1 

# Wiki form worksheet: _scratch_

   1 

   1 b=10

   1 a.is_prime()
   2 out: True

   1 a
   2 out: 5

   1 

   1 a = 5

   1 

   1 a
   2 out: 5

   1 for i in range(10):
   2     print i*i - 2
   3 out: -2
   4  -1
   5  2
   6  7
   7  14
   8  23
   9  34
  10  47
  11  62
  12  79

   1 c=0
   2 for i in range(200):
   3     a = 2^i -1
   4     if a.is_prime():
   5         c += 1
   6         print str(c)+': '+str(a)
   7 out: 1: 3
   8  2: 7
   9  3: 31
  10  4: 127
  11  5: 8191
  12  6: 131071
  13  7: 524287
  14  8: 2147483647
  15  9: 2305843009213693951
  16  10: 618970019642690137449562111
  17  11: 162259276829213363391578010288127
  18  12: 170141183460469231731687303715884105727

   1 t = Tachyon(xres=512,yres=512, camera_center=(5,0,0))
   2 t.light((4,3,2), 0.2, (1,1,1))
   3 t.texture('t0', ambient=0.1, diffuse=0.9, specular=0.5, opacity=1.0, color=(1.0,0,0))
   4 t.texture('t1', ambient=0.1, diffuse=0.9, specular=0.3, opacity=1.0, color=(0,1.0,0))
   5 t.texture('t2', ambient=0.2, diffuse=0.7, specular=0.5, opacity=0.7, color=(0,0,1.0))
   6 k=0
   7 for i in srange(-5,1.5,0.1):
   8     k += 1
   9     t.sphere((i,i^2-0.5,i^3), 0.1, 't%s'%(k%3))
  10 
  11 t.show()

   1 

dmr/notebookwiki (last edited 2008-11-14 13:42:08 by anonymous)