Tuesday, February 5, 2013

Third grade math worksheets

These are some (about 76 I think) worksheets that I have used in homeschooling my daughter this year:

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

Recently I built a motion sensitive LED belt for a dance performance by my wife. In case it is of interest to others, this post will briefly describe how I made it.

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

My increased use of Google+ and to a lesser extent Facebook has meant this blog, never very active, has fallen on hard times. But it might get revived a bit by a new project: my wife and I decided to try homeschooling our daughter.

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

I was asked by the publisher to review "Sage: Beginner's Guide" by Craig Finch. They sent me a free copy; I have no other conflicts of interest. I am generally biased towards Sage itself, as an avid user and minor developer.

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

One of the challenges in learning mathematics is the vocabulary. Its hard not just because of the sheer number of words. Some words make an old word strangely precise, like "continuous". But many others are naming concepts which have no common equivalent, and each of these requires wholly new paths of thought.

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

I was trying to sketch the behavior of a Mobius transformation in my complex analysis course today. Its hard to convey on the blackboard, so I tried making a video which shows a homotopy of the image of the unit disk, from the identity to (1+z)/(1-z) and back again.


Wednesday, March 23, 2011

Sci-fi history in a painting

This is pretty fantastic - Ward Shelley's "The History of Sci­ence Fiction":



(The crop above is just the tip of the iceberg.)

Monday, March 21, 2011

Plotting the zeta function

I lectured a tiny bit on the Riemann zeta function for the first time in my complex analysis course, which inspired me to make the following plot. Colors are the argument of the Riemann zeta function, brightness is proportional to magnitude. The default brightness map gives very low contrast, so I modified the magnitudes. To help with seeing the magnitudes a contour map with exponentially spaced contours is overlaid.


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

Glack: n. a ravine, a defile; the fork of a tree, road, etc.; the angle between the thumb and forefinger; an opening in the wood where the wind blows briskly; a handful or small portion; as much grain as a reaper holds in his left hand; a slight repast.

Courtesy of Warrack's Scot Dialect Dictionary, 1911.

Sunday, May 9, 2010

Book review: The Manga Guide to Molecular Biology

After getting the Manga Guides to Statistics and Databases, I recently bought the Manga Guide to Molecular Biology. All of these guides are very basic, so if you already know a substantial amount you won't learn anything new, but I think they can be useful for teachers and for raw beginners.

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

Recently on the blog Neatorama they highlighted a very strange creature, a parasite of the lobster that is pretty unrelated to other animals - Symbion pandora. Its got a rather complicated reproductive cycle, as described in the links below.

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.

Wednesday, March 17, 2010

Biological ontologies


I've postponed really learning about ontologies in bioinformatics for a while now, but circumstances now dictate that I figure it out. It is a little bewildering. As just one example, the current Gene Ontology has the following processes as the top-level categories of "biological processes":


  1. biological adhesion

  2. biological regulation

  3. carbohydrate utilization

  4. carbon utilization

  5. cell killing

  6. cell wall organization or biogenesis

  7. cellular component biogenesis

  8. cellular component organization

  9. cellular process

  10. death

  11. developmental process

  12. establishment of localization

  13. growth

  14. immune system process

  15. localization

  16. locomotion

  17. metabolic process

  18. multi-organism process

  19. multicellular organismal process

  20. nitrogen utilization

  21. phosphorus utilization

  22. pigmentation

  23. reproduction

  24. reproductive process

  25. response to stimulus

  26. rhythmic process

  27. signaling

  28. signaling process

  29. sugar utilization

  30. sulfur utilization

  31. viral reproduction



Most of these are reasonable, some seem odd. Pigmentation? A top-level process?

It reminds me of the fabulous first paragraph of Michel Foucault's "The Order of Things" (in my opinion his best book):


This book first arose out of a passage in Borges, out of the laughter that shattered, as I read the passage, all the familiar landmarks of my thought - our thought, the thought that bears the stamp of our age and our geography - breaking up all the ordered surfaces and all the planes with which we are accustomed to tame the wild profusion of existing things, and continuing long afterwards to disturb and threaten with collapse our age-old distinction between the Same and the Other. This passage quotes a ‘certain Chinese encyclopedia’ in which it is written that ‘animals are divided into: (a) belonging to the Emperor, (b) embalmed, (c) tame, (d) sucking pigs, (e) sirens, (f) fabulous, (g) stray dogs, (h) included in the present classification, (i) frenzied, (j) innumerable, (k) drawn with a very fine camelhair brush, (1) et cetera, (m) having just broken the water pitcher, (n) that from a long way off look like flies’. In the wonderment of this taxonomy, the thing we apprehend in one great leap, the thing that, by means of the fable, is demonstrated as the exotic charm of another system of thought, is the limitation of our own, the stark impossibility of thinking that.

Thursday, March 4, 2010

weather maps

Anyone who reads this blog, please chime in with your favorite weather maps or sites. I'm particularly interested in big, high-res satellite animations for the US. Best one I've found is here.