Adventures in TikZ: tkz-graph

The other day, I was writing some lecture notes for my linear algebra class, and wanted to create the following diagram (to illustrate the concept of a Markov chain):

I had a very limited time in which to finish these notes. Fortunately, I found the tkz-graph package, which made this a snap:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{fouriernc}
\usepackage{tkz-graph}

\begin{document}
\begin{tikzpicture}
\SetGraphUnit{5}

\Vertex[x=0, y=10]{0 points};
\Vertex[x=0, y=5]{1 point};
\Vertex[x=0, y=0]{Win};
\Vertex[x=5, y=5]{Lose};

\Edge[style ={->}, label={$1/3$}]({0 points})({1 point});
\Edge[style ={->}, label={$1/3$}]({1 point})({Win});
\Edge[style ={->}, label={$1/6$}]({0 points})({Lose});
\Edge[style ={->}, label={$1/6$}]({1 point})({Lose});

\Loop[style ={->}, label={$1/2$}, labelstyle={fill=white}]({0 points});
\Loop[style ={->}, label={$1/2$}, labelstyle={fill=white}]({1 point});
\Loop[style ={->}, label={$1$}, dir=EA, labelstyle={fill=white}]({Lose});
\Loop[style ={->}, label={$1$}, labelstyle={fill=white}]({Win});

\end{tikzpicture}
\end{document}

You don’t even have to specify the locations of the vertices; you can throw caution to the wind and have LaTeX decide where to place them! (I am a bit too much of a perfectionist for that.)

One slight issue I had was that the documentation for this package (at least on my computer, as retrieved by texdoc) was in French. Fortunately, I seem to have retained enough knowledge since I took the French language exam as a grad student that I could read most of the documentation.

Book recommendation: How Not to Be Wrong

Today, I finished reading How Not to Be Wrong: The Power of Mathematical Thinking by Jordan Ellenberg. This is a very enjoyable, very well-written, general-audience book about mathematics, which I recommend whole-heartedly.

Ellenberg, a math professor at the University of Wisconsin, does a great job weaving together a plethora of mathematical topics, including non-Euclidean geometry, probability, statistics, and mathematical analysis of voting systems. He writes in a way that someone who only vaguely remembers—or never really understood—high school algebra would be able to follow and enjoy. His exposition is made more lively by a cast of historical and contemporary characters, some famous and some primarily known only to mathematicians, including Abraham Wald, Bernhard Riemann, Teddy Roosevelt, Francis Galton, Voltaire, Nicolas de Condorcet, David Hilbert, Ronald Fisher, Antonin Scalia, and Nate Silver. (My favorite line in the book is the one in which Ellenberg describes Silver as a “Kurt Cobain of probability.”)

The best part of the book is about how the Massachusetts Lottery ran a game in which it was occasionally profitable to play (that is, there were some drawings in which the expected value of a ticket’s winnings was higher than the price of a ticket). Of course, some smart people (e.g. an MIT student) figured this out and recruited investors to buy absurd numbers of tickets for the profitable drawings. In the course of telling this story, Ellenberg weaves in discussions of finite geometries and error-correcting codes, both of which are relevant in describing how one buys thousands of lottery tickets without accidentally having to split winnings with yourself.

I think it would be awesome to use this book in a gen-ed math class.

Sum question!

The American Mathematical Society made the following amusing post to their Facebook page today:

You can calculate 3???? = 26796, which of course is greater than 1000.

Continue reading

Brains over calculators, part 2.

I recently found another calculation that I would consider reasonable for my students to perform that their calculators cannot. On my Calc II students’ final exam, I asked them to evaluate the infinite series \(\displaystyle \sum_{n = 1}^\infty \frac{4}{(n + 3)(n+5)}\). As a hint, I told them to rewrite in telescoping form using partial fractions. However, the TI-89 cannot evaluate this series. Since it’s hard to take a good photo of the calculator screen, I’ve instead included a screen shot of the TI-Nsipre CAS iPad app.

TI n-spire screen shot

Brains over calculators!

