Commits

kcrisman  committed c387f27 Draft

Updated code and examples for other topics, added screenshot of R mode

  • Participants
  • Parent commits 52f4ec8

Comments (0)

Files changed (2)

File OtherTopics.html

     <script>
 $(function () {
     sagecell.makeSagecell({inputLocation:  '#Petersen',
-                           template:       sagecell.templates.restricted,
-                           autoeval: true});
+                           template:       sagecell.templates.restricted});
+    sagecell.makeSagecell({inputLocation:  '#testgraph',
+                           template:       sagecell.templates.restricted});
     sagecell.makeSagecell({inputLocation: '#Distribution',
-                           template:       sagecell.templates.restricted,
-                           evalButtonText: 'Evaluate'});
+                           template:       sagecell.templates.restricted});
     sagecell.makeSagecell({inputLocation: '#R',
-                           template:       sagecell.templates.restricted,
-                           evalButtonText: 'Evaluate'});
+                           template:       sagecell.templates.restricted});
     sagecell.makeSagecell({inputLocation: '#Cats',
-                           template:       sagecell.templates.restricted,
-                           evalButtonText: 'Evaluate'});
+                           template:       sagecell.templates.restricted});
+    sagecell.makeSagecell({inputLocation: '#sum',
+                           template:       sagecell.templates.restricted});
 });
     </script>
 
 
 <h1>We Got Your Topics Right Here!</h1>
 
-<p>There are lots of other things one might want to investigate in the classroom with computers, of 
-course.  Here, we give a quick sample of what Sage knows about <a href="#Graphs">graph theory</a>, <a 
+<p>There are lots of other things one might want to investigate in the classroom with computers, of
+course.  Here, we give a quick sample of what Sage knows about <a href="#Graphs">graph theory</a>, <a
 href="#Statistics">statistics</a>, and <a href="#Combinatorics">combinatorics</a>.</p>
 
 <p>This is just a small sampling; for full details, see <a href="http://sagemath.org/doc/reference/">the
 <h2 id="Graphs">Graphs</h2>
 
 <p>Sage knows a great deal about graphs.  There is a huge number of built-in graphs, with
-more being added all the time.  We access them using the "graphs.[tab]" syntax, and can plot them too.
+more being added all the time.  We access them using the <code>graphs.[tab]</code> syntax, and can plot them too.
 Below, we see the well-known Petersen graph.</p>
 
 <div id="Petersen"><script type="text/x-sage">graphs.PetersenGraph().show()</script></div>
 
