Saturday, March 30, 2013
Top mathematics videos
Vi Hart has many, many awesome math videos. Here's just one to get you started. OK, I can't resist linking to this one too. Very hard to pick a favorite.
Donald Duck in Mathmagicland. This is from 1959, so parts of it are a bit dated but it had a significant influence on me when I saw it sixth grade. I know many other friends and family who remember it fondly as well - a real classic.
A video from 1988 from Caltech, very well done: http://archive.org/details/theorem_of_pythagoras.
Möbius Transformations. Short but very well done.
Niles Johnson's Hopf Fibration video. Hopefully Niles will continue making more videos like this.
Not Knot part I and part II. This is a window onto some really advanced mathematics, but I think its worth showing to just about everyone. Perhaps more than any other video I know, it visually conveys one of the many amazing structures of modern mathematics. Its a good antidote to anyone who thinks that math=arithmetic.
Dimensions is a 9-part series of short movies that have excellent animations. Of course some episodes are better than others.
There are some other series which are more educationally oriented (and generally less visually stunning) but worth checking out: the Mathalicious project, the TED-Ed math section, and the Numberphile youtube series.
Finally, two movies which are good are "Between the Folds" (on origami and mathematics), and the BBC Horizons documentary "The Proof" which is about Wiles' solution to Fermat's Last Theorem. These are both about an hour, so they require a longer attention span than the ones listed above.
If you have any favorites which aren't listed here, let me know.
Wednesday, March 6, 2013
The Singular Value Decomposition and Congressional Voting
If you're interested in how this is done, here is the Sage code I used as a Sage worksheet.
Here is the projection onto the first two singular vectors:
Tuesday, February 5, 2013
Third grade math worksheets
http://www.d.umn.edu/~mhampton/ThirdGradeWorksheets_1_to_76.pdf
She was 8 and 9 during this time. Some of them were too hard, and she required quite a bit of assistance. Also, since she is learning German, there are a handful of questions that use German number names.
They would require significant editing to be appropriate to a broad audience, but I am proud of some of them. Its hard to find good workbooks that include more than the bare minimum material that kids in the US are over-tested on.
Monday, January 28, 2013
Motion sensitive LED belt
I started with the LED belt kit by Adafruit:
http://www.adafruit.com/products/332,
for which they supply an excellent tutorial:
learn.adafruit.com/digital-led-belt
To this I added a 3-axis accelerometer, the ADXL335 from Adafruit:
http://www.adafruit.com/products/163
Adding the accelerometer is very simple. The 3V in and ground are soldered with short wires to the corresponding pins on the Atmega32u4 breakout board, and wires from the X,Y, and Z outputs can be soldered to the F4, F5, and F6 pins (see http://github.com/adafruit/Atmega32u4-Breakout-Board for more details or http://www.adafruit.com/datasheets/af_at32u4bb_pinout.pdf for a good diagram).
After a lot of tweaking, here is the code we actually used for the performance:
http://www.d.umn.edu/~mhampton/LED_belt_accelerometer.pde
Here is a short video (with a special guest star - our dog - in the background):
Sorry about the graininess - hopefully I can get a somewhat better version soon. I'm also hoping for good closeup pictures of the soldered connections.
Wednesday, November 7, 2012
Tuition myths
There have been many, many articles written over the past few years bemoaning the rapid rise of college tuition. Often there is an implication that the budgets of colleges and universities have ballooned. While it is true that personnel budgets have grown faster than inflation, this is primarily due to the increased cost of healthcare. The real culprit behind most tuition increases at public colleges and universities is a massive decrease in state spending per student. In this post, I will try to illustrate the reality of this for my own institution, the University of Minnesota Duluth.
It is currently Minnesota law that "the state must provide at least 67 percent of the estimated expenditures" for resident undergraduate students, including those from other states such as Wisconsin with which we have a reciprocity agreement (link to statute). There is a cutoff for people who rack up too many credits without graduating, but the law would cover almost all of the current students at UMD.
The actual state contribution is much, much smaller than the law requires. Currently the state provides around 20% of the "O & M" (operations and maintainance) costs for UMD students.
The plots above show, in 2012 inflation-adjusted dollars:- The nominal tuition at UMD over the last five years (in blue).
- The actual average tuition (in green). This is the actual tuition taken in by UMD divided by the number of students (data is from fall enrollment).
- The black line is what the tuition would have been if the state had maintained its 2007 spending levels for UMD, in inflation-adjusted dollars. This is based on the total dollar amount from 2007, so it does not account for the increase of enrollment at UMD.
- The red line is what tuition would be if the state obeyed its own laws and funded 2/3 of the costs of undergraduate education (for residents of MN and its reciprocity partners). This would have kept tuition constant in real terms at about $5000/year.
How much would that last scenario cost? For UMD, it would cost about $6,750 per student per year. If we use this amount for the whole state, we can estimate the impact on the state budget. Every year about 25,000 MN high school students enter a public university or community college. Let's assume they all eventually get four-year degrees (the "worst"-case scenario from a budgeting point of view, since many do not finish). Then this program would cost approximately $675,000,000 per year. That's a lot, but it isn't a crazy number, considering the current MN higher education budget, excluding loans, is around $200 million.
Thoughtful comments are welcome.
Tuesday, February 28, 2012
Some worksheets for the curious eight year old
While I am all in favor of a certain amount of drill problems to learn arithmetic, I think usually in schools the exercises are too narrowly focused on one topic. So I have started making some worksheets with more of a mix of subjects. In the slight chance that they are of interest to other parents or kids, I will try to post them here. Here are the first eight, as PDFs and the source LaTeX:
Worksheet PDFs
LaTeX sources
In case you are worried that I am reinventing the wheel, I am very actively looking at other material. We already have some more standard curricular materials, and we are also using the Khan Academy quite a bit - a really fantastic resource for basic mathematics.
Friday, July 29, 2011
Review of "Sage: Beginner's Guide" by Craig Finch
On Amazon you can browse the table of contents, which gives a pretty good idea of the strengths of the book, namely basic computation and plotting, numerical calculations, and data analysis. The focus was an excellent choice considering what is already available. The current free Sage Tutorial is oriented much more towards pure mathematicians. There is a Numerical Computing With Sage as part of the standard documentation, but at the moment its quite short and nowhere near as helpful as Finch's book.
I liked the style of the book a lot. There are many code examples that illustrate how to accomplish concrete tasks, along with good explanations of what they are doing. Many of these are things that are unfortunately far from obvious to a beginner (or even intermediate) Sage user. Despite using Sage heavily for the last five years, I learned some new things. The book is particularly strong in showing how to use Numpy, Scipy, and Matplotlib. Sage wraps a lot of the functionality of these projects, but if you want to do something that isn't included in the standard interfaces it can be quite mystifying.
Chapter 9, "Learning Advanced Python Programming", might have been a little ambitious. There's nothing wrong with it, but its too short to provide enough. Fortunately there are a lot of good books, some of them free, that cover Python programming in much more depth. I would have preferred some of this space and effort to be devoted to using Cython and the @interact command, which are covered very briefly in Chapter 10.
I teach several classes using Sage and I will definitely advertise this text as a useful optional supplement (I consider it a little too expensive to add on as a mandatory second text). It would be nice if some institutions considered using Sage instead of its commercial competitors such as Maple, Matlab, and Mathematica - you could probably give every student a copy of this book for the money saved from license fees!
The only thing I disliked about the book was the quality of the illustrations. Sage output that was in LaTeX was not typeset, but instead looks as if a PNG was copied from a screenshot. Some of the examples would have benefited from being in color. The quality of the plots is also somewhat poor. This is not too big a deal if one is following along with Sage, since you can reproduce the figures. None of them are bad enough to obscure the content.
Overall this is a very impressive and useful introduction to Sage that should help any beginning user a great deal.
Tuesday, July 19, 2011
Top Ten Talk Titles at the International Congress of Industrial and Applied Mathematics
10. The Most Likely Path to Systemic Failure
9. Exploding Rocks
8. Moving Mucus from the Outside In
7. Ducks in Array: Inferring Individual Rules from Collective Behaviour
6. The Nonlinear Dynamics of Jellyfish Swimming
5. The Neuromechanics of Insect Locomotion: How Cockroaches Run Fast and Stably Without Much Thought
4. Transformational Acoustics: Acoustic Cloaks, Carpets and Wormholes
3. A Semi-Implicit Blob Projection Method for Tiny Insect Flight
2. Mathematical Model for Contemplative Amoeboid Locomotion
1. Warping Peirce Quincuncial Panoramas
Monday, May 16, 2011
Ultrafilters
Recently I was reading a book on the positivity of multivariate polynomials, and I had to recall what ultrafilters are. Even having learned that before, its a bit of a struggle to internalize. It did inspire me to make the following "ad":
Wednesday, April 27, 2011
A family of Mobius transformations
Wednesday, March 23, 2011
Sci-fi history in a painting

(The crop above is just the tip of the iceberg.)
Monday, March 21, 2011
Plotting the zeta function
def xy_to_zeta_size(x,y):
return abs(zeta(N(x+I*y)))
cvals = [e^i for i in srange(-7,1,.25)]
cp = contour_plot(xy_to_zeta_size,(-6,3),(-3,3),contours = cvals, fill=False, plot_points = 201)
rzeta(z) = zeta(z)/norm(zeta(z))^(.25)
rzf = fast_callable(rzeta,domain=CDF)
cparg = complex_plot(rzf,(-6,3),(-3,3))
show(cparg+cp,figsize=[18,12])
Monday, February 28, 2011
Youtube videos of n-body choreographies

For a presentation I'm doing tomorrow, I made some animations of n-body choreographies (n equal masses which share a common trajectory). I put these up on youtube since that seems to make more sense than having them mangled by Blogger or hosting them myself:
Twenty-one bodies
Eight bodies
Three bodies on a figure eight
The videos are done using Sage, the Tachyon raytracer, and ffmpeg. The orbit data is from Carlos Simo.
Here's a 2D picture of the twenty-body choreography.
Wednesday, September 29, 2010
Are you listening, pig?

I'd just like to share some recommendations that are all connected by the theme of visual and concrete computing. In the last few years I've become more and more convinced that (in the United States at least) our educational system is almost completely failing to provide adequate skills in computing - both the theory and practice of computer science. This is sad because I think there are many fun and interesting ways to learn about programming, logic, and algorithms. Here are some examples:
1. LOGO. When I was in elementary school I was exposed to Logo, a very visual platform for learning programming. If you have a child, make sure you check out an implementation and show your kid. No matter what computer you have, its almost certain that there are several free Logo programs for it.
2. Similar in spirit to Logo, but maybe more fun and less deep is the game Light-Bot at Armor Games. You can drag and drop visual program elements to write a program that instructs a robot to complete a variety of puzzles. Very fun, well done.
3. There are novels that glamorize hackers and computing to some extent, but nothing I've seen compares to the plot in Souls in the Great Machine by Sean McMullen. The plot is brilliant and complicated, but all you need to know is that they enslave all the mathematicians to create a giant human computer.
4. I was reminded of Eyes of the Calculor by this fantastic video on youtube. The creator has implemented a gigantic arithmetic unit within the virtual Minecraft environment. He mentions he was inspired by the book The Elements of Computing Systems: Building a Modern Computer from First Principles. I hadn't heard of that before but I will definitely take a look. If you watch the video you'll get the title of this post.
Sunday, September 12, 2010
Torus knots in Sage with Tachyon and @parallel

After working a bit more on a patch improving the Tachyon raytracer in Sage, I made a movie of a torus knot. The code below was parallelized to use 20 cores at a time on one of the Sage Foundation's lovely Sun Fire X4450s. Frames were animated with ffmpeg. Blogger might degrade the video, so I recommend downloading the original here.
pk = 3
qk = 23
res = 180
trad = .5
lab = 'tk_' + str(pk) + '_' + str(qk)
def tknot(theta):
return [(2 + trad*cos(qk*theta/pk))*cos(theta), \\
(2 + trad*cos(qk*theta/pk))*sin(theta), trad*sin(qk*theta/pk)]
@parallel(ncpus = 20)
def tknotter(anum):
th = anum*2.0*pi/res
T = Tachyon(xres = 800, yres = 600, camera_center = (4,4,2.5), \\
raydepth=12, antialiasing=2)
loc = tknot(th)
nloc = [abs(x)/norm(vector(loc)) for x in loc]
T.texture('s1',color=nloc,specular=1)
T.texture('p1',color=(.5,.5,.5))
T.sphere(loc,.05,'s1')
ci = 0
for sth in srange(0,th,2*pi/res):
e1 = tknot(sth)
e2 = tknot(sth+2*pi/res)
ts = [abs(x)/norm(vector(e1)) for x in e1]
T.texture('t'+str(ci), color=ts)
T.fcylinder(e1, e2, .025,'t'+str(ci))
ci += 1
T.plane((0,0,-4),(0,0,1),'p1')
T.light((6,6,11),.1,(1,1,1))
T.light((5.9,5.9,11),.1,(1,1,1))
T.save(DATA+lab+'%03d.png'%anum)
return 1
qin = range(pk*res)
s = list(tknotter(qin))
for i in range(40):
r2 = os.system('cp '+DATA+lab+'%03d.png '%(pk*res-1) + DATA+lab+'%03d.png'%(pk*res+i))
anum = qin[-1] + 41
th = anum*2*pi/res
T = Tachyon(xres = 800, yres = 600, camera_center = (5,5,3))
T.save(DATA+lab+'%03d.png'%anum)
The animation was then done with the following code; if you want to do something similar you would have to use the appropriate path to your ffmpeg executable.
import subprocess
subprocess.call('/home/mhampton/ffmpeg/ffmpeg -qmax 2 -i ' + \\
DATA + 'v%3d.png ./t2vest.mp4', shell=True, stdout=file('/dev/null','w'),stderr=file('/dev/null','w'))
Flight in Curved Spaces

I was recently reminiscing about the movie Not Knot, and began thinking about recreating some of the hyperbolic scenes. But then today I stumbled upon a really nice application that does exactly what I was thinking about and more:
http://www.geometrygames.org/CurvedSpaces/index.html
Its a pretty small download, works on most platforms, very fun.
Friday, September 3, 2010
Tachyon in Sage: depth of field perspective

Today I found a bug in the options to the tachyon raytracer in Sage. It should be possible to use alternate projections, including fisheye lens and perspective depth-of-field projections. I think I've fixed that, patch should get into sage-4.6 or so.
Here's a quick example:
T = Tachyon(xres=800,antialiasing=24, raydepth=12, projection = 'perspective_dof', focallength = '1.0', aperture = '.005')
T.light((0,5,7),1.0,(1,1,1))
T.texture('t1', opacity=1, specular = .3)
T.texture('t2', opacity=1, specular = .3, color = (0,0,1))
T.texture('t3', opacity = 1, specular = 1, color = (1,.8,1), diffuse=0.2)
T.plane((0,0,-1),(0,0,1),'t3')
ttlist = ['t1','t2']
tt = 't1'
T.cylinder((0,0,.1),(1,1/3,0),.05,'t3')
for q in srange(-3,100,.15):
if tt == 't1':
tt = 't2'
else:
tt = 't1'
T.sphere((q,q/3+.3*sin(3*q),.1+.3*cos(3*q)), .1, tt)
T.show()
Sunday, July 25, 2010
Glack
Courtesy of Warrack's Scot Dialect Dictionary, 1911.
Sunday, May 9, 2010
Book review: The Manga Guide to Molecular Biology
The molecular biology guide does a good job explaining the classic, core ideas: DNA replication, transcription, translation, and some of the biochemical structures. To give an idea of the level of detail, Okazaki fragments, the structure of transfer RNA, and introns and exons are included, but not poly-adenylation. Some topics, like micro-RNA, are briefly described in sections that are in a more traditional textbook style.
Perhaps the best use of this book is as a gift to someone to encourage an interest in molecular biology - for example, a high school student relative.
Saturday, May 1, 2010
A suspicious histone of Symbion pandora
The articles mention that it was so unusual that a new phylum was proposed, the Cycliophora. I was curious about this so I looked up what sequences are available for Symbion pandora. There are some ESTs that are in the trace read archive, un-annotated as far as I can tell, and about 100 nucleotide records. Most of those are for RNA subunits, or cytochrome oxidase subunits, but there is one histone record. I've been reading about histones quite a bit recently so I BLASTed that record. It seems very suspicious to me that all the top hits were to lobsters (see alignment below, the top hit. Nephrops norvegicus is the Norway lobster). I strongly suspect that this was contaminated, and is not a correct Symbion pandora sequence.

The Neatorama link
More info is available from the New Scientist article that Neatorama links to.



