<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
+<!-- Stuff to make live Sage cell instances -->
+ <script src="http://aleph.sagemath.org/static/jquery.min.js"></script>
+ <script src="http://aleph.sagemath.org/embedded_sagecell.js"></script>
+ sagecell.makeSagecell({inputLocation: '#sagecell-interact',
+ template: sagecell.templates.minimal,
+ evalButtonText: 'Activate'});
+ sagecell.makeSagecell({inputLocation: '#sagecell-interact2',
+ template: sagecell.templates.restricted});
<title>How to Use Sage in the Classroom</title>
<meta name="author" content="Byungchul Cha, Karl-Dieter Crisman, Dan Drake, and Jason Grout" />
<h1>How to Use Sage in the Classroom</h1>
-<p>FIXME: Make more actual content, not just ideas</p>
<p>If the reader has come this far, she probably is ready to start talking more about how to use Sage in
the classroom! This section takes a step back from nitty-gritty and looks at those big things.</p>
<li><a href="#CheatSheet" class="internal">Cheat Sheets of Shortcuts</a></li>
<li><a href="#Sharing" class="internal">Sharing Sage Worksheets</a></li>
<li><a href="#CellServer" class="internal">Sage Cell Server</a></li>
+ <li><a href="#SageTeX" class="internal">Custom Documents</a></li>
<li><a href="#Labs" class="internal">Lab Work</a></li>
<li><a href="#Research" class="internal">Research</a></li>
<li><a href="#Sagelets" class="internal">Interactive Sagelets</a></li>
<h2 id="Demos">In-Class Demos</h2>
-<p>Say something about how to do this in the classroom.</p>
+<p>One of the easiest ways to use any computer program in the classroom is to, well, use it in the classroom.
+Although <a href="#Sagelets">interactive material</a> works particularly well with this, there is no reason why
+one can't simply show graphics, commands, or data from a Sage notebook in the classroom to help with understanding
+material, as long as one's classroom is set up with projection equipment.
+This is especially true when it's hard to understand from a printed text, such as these examples:
+<li>Functions of two variables are often hard to visualize very quickly. Showing a manipulable graphic can help
+students think about how their own sketches relate to the actual graph.</li>
+<li>In many fields, like basic number theory or graph theory, there are definite patterns to find in objects discussed
+in a lecture. Showing ever-larger amounts of the data helps students think about what the pattern might be in bite-size
+chunks, rather than all at once in some huge table in a book.</li>
<h2 id="CheatSheet">Cheat Sheets of Shortcuts</h2>
-<p>Say something about how to do this in the classroom.</p>
+<p>Sometimes one doesn't need students to do any specific work with the computer, but wants them to have access
+to a key list of commands for checking homework or exploring a little. Publishing a worksheet with common linear algebra commands
+applied to an easy test case makes it a snap for them to simply change the starting matrix to then get determinants, kernels, or
+whatever else one needs. Upon editing a copy, he can then cut and paste as many times as desired on the same worksheet.</p>
<h2 id="Sharing">Sharing Sage Worksheets</h2>
-<p>What should we say about this? My main point is that whether it is used as a cheat sheet or used
-for showing people how to do certain things, it's good. Maybe start pointing to great examples, like
-John Perry's at USM or some of Rob Beezer's, or something? Probably that is a good idea. But we want
+<p>Another option for using worksheets is <i>sharing</i> them. All users sharing a given worksheet can make edits
+<img src="screenshots/Share1.png" />
+<p>As a security measure, one cannot see all potential names to share with.</p>
+<img src="screenshots/Share2.png" />
+<p>Some of the many ideas for sharing</p>
+<li>Collaboration on student group projects</li>
+<li>Handing in homework</li>
+<li>Consulting with faculty and TAs in multi-section courses on what to include in a worksheet</li>
<h2 id="CellServer">Sage Cell Server</h2>
-<p>Say something about how to use this in the classroom.</p>
+<p>Naturally, the once-off nature of the Sage cell server makes it more appropriate for some things than others.
+A few benefits or likely uses:
+<li>For in-class demos, the permalink creates a very easy way for students to see the info again - no login is required.</li>
+<li>The same can be true as a cheat sheet. Showing the syntax for integration and suggesting students check their work
+by putting their own function in will work fine.</li>
+<li>FIXME: other idea</li>
+<h2 id="SageTeX">Custom Documents</h2>
+<p>For those familiar with mathematical typesetting via LaTeX, one can use Sage to help create beautiful documents with
+the mathematics in them computed via Sage. This is particularly helpful for things like creating several versions of exams,
+with one version including the answers, or for including graphics easily in a handout for class. There is a brief intro
+to this facility, called <i>SageTeX</i>, in the <a href="http://www.sagemath.org/doc/tutorial/sagetex.html">standard documentation</a>;
+a quick Internet search will find more information.</p>
<h2 id="Labs">Lab Work</h2>
-<p>There are alternate ways to use Sage as well. Many people use computers to create great
-lab experiences for mathematics students, especially in calculus.</p>
+<p>Many instructors use computers to create great lab experiences for mathematics students, especially in calculus. There
+are many books, including a number published by the MAA, with excellent computational labs. FIXME: do we need a reference?</p>
-<p>We need a few good examples of generic lab stuff here. Not necessarily Sage-related. Obviously
-this will reference the stuff on <a href="#Sagelets" class="internal">@interacts</a>.</p>
+<p>What makes Sage ideally suited for this is that the Sage notebook is available twenty-four hours a day, from any location
+that has Internet access (or, alternately, from any IP address on campus, if your department runs a local server thus configured).
+There is no longer the need for a lab to be held in the "lab".</p>
+<p>Naturally, one can still do this in the same physical location, with groups at a computer, or on individual ones.
+We highly recommend using lab work in conjunction with <a href="#Sagelets" class="internal">@interacts</a>, so that
+you are spending as little time teaching computer skills and as much time teaching math as possible.</p>
<h2 id="Research">Research</h2>
-wonderful outlet for students beginning research too.
-I have something minor which can be referenced from the Sage special session in DC, and Robert
-Miller has nice examples of this in graph theory. I am sure there are others!</p>
+<p>Although the main focus of this article is Sage in classroom settings, we want you to know that
+Sage is a wonderful outlet for students beginning research too. Several of the authors have used Sage
+to help students explore topics from graph theory to the mathematics of elections to combinatorics; a number of the
+<a href="http://www.sagemath.org/library-publications.html">publications citing Sage</a> come directly from undergraduate
+includes excellent Python data and plotting facilities, those in data-driven disciplines can use Sage to
+do good work with combining symbolic computation and data.
<h2 id="Sagelets">Interactive Sagelets</h2>
<h3>From Static to Dynamic Mathematics</h3>
-<p>Here we discuss them. Liberally reference Geogebra, including articles in JOMA/Loci, and the
-Wolfram Demonstrations project and/or Maplets and other free applets. Point to specific examples
-which are <em>not</em> gigantic on the Wiki page, probably on the worksheet at #Sagelets. Or what
-about <a href="http://interact.sagemath.org/">the interact database</a>? Also a place that maybe
-belongs in the community part... </p>
+<p>One of the hottest things in mathematics education has been the proliferation of dynamic mathmematics done on
+a particular platform. Though there are many standalone applets of various kinds out there, tools like Geogebra applets
+and the Wolfram Demonstrations project have shown the viability of an ecosystem composed of an advanced tool which can
+create many different interactive "mathlets" with a unified feel.</p>
-<p>Point out that this is a growing field, and that you don't have to be a programmer to do it.</p>
+<p>Sage also has such items, called "interacts". It so happens that one can embed them in web pages, if one has
+access to a Sage cell server. The following numerical integration calculator is a popular one, which
+one can just cut and paste from the <a href="http://wiki.sagemath.org/interact/calculus">Sage interact
+wiki</a>. Just click "Activate" below to try it.</p>
+<div id="sagecell-interact"><script type="text/x-sage"># by Nick Alexander (based on the work of Marshall Hampton)
+def midpoint(f = input_box(default = sin(x^2) + 2, type = SR),
+ interval=range_slider(0, 10, 1, default=(0, 4), label="Interval"),
+ number_of_subdivisions = slider(1, 20, 1, default=4, label="Number of boxes"),
+ endpoint_rule = selector(['Midpoint', 'Left', 'Right', 'Upper', 'Lower'], nrows=1, label="Endpoint rule")):
+ a, b = map(QQ, interval)
+ t = sage.calculus.calculus.var('t')
+ func = fast_callable(f(x=t), RDF, vars=[t])
+ dx = ZZ(b-a)/ZZ(number_of_subdivisions)
+ for q in range(number_of_subdivisions):
+ if endpoint_rule == 'Left':
+ elif endpoint_rule == 'Midpoint':
+ xs.append(q*dx + a + dx/2)
+ elif endpoint_rule == 'Right':
+ xs.append(q*dx + a + dx)
+ elif endpoint_rule == 'Upper':
+ x = find_maximum_on_interval(func, q*dx + a, q*dx + dx + a)[1]
+ elif endpoint_rule == 'Lower':
+ x = find_minimum_on_interval(func, q*dx + a, q*dx + dx + a)[1]
+ ys = [ func(x) for x in xs ]
+ for q in range(number_of_subdivisions):
+ rects += line([[xm-dx/2,0],[xm-dx/2,y],[xm+dx/2,y],[xm+dx/2,0]], rgbcolor = (1,0,0))
+ rects += point((x, y), rgbcolor = (1,0,0))
+ min_y = min(0, find_minimum_on_interval(func,a,b)[0])
+ max_y = max(0, find_maximum_on_interval(func,a,b)[0])
+ # html('<h3>Numerical integrals with the midpoint rule</h3>')
+ show(plot(func,a,b) + rects, xmin = a, xmax = b, ymin = min_y, ymax = max_y)
+ # print only a few digits of precision
+ return RealField(20)(x)
+ sum_html = "%s \cdot \\left[ %s \\right]" % (dx, ' + '.join([ "f(%s)" % cap(i) for i in xs ]))
+ num_html = "%s \cdot \\left[ %s \\right]" % (dx, ' + '.join([ str(cap(i)) for i in ys ]))
+ numerical_answer = integral_numerical(func,a,b,max_points = 200)[0]
+ estimated_answer = dx * sum([ ys[q] for q in range(number_of_subdivisions)])
+ \int_{a}^{b} {f(x) \, dx} & = %s \\\
+ \sum_{i=1}^{%s} {f(x_i) \, \Delta x}
+ ''' % (numerical_answer, number_of_subdivisions, sum_html, num_html, estimated_answer))</script></div>
+<p>The code for this is <i>very</i> long, so we omit it.</p>
+<p>Naturally, there are smaller ones as well! Here is a nice one demonstrating the prime number theorem by the founder
+of Sage, William Stein. Just drag the slider after clicking "Evaluate".</p>
+<div id="sagecell-interact2"><script type="text/x-sage">@interact
+def _(N=(100,(2..2000))):
+ html("<font color='red'>$\pi(x)$</font> and <font color='blue'>$x/(\log(x)-1)$</font> for $x < %s$"%N)
+ show(plot(prime_pi, 0, N, rgbcolor='red') + plot(x/(log(x)-1), 5, N, rgbcolor='blue'))</script></div>
+<p>It's possible to have them automatically evaluate, of course, as well as to send students to a link; <a
+href="http://aleph.sagemath.org/?z=eJxdzk0KgzAQBeC9pxgkYoamGoVuikpP4AkE8SdqIJoQU-rxa130b7bv4725ycUJ23TO68UANS1zmnDOaBpFKeccEa8e7De5WVE_G_TioNNK2zy0og8LUhlJNyRZ_IoKaJYeflSr7mJnW0wrpcednpOPHrQFskEGwUr8oMRjap30gxqlHTVWzqI2kgFnUDKwY_u1jXCCg-3d72oGlz96PID4BAG0RGQ%3D">
+here is one to the immediately preceding</a> interact.</p>
+<p>You also don't have to be a programmer to use these. Cutting and pasting from any source you find is wonderful, as well as
+searching through the ones available in the Sage notebook at sage.interacts.[tab] is great. But if you don't want to just do
<h3 id="NoCutPaste">But I Don't Want to Just Cut and Paste those Sagelets!</h3>
-<p>Here, of course, we say that it is quite easy to create them, and point to the <a
-href="http://mathdl.maa.org/mathDL/4/InteractArticle.html">companion article</a>!</p>
+<p>We have a <a href="http://mathdl.maa.org/mathDL/4/InteractArticle.html">companion article</a> to help you through
+the process of creating interactivity, step by step! There is not really any prerequisite knowledge for creating these.
+However, experience teaches that a familiarity with the concept of defining a new function and variables, and a sensitivity
+to the very strict syntax that computer languages tend to have, make the process easiest to follow.</p>