African Lungfish

I read an interesting story in the Science section of the NY Times this morning. It seems that Heather King (a biologist at the University of Chicago) and her team observed a few African Lungfish taking alternating steps with their back fins.

Can you image the fish pictured above, with those tiny back legs, hopping along a muddy riverbank? Of course not. Those appendages look like something from the Flying Spaghetti Monster. But… once upon a time, all animals lived in the water. According to these guys, and smart biologists everywhere, this was as recent as about 400 million years ago.

Why is this significant? The first animals to poop on land and eventually build space shuttles and particle accelerators, were likely very similar to the guy pictured above. Speaking of that, I’ve often wondered why these lobe-finned fish decided to leave the comforts of their oceans and boggy marshes. Probably a combination of the water becoming less oxygenated, or drying up, or the fact that there just weren’t enough good restaurants in their neighborhood. I’m sure they were disappointed to learn they were the first inhabitants of this new dry land and no one up here had invented restaurants yet. Continue reading »

 

At the risk of seeming like an intellectual snob (I’m not, I promise I’m not smart enough to be one), I’m posting this as a plea to anyone who routinely posts comments on any blogs anywhere.

Please, please, for the love of English teachers everywhere, spend a few minutes to learn a handful of words that come up time and time again. I promise, mastering these few words will not take very long. And while knowing these won’t make you a genius, it may keep millions of people from thinking you are an idiot.

Without further ado, here they are.

1) your and you’re. Whenever you find yourself in need of writing one of these words, ask yourself one simple question. Is what I’m writing short for “you are?” If it is, please use the second one. You know, the one with the apostrophe in it. The apostrophe means that it’s a contraction. Ie., two words have been contracted together. And when that happens, we sometimes leave letters out. The apostrophe is inserted where letters have been omitted. Continue reading »

 

Last night was amazing. Just four hundred and eleven years after the first performance of Shakespeare’s “Much Ado About Nothing,” Lisa and I watched a modern interpretation of the play at the Shakespeare Theater Company in Washington, DC. While I had neither read nor seen it performed before, as far as I could tell it seemed to be pretty faithful to the original- with the exception of it being set in Cuba. And Lisa had actually performed the play a couple years ago – as the lead Beatrice no less. Anyway, the play was too complex for me to give a review of it justice. I’ll just say that it was great. It motivated me to read it and to put the 1993 version in my Netflix queue (91% fresh on Rotten Tomatoes).

Just before the play, we had dinner at a pretty upscale restaurant downtown. The 701 Restaurant was great. You know the type- trendy, perhaps a little eclectic, with most people wearing suits and a sommelier walking around to offer advice on the best wines to go with your chicken nuggets. Just kidding. There was a sommelier, but this isn’t the kind of restaurant  Continue reading »

 

Here’s a clip of Maggie Belle telling us why her lips are so red. Her first explanation was pretty funny- but of course I didn’t have my phone ready. We tried to get her to explain it again while I could record it but it was only about 40% as funny the second time through.

Still, she’s my girl and I think she’s the cutest thing ever!

 

So, the latest congressional performance report is out (Rasmussen Reports, Dec. 1, 2011). I couldn’t believe the numbers. Just 6% of likely U.S. voters rated our current congress positively. Versus 68% who rated their performance as poor. In moderate times (ie., non-economic boom, non-recession type periods), we usually see a majority of Americans as mostly indifferent to the situation. Maybe 5% think they’re terrible. Another few percent think they’re great. But the bulk of the respondents would probably hover around labeling them as somewhere between average to perhaps slightly below average.

So why have their approval ratings hit this wall? No one knows for sure, and if they did they would probably be more astute students of our political system than anybody currently in politics. I do think it shows a short-sightedness in us as a people though. If we don’t like our current lot in life, someone needs to bear the responsibility. We must find someone to blame. And we all know that our shortcomings are typically not our own fault. Fortunately, in the system that we’ve created, we’ve got a built-in scapegoat. And when I say Continue reading »

 

Here’s our 2011 Thanksgiving in a nutshell. Just the four of us. Lisa cooked a 22 pound turkey. She and the kids had their share and I ate the other 21 pounds. Plus stuffing, green bean casserole, other stuff I can’t remember, and canned cranberry sauce. I love canned cranberry sauce. Sliced in perfect cylinders that look like big delicious red silver dollars. Until next year, happy holidays everybody!

 

The following is Problem 10 from Project Euler. As of this posting, it has been solved 62,312 times.

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.

MATLAB and Octave have a function called “primes” which takes any number as an argument and returns an array of all the prime numbers below that number.

For example, calling primes(10) would return an array of [2 3 5 7].

So solving this problem in MATLAB feels like cheating. The below code executed in just a few milliseconds.

% ProjectEuler.net problem #010
% The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
 
% Find the sum of all the primes below two million.
 
tic();
 
format long
final_answer = sum(primes(2e6))
 
exec_time = toc()

I suppose I could write an algorithm to find the primes and brute-force it with an IF or WHILE loop, but I think I’d rather move on to the next problem. So there you have it. Happy coding!

 

The following is problem 9 of Project Euler. As of this posting, it has been solved 67,769 times.

A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a^2 + b^2 = c^2

For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product a*b*c.

The following is a MATLAB and Octave solution. There may be no way around using nested FOR loops in this one. By using routine algebra to come up with the statement in the IF conditional, the program doesn’t have to loop through as many times. The following code executes in about 1.7 seconds.

% ProjectEuler.net problem #009
% A Pythagorean triplet where a<b<c, for which, a^2 + b^2 = c^2
% There exists exactly one for which a+b+c=1000. Find the product abc.
% Below code executes in 1.70 seconds.
 
clear
tic();
a=1; b=1;n=1000;
 
for a = 1:n
	for b = 1:1000-a
		if 1e6 - (2000)*(a+b) + 2*a*b == 0
			triplet(1:3) = [a b 1000-a-b];
		end
	end
end
 
triplet
final_answer = prod(triplet)
 
exec_time = toc()

There you have it. Good luck and happy coding!

© 2012 mattoneal.com Suffusion theme by Sayontan Sinha