2006-10-18 04:37 pm
Entry tags:

D f

A while back I peered into the code of SICM and was confused to find a scheme for computing derivatives that works by passing ordered pairs (x,Dx) around. I put it on my figure-this-out-sometime list and forgot about it until I saw Will Farr's blog entry yesterday, ``Automatic Differentiation'' in OCaml. Apparently "Automatic" or "Algorithmic Differentiation" is a long-known technique for computing the derivative of an arbitrary function as implemented in a algorithmic language.
2005-07-01 03:39 pm

annoying software

When I was very little and learning Pascal, I had only the foggiest notion of machine code and no idea about linkers and loaders whatsoever. I could, however, write a program in Pascal and then the compiler would magically turn it into an executable (EXE!) file. The only way I could conceive to write a compiler myself was this: To write a program that was really an interpreter, and then, to "compile" some source, I would concatenate the executable of my interpreter and the source to be "compiled." The interpreter would know, when run, to examine itself, seek to the point where its own executable code ended, and find the program it was suppose to interpret. Presto! A program to generate self-running exectables from source code! But it was not, of course, in any sense a compiler.

As far as I can tell, this is pretty much how the Matlab compiler works.
2004-07-13 02:11 am

google challenge

So, Google currently has a little promotion that involves a sort of puzzle hunt. The first puzzle, published on billboards and at [livejournal.com profile] googleblogatom is to find the first 10-digit prime number to occur in consecutive digits of e.

I tried to solve it using only standard unix programs, with the following pipeline:

cat e.2mil | delay_line 10 | factor | awk '$1=$2":" {print($2)}'

That pops out the right answer immediately...

e.2mil is a text file containing the first 2 million digits of e, and delay_line is a little C program that takes a stream of characters and whenever it receives a character after the ninth character, it outputs the previous ten characters seen. It would be much more satisfying if delay_line were implemented as a clever script and perhaps if e.2mil were generated somehow instead of with Mathematica or a Google search. (I know that there are faster ways to check primality than explicitly computing factors, but obviously this is quick enough...)

Two fun exercises on the side: download GNU coreutils and look at the sourcecode to factor to see how it works (it uses 'Wheel Factorization'), and compute the expected position of the first 10-digit prime in a random sequence of digits.

The second puzzle is to find what comes next in this sequence: 7182818284, 8182845904, 8747135266, 7427466391, _____ .

Further notes will appear on [livejournal.com profile] nibot_lab.

2003-02-16 12:38 am
Entry tags:

(no subject)

  1. I have `liberated' this new icon from the CERN website.

  2. The sound of rain on my room's roof is quite pleasant.

  3. Isn't it cheating to require a new axiom (the ``Infinity Axiom'') in order to construct the natural numbers, and still call it ``constructive'' (versus axiomatic)? The Infinity Axiom (∃A:(∅∈A)&(∀a∈A, a+∈A)) seems tailor made for the construction of the naturals.

  4. vmware is amazing. I can run Windows 2000 and Linux and Plan9 simultaneously, just as if this little computer were actually three. With Mozilla and OpenOffice running on both Win2K and Linux; and with Mindterm SSH running in a Java VM; and connected to my mailboxes via IMAP, it's clear to me that the future of computers isn't with platform independence, it's with platform irrelevancy.

  5. (nonetheless, it's still impossible to get any work done in Windows without somehow connecting to or emulating a Unix environment :-)