-<p>It's possible to define one's own graphs using adjacency information of various kinds (such as 
+<p>It's possible to define one's own graphs using adjacency information of various kinds (such as
 matrices).  One can explicitly set the position of every vertex
 in a graph, and to use tikz and LaTeX to set all kinds of other options (see <a href="http://sagemath.org/doc/reference/sage/graphs/graph_latex.html">the
 Sage reference manual</a>).</p>
 
 <p>More importantly, Sage has information about the graphs themselves.  Using linear programming techniques,
 finding cliques and colorings is extremely fast, while GAP is used under the hood to present automorphism
-groups.  FIXME: add an example, screenshot?</p>
+groups.  Here's an example of all of this.</p>
 
-<p>Finally, there is a wonderful javascript graph editor, accessed by using the command 
-"graph_editor()".  Here, one can create graphs by clicking vertices and edges, as well as rearrange them
+<div id="testgraph"><script type="text/x-sage">G = Graph({1:[2,3],2:[3]})
+print G.adjacency_matrix()
+print G.automorphism_group().is_simple()
+G.show()</script></div>
+
+<!-- FIXME - I can't get it to work, yikes!
+<p>Finally, there is a wonderful javascript graph editor, accessed by using the command
+<code>graph_editor()</code>.  Here, one can create graphs by clicking vertices and edges, as well as rearrange them
 in any way desired - then save the graph to get more detailed information from Sage about the new graph.</p>
 
-<p>FIXME: screenshot!</p>
+Also, put in a screenshot once we figure that out -->
 
 <h2 id="Statistics">Statistics</h2>
 
-<p>Sage has basic native statistics facilities.  Some syntax includes:
+<p>Sage has some very basic statistics facilities implemented natively.  Some syntax includes:
 <ul>
-<li>mean([1,3,5,6])</li>
-<li>std([1,3,3,5,5,6,6]) for standard deviation</li>
+<li><code>mean([1,3,5,6])</code></li>
+<li><code>std([1,3,3,5,5,6,6])</code> for standard deviation</li>
 </ul>
 </p>
 
-<p>For most more advanced functionality, Sage uses packages like the <a href="http://www.gnu.org/software/gsl/">GNU
-Scientific Library</a> or <a href="http://www.scipy.org/">Scipy</a>.</p>
+<p>But for more advanced functionality, why reinvent the wheel when there is a lot of excellent
+statistics stuff out there? Sage uses packages like the <a href="http://www.gnu.org/software/gsl/">GNU
+Scientific Library</a> or <a href="http://www.scipy.org/">Scipy</a> to provide this.  Here, we use the GSL
+functionality to first generate a plot from sampling from a distribution, then to generate data to get a mean.</p>
 
 <div id="Distribution"><script type="text/x-sage">dist=RealDistribution('gaussian',3)
-my_data=[dist.get_random_element()+2 for _ in range(20)]
-my_data; mean(my_data)</script></div>
+dist.generate_histogram_plot('plot')
+my_data=[dist.get_random_element()+2 for _ in range(2000)]
+print mean(my_data)</script></div>
 
-<p>Also, thanks to the <a href="http://www.r-project.org/">R package</a>, 
+<p>Also, thanks to the <a href="http://www.r-project.org/">R package</a>,
 Sage has essentially every statistics thing you would ever need. Through the notebook, first choose
-the "R" evaluation possibility from the drop-down menu, then paste in your code: FIXME: screenshot</p>
+the <code>r</code> evaluation possibility from the drop-down menu, then paste in your code.  Here is an example
+using some of R's builtin data sets.</p>
 
-<p>Or, for many things the R interface for Sage will work just fine.  Click Evaluate, below.</p>
+<img src="screenshots/RScreenshot.png" />
+
+
+<p>For many things the R interface for Sage will work just fine.  Click Evaluate, below.</p>
 <div id="R"><script type="text/x-sage">x=r([2.9, 3.0, 2.5, 2.6, 3.2]) # normal subjects
 y=r([3.8, 2.7, 4.0, 2.4])      # with obstructive airway disease
 z=r([2.8, 3.4, 3.7, 2.2, 2.0]) # with asbestosis
 a = r([x,y,z]) # make a long R vector of all the data
 b = r.factor(5*[1]+4*[2]+5*[3]) # create something for R to tell which subjects are which
-print a; print b # show them 
+print a; print b # show them
 r.kruskal_test(a,b) # do the KW test! </script></div>
 <p>Apparently there wasn't enough data for us to reject the null hypothesis here.</p>
 
 
 <h2 id="Combinatorics">Combinatorics</h2>
 
-<p>Because of the origins of Sage as a high-level research program, fast and accurate enumeration of a 
-very large number of combinatorial objects was a high priority.  As a result, Sage has many types of 
+<p>Because of the origins of Sage as a high-level research program, fast and accurate enumeration of a
+very large number of combinatorial objects was a high priority.  As a result, Sage has many types of
 permutations, combinations, and so forth.</p>
 
 <p>One can do permutations of arbitrary sets:</p>
 
 <p>But there are also plenty of numerical things:
 <ul>
-<li>Familiar - Combinations(3), multinomial(24,3,5)</li>
-<li>Unfamiliar - derangements([1,1,2,3,4,4])</li>
+<li>The familiar -- <code>Combinations(3), multinomial(24,3,5)</code></li>
+<li>The unfamiliar -- <code>derangements([1,1,2,3,4,4])</code></li>
 </ul>
 </p>
 
-<p>Thanks to Maxima, Sage can also do combinatorial sums, like showing that a row of Pascal's triangle is 
+<p>Thanks to Maxima, Sage can also do combinatorial sums, like showing that a row of Pascal's triangle is
 a power of two. </p>
 
-<p>[n,k=var('n k'); sum(binomial(n,k), k, 0, n)]</p>
+<div id="sum"><script type="text/x-sage">n,k=var('n k'); show(sum(binomial(n,k), k, 0, n))</script></div>
 
-<p>FIXME: Screenshot and jsmath/MathJax version of this sum</p>
+<p>For even more information about what topics are in Sage, checking out some of the <a href="http://sagemath.org/doc/thematic_tutorials/">thematic
+tutorials</a> and of course the mammoth <a href="http://sagemath.org/doc/reference/">reference manual</a> is a must.</p>
 
 <div class="footer">
 <p>Previous: <a href="Algebra.html" class="internal">Algebra, linear and otherwise</a> | Up: <a href="Mathematics.html" class="internal">Doing Mathematics with Sage</a> | Next: <a href="Classroom.html" class="internal">How to Use Sage in the Classroom</a></p>

File screenshots/RScreenShot.png

Added
New image