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.
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.
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.
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":
- biological adhesion
- biological regulation
- carbohydrate utilization
- carbon utilization
- cell killing
- cell wall organization or biogenesis
- cellular component biogenesis
- cellular component organization
- cellular process
- death
- developmental process
- establishment of localization
- growth
- immune system process
- localization
- locomotion
- metabolic process
- multi-organism process
- multicellular organismal process
- nitrogen utilization
- phosphorus utilization
- pigmentation
- reproduction
- reproductive process
- response to stimulus
- rhythmic process
- signaling
- signaling process
- sugar utilization
- sulfur utilization
- 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.
Saturday, February 27, 2010
complex plot in sage
I've been amusing myself all day with doing some complex plotting in Sage. The default color scheme has 0=black, infinity=white, and red=real. A lot of the time, this doesn't work too well, but if you plot f/abs(f) the color will just depend on the complex argument. For example, if f = (z^5+1)/(z^5-1) we get:
Or a more baroque example, f = z*log(z)*exp((z^5+1)/(z^5-1)^(1/2)):
Sometimes the default coloring is helpful, for example when showing the essential singularity at 0 of exp(1/z):
Or a more baroque example, f = z*log(z)*exp((z^5+1)/(z^5-1)^(1/2)):
Sometimes the default coloring is helpful, for example when showing the essential singularity at 0 of exp(1/z):
Monday, February 8, 2010
National Merit Corporation bullies blogger
I just read an appalling story of a blogger being bullied by the National Merit Scholarship Corporation. She posted their cutoff PSAT scores for each state (I hadn't realized that they varied at all) and was threatened with legal action if she didn't take down the information.
Not surprisingly, after hearing about this someone else compiled the same information, and all the corporation has done is highlight their questionable judgement in a variety of ways.
Not surprisingly, after hearing about this someone else compiled the same information, and all the corporation has done is highlight their questionable judgement in a variety of ways.
Subscribe to:
Posts (Atom)