I enjoy finding calculations that I would consider reasonable for my students to perform that their calculators cannot.

Using a double-angle identity and the pythagorean identity, it’s pretty straightforward to show that \(\sin\left(2\sin^{-1}\left(-\frac{4}{5}\right)\right) = -\frac{24}{25}.\) However, my TI-89 returns an unhelpful -sin(2*sin-1(4/5)) instead.

Amusingly, the calculator does know that \(2\sin\left(\sin^{-1}\left(-\frac{4}{5}\right)\right)\cos\left(\sin^{-1}\left(-\frac{4}{5}\right)\right) = -\frac{24}{25}.\)

Photo of the calculator screen showing what is described above.

(My calculator is running the 2005 version of the software. It’s possible this has been fixed since then.)

Arizona State Senator opposes Common Core, in part, because ALGEBRA!

According to the Arizona Daily Star, the Arizona Senate Education Committee passed a bill that would prohibit the state from implementing the Common Core standards. Quoth the Daily Star (emphasis mine):

[Gubernatorial candidate and state Senator Al] Melvin said he understands “some of the reading material is borderline pornographic.” And he said the program uses “fuzzy math,” substituting letters for numbers in some examples.

Later on in the same article, Senator Melvin is quoted as expressing concern about the rigor of American academic standards, arguing that “We have cheated several generations of Americans out of a decent education.” I might argue that the person who has been cheated out of a decent education is Senator Melvin, who is apparently unfamiliar with fifth-grade mathematics.

Of course, it’s entirely possible Senator Melvin is fully aware that this “fuzzy math” line is completely ignorant poppycock and is only saying it in a cynical attempt to appeal to ignorant people in his gubernatorial campaign. (This possibility, to be frank, would be even more distressing.)

Intel’s second largest U.S. site is in Arizona. I wonder how Intel executives feel about their company’s investment in a state where members of the state senate education committee oppose the teaching of algebra.

(To be absolutely clear, I’m not saying that all Common Core skeptics and opponents are as ridiculous as Senator Melvin.)

HT: Matthew Arbo

SageTeX is awesome!

For a long time, I have been a user of the math software system Sage, and for a longer time, I have been a user of LaTeX. So, it’s with some embarrassment that I report that I only recently discovered the awesomeness that is SageTeX, a LaTeX package that allows your LaTeX document to run Sage code and include the results.

I often use Sage to create plots for use in my lectures or printed class materials. Previously, my workflow was as follows:

  1. Create the graphic by running commands in the Sage notebook.
  2. Use the save command to save the graphic as a PDF, usually with a filename based on my LaTeX source file’s name (e.g. m160-sp13-mid2-practice-1.pdf, for use in the LaTeX document with source file m160-sp13-mid2-practice.tex).
  3. Save the file in the directory where my LaTeX source file lives.
  4. \includegraphics, FTW!

Like most teachers, every time I teach a course I’ve taught before, I like to reuse old materials, often after improving them or adjusting them to suit the new class. Therefore, it’s good to record the exact Sage commands somewhere, as opposed to just keeping the graphic file, in case I want to modify the graphic. One way you can do this is to paste the Sage commands as a comment in the LaTeX file. This has the advantage of allowing future tweaks to be recorded in your version control system. (And you really should be using a version control system, so that way you won’t be afraid to make changes to your document.) Unfortunately, modifications then mean a lot of copy-and-pasting: you have to modify the code in the Sage notebook, and then copy-and-paste the modifications to the comments in the LaTeX document, or vice-versa. And then you have to save another version of your graphic from the browser. What a headache!

SageTeX makes this a lot easier. When I want to put a Sage plot in my document, I can put the Sage commands right in the document:

\begin{sagesilent}
var('x,y')
gfx = implicit_plot((x + 1)*(x^2 + y^2) == 3*x^2, (x, -2, 2),(y, -2, 2), axes=true, frame=false)
gfx = gfx + list_plot([(1/2, -1/2)], size=50)
save(gfx, "m160-sp13-mid2-practice-1.pdf", figsize=[3, 3])
\end{sagesilent}

