Computing variance is often a useful thing for a Computer Scientist to do; however, when one is taking a large number of samples, it becomes desirable not to have to store all of the samples to compute the variance. After plugging through the math, I finally found a way to compute both the mean and variance without storing any samples, simply by applying an incremental formula. A different version of the formula can be found on Mathworld, but I could not find it again after searching. If you manage to, send me the link so I can post it.
mean = 0
variance = 0
for i = 1 to num_samples
sample = get_new_sample()
temp_mean = (mean * i + sample) / (i + 1)
if (i > 1)
variance = variance*(i - 2)/(i - 1) + (sample - mean)^2/i
end if
mean = temp_mean
end for
What's that you say? You need to have a valid href attribute in order for some part of your style sheet to work? But you don't actually want to load a new page when the viewer clicks on the item? Javascript to the rescue. Use javascript:void(0) as the href value for the a tag.
In one of my classes at Cornell, I had to make a "dual quine". A quine is a program that when executed, prints out its own source code. There are some restrictions on what forms a valid quine - it must a valid program in whatever the chosen language is, and no File I/O must be used. A dual quine then would be two programs (in different languages preferrably), such that program A printed out program B's source and vice versa. Here are my quines:
C half of the quine.My professor for the class, Dexter Kozen, has a link on his page to the most exhaustive collection of quines that I've seen. Here is the link to that quine page.