#11682: thematic tutorial on sandpiles
-----------------------------+----------------------------------------------
Reporter: dperkinson | Owner: mvngu
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.7.2
Component: documentation | Keywords: sandpile
Work_issues: | Upstream: N/A
Reviewer: | Author: David Perkinson
Merged: | Dependencies:
-----------------------------+----------------------------------------------
Comment(by jhpalmieri):
> I ascertained that the python blocks were *not* being tested. So I
checked each manually, found several problems (due to out-of-date syntax),
and fixed them. I do not want to have the blocks labeled as 'EXAMPLES'. I
putua warning at the top of sandpile.rst that these blocks need to be
tested by hand.
This code '''must''' be tested automatically.
To do this, you don't have to label them as `EXAMPLES`, you just need to
delimit them with a double colon, say like this:
{{{
#!diff
@@ -74,16 +77,14 @@ configuration `c'=(1,1,3)`. Here, `4` g
these has gone to the sink vertex (and forgotten), one has gone to vertex
1,
and two have gone to vertex 2, since the edge from 1 to 2 has weight 2.
Vertex 3 in the new configuration is now unstable. The Sage code for
this
-example looks like this:
-
-.. code-block:: python
-
- Create the sandpile:
+example looks like this::
+
+ Create the sandpile:
sage: g = {'sink':{},
- 1:{'sink':1, 2:1, 3:2},
- 2:{1:1, 3:1},
- 3:{1:1, 2:1}}
+ ... 1:{'sink':1, 2:1, 3:2},
+ ... 2:{1:1, 3:1},
+ ... 3:{1:1, 2:1}}
sage: S = Sandpile(g, 'sink')
sage: S.show(edge_labels=true) # to display the graph
}}}
(The triple dots are to denote continuation lines.) I would also suggest
that you put `.. linkall` near the top of the file to tell Sage to link
all of the examples when doctesting, since you define `S` in one block and
then use it in the next one.
When I made changes like the above, I got a bunch of doctest failures,
e.g.
{{{
sh: /Applications/sage/local/bin/zsolve: No such file or directory
sh: /Applications/sage/local/bin/zsolve: No such file or directory
**********************************************************************
File "/Applications/sage_builds/sage-4.7.2.alpha2/devel/sage-
new/doc/en/thematic_tutorials/sandpile.rst", line 212:
sage: S.is_recurrent(c)
Exception raised:
Traceback (most recent call last):
File "/Applications/sage/local/bin/ncadoctest.py", line 1231, in
run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Applications/sage/local/bin/sagedoctest.py", line 38, in
run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File "/Applications/sage/local/bin/ncadoctest.py", line 1172, in
run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[23]>", line 1, in <module>
S.is_recurrent(c)###line 212:
sage: S.is_recurrent(c)
File "/Applications/sage/local/lib/python/site-
packages/sage/sandpiles/sandpile.py", line 416, in __getattr__
raise AttributeError, name
AttributeError: is_recurrent
**********************************************************************
File "/Applications/sage_builds/sage-4.7.2.alpha2/devel/sage-
new/doc/en/thematic_tutorials/sandpile.rst", line 317:
sage: S.reduced_laplacian().dense_matrix().smith_form()
Expected:
([1 0 0]
[0 1 0]
[0 0 3],
[ 0 0 1]
[ 1 0 0]
[ 0 1 -1],
[3 1 4]
[4 1 6]
[4 1 5])
Got:
(
[1 0 0] [ 0 0 1] [3 1 4]
[0 1 0] [ 1 0 0] [4 1 6]
[0 0 3], [ 0 1 -1], [4 1 5]
)
}}}
There were 32 failures in all, some of which are minor, like the spacing
in the matrix, but some look more significant.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11682#comment:16>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.