Thursday, Dec 29, 2005, 8:22 PM
"Conjure our spirits in a magical language called Lisp"
Even the first 10 minutes of the 1st lecture of the MIT lectures on "Structure and Interpretation of Computer Programs" is amazing.
"In Computer Science, we're in the business of formalizing 'how to' imperative knowledge" aka "process."
In the first 5 minutes, I've already implemented my own square root function, which works surprisingly well:
class Program {
static double MySquareRoot(double x) {
double margin = 0.10;
double g = x / 2.0;
while( System.Math.Abs(g * g - x) > margin ) {
g = (g + x / g) / 2.0;
}
return g;
}
static void Main(string[] args) {
double x = 44523.0;
System.Console.WriteLine("sqrt({0})= {1}", x, System.Math.Sqrt(x));
System.Console.WriteLine("MySquareRoot({0})= {1}", x, MySquareRoot(x));
}
}
I can't possibly believe that I would've understood the implications of the lecture as a freshman, but now, it's like Moses and the stone tablets. Priceless.
8 comments
on this post
SEan Chase:
Friday, Dec 30, 2005, 12:33 PM
Paulb:
http://blogs.tamtam.nl/paulb/2006/01/02/AHorribleWayToCalculateASquareroot.aspx
Monday, Jan 2, 2006, 5:44 AM
Steve Hiner:
Anyone know if they've been mirrored somewhere? I tried searching for a bitorrent but the only one I found didn't seem to work either.
Monday, Jan 2, 2006, 11:50 AM
lntkpfcb hazldt:
Tuesday, Apr 17, 2007, 7:20 PM
xyiljh utcbginel:
Tuesday, Apr 17, 2007, 7:20 PM
yxae euardxctk:
Tuesday, Apr 17, 2007, 7:22 PM
dsqiug rcnzk:
Tuesday, Apr 17, 2007, 7:22 PM
dsqiug rcnzk:
Tuesday, Apr 17, 2007, 7:23 PM




