Sunday, January 25, 2009

Live from Cape Town

I arrived at AIMS (the African Institute for Mathematical Sciences) yesterday. Its a great place, right on the Muizenberg beach near Cape Town - quite a thrill after being in Duluth this time of year.

I have volunteered to teach a short course on bioinformatics algorithms here, using biopython and Sage as the computational platform. It will be very interesting to see how it goes over. I am using the Plasmodium species which cause malaria as a source of examples and projects.

Below is a satellite picture of the cape peninsula and a view of Muizenberg that includes the main AIMS building.


Thursday, January 22, 2009

Integral Apollonian Packings with Sage

At the national math meetings this year I heard about some really interesting and fun work on integral Apollonian circle packings. The AMS has a nice introductory article about them. I couldn't resist trying to compute and draw some in Sage. Carl Witty greatly improved the speed of my first attempt, so what follows can be considered joint work of ours. (Sage can compute nicer PDF output of these, but blogger doesn't embed PDFs.)



def kfun(k1,k2,k3,k4):
"""
The Descartes formula for the curvature of an inverted tangent circle.
"""
return 2*k1+2*k2+2*k3-k4

def circfun(c1,c2,c3,c4):
"""
Computes the inversion of circle 4 in the first three circles.
"""
newk = kfun(c1[3],c2[3],c3[3],c4[3])
newx = (2*c1[0]*c1[3]+2*c2[0]*c2[3]+2*c3[0]*c3[3]-c4[0]*c4[3])/newk
newy = (2*c1[1]*c1[3]+2*c2[1]*c2[3]+2*c3[1]*c3[3]-c4[1]*c4[3])/newk
if newk > 0:
newr = 1/newk
elif newk < 0:
newr = -1/newk
else:
newr = Infinity
return [newx, newy, newr, newk]

def mcircle(circdata, label = False, thick = 1/10):
"""
Draws a circle from the data. label = True
"""
if label==True and circdata[3] > 0 and circdata[2] > 1/2000:
lab = text(str(circdata[3]),(circdata[0],circdata[1]), fontsize = \
500*(circdata[2])^(.95), vertical_alignment = 'center', horizontal_alignment \
= 'center', rgbcolor = (0,0,0))
else:
lab = Graphics()
circ = circle((circdata[0],circdata[1]), circdata[2], rgbcolor = (0,0,0), \
thickness = thick)
return circ+lab

def add_circs(c1, c2, c3, c4, cutoff = 300):
"""
Find the inversion of c4 through c1,c2,c3. Add the result to circlist,
then (if the result is big enough) recurse.
"""
newcirc = circfun(c1, c2, c3, c4)
if newcirc[3] < cutoff:
circlist.append(newcirc)
add_circs(newcirc, c1, c2, c3)
add_circs(newcirc, c2, c3, c1)
add_circs(newcirc, c3, c1, c2)

zst1 = [0,0,1/2,-2]
zst2 = [1/6,0,1/3,3]
zst3 = [-1/3,0,1/6,6]
zst4 = [-3/14,2/7,1/7,7]

circlist = [zst1,zst2,zst3,zst4]
add_circs(zst1,zst2,zst3,zst4)
add_circs(zst2,zst3,zst4,zst1)
add_circs(zst3,zst4,zst1,zst2)
add_circs(zst4,zst1,zst2,zst3)

sum([mcircle(q, label = True, thick = 1/2) for q in \
circlist]).save('./Apollonian3.png',axes = False, figsize = [12,12], xmin = \
-1/2, xmax = 1/2, ymin = -1/2, ymax = 1/2)

Protein of the Day #16: Maltase (plus a beer recipe)

I just bottled a batch of my Chocolate Cake Stout, which is:

  • 1 lb of Simpon's roasted barley
  • 1 lb of crisp amber malt
  • 6 lbs gold malt syrup (from Northern Brewer)
  • 1 oz Yakima Magnum hops (13.5 % Alpha acid)
  • Safale S-04 yeast
  • 8 oz Dutch process cocoa (from Penzey's Spices)
  • 1 lb lactose sugar
  • 1 whole vanilla bean (also from Penzey's).

Good stuff.





Maltase (alpha-D-glucosidase) is a crucial enzyme in beer making, and its regulation in response to other sugars is important to understand if you really want to grok brewing. Maltose is a disaccharide of two units of glucose; in most organisms it needs to be broken down to glucose before being used in other biochemical processes. The presence of glucose inhibits the production of maltase and maltose transporter proteins, so the glucose in a wort has to be mostly used up before the yeast will switch to consuming the maltose.

Tuesday, January 6, 2009

Sage at the joint math meetings

Live from DC, we're halfway throught the joint mathematics meetings. This is the second year that Sage has had a booth in the exhibit hall.

Our location is not as good as last year's, but we are still getting a good amount of foot traffic - enough to occupy most of the people here most of the time. David Harvey, David Joyner, Robert Miller and I have been manning it most of time. Jason Grout helped out this afternoon quite a bit. I may be forgetting some folks because I'm a little frazzled.

The word of mouth about Sage is increasing, many people stopping by have tried it or at least heard about it. I think its very encouraging for the future. Several people expressed interest in how to become developers.

We had an MAA panel session today on open-source software in the undergraduate curriculum. Four speakers, two of which (David Joyner and Robert Miller) talked about Sage (others on R and WeBWork).

Overall, so far the booth has been another success in raising awareness and enthusiasm for Sage. Talking to different people has made me enthused about all sorts of development projects, enough to keep me busy for at least the next year...