\item (15 points) 
Consider the curve with the equation 
$(x + 1)(x^2 + y^2) = 3x^2$ (shown below). 
Use implicit differentation to find $\tfrac{dy}{dx}$, 
and then find an equation for the tangent line 
of the curve at the point
$\left(\tfrac{1}{2},-\tfrac{1}{2}\right)$.\\
\includegraphics[width=3 in]{m160-sp13-mid2-practice-1.pdf}

When you compile your document with pdflatex, it creates a Sage script file titled (in this case) m160-sp13-mid2-practice.sagetex.py. Compiling this with Sage will create (or update) the file m160-sp13-mid2-practice-1.pdf, which you can include (or update) by running pdflatex again!

That’s pretty awesome.

Up goer five dissertation summary

I learned about this Tumblr blog where people try to summarize their PhD dissertations in the style of xkcd’s “Up Goer Five” comic—that is, “using only the ten hundred words people use most often”. There’s an online text editor that checks whether you’ve strayed from these thousand most-common words.

Inspired by this blog, here’s my attempt to summarize my dissertation (Koszul and generalized Koszul properties for noncommutative graded algebras) in “Up Goer Five” style:

You can add and times numbers. There are ways make up a set other things you can add and times like you can with numbers. We call these sets “rings”. Sometimes, with these new things, the order in which you times things changes what you get.

Some of these rings have floors, like a building. When you times two things in the ring, you have to add the floor numbers to figure out which floor the thing you get is on.

There is a way to study these rings with floors with strange add and times that comes from the study of forms in space. Given a ring with floors, you can make a new ring with floors that is sort of like it, but with some things about it inside out.

I studied stuff about these new rings with floors coming from the old, especially in cases where the order in which you times things changes what you get from times.

And here’s Sarah’s “Up Goer Five” summary of her dissertation (Search for single top quark production with the CDF Run II detector using a multivariate likelihood method):

We made very very very small but very heavy things (called top things) in a new way. These top things are very small and are like a point, but are very heavy. They also live for a very short time. Usually you see two top things made at the same time. We found one top thing made with another thing. This one top thing looks a lot like other small heavy things that are made more easily. So, we had to tell our one top thing from all the other small heavy things that we made as well. It was hard. We used computers to help with the numbers. I worked with many people. But, I found the one top thing turning into three other things, while other people found the one top thing turning into two other things. We added my finding with my friends to make a strong finding.

Our finding was so strong we thought for sure it was true. But, we like to know for sure for sure for sure, not just for sure. So, the next year another friend made another finding of the same thing. With our finding and the new finding and we thought for sure for sure for sure it was true. So, now every person thinks our finding is true as well. Now our finding is in the way of seeing other new very small very heavy things, but that is life.

“Good general theory does not search for the maximum generality, but for the right generality.”

This comes from Saunders Mac Lane in his textbook Categories for the Working Mathematician (p. 108, emphasis mine), but I contend it applies to more than just mathematics:

One may also speculate as to why the discovery of adjoint functors was so delayed. Ideas about Hilbert space or universal constructions in general topology might have suggested adjoints, but they did not; perhaps the 1939–1945 war interrupted this development. During the next decade 1945–55 there were very few studies of categories, category theory was just a language, and possible workers may have been discouraged by the widespread pragmatic distrust of “general abstract nonsense” (category theory). Bourbaki just missed [. . .] Bourbaki’s idea of universal construction was devised to be so general as to include more–and in partcular, to include the ideas of multilinear algebra which were important to French Mathematical traditions. In retrospect, this added generality seems mistaken; Bourbaki’s construction problem emphasized representable functors, and asked “Find \(F\,x\) so that \(W(x, a) \cong A(F\,x, a)\)”. This formulation lacks the symmetry of the adjunction problem, “Find \(F\,x\) so that \(X(x, G\,a) \cong A(F\,x, a)\)”—and so missed a basic discovery; this discovery was left to a younger man, perhaps one less beholden to tradition or to fashion. Put differently, good general theory does not search for the maximum generality, but for the right generality.