<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"  "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>m8ta fun</title>
<link type="text/css" rel="stylesheet" href="normal.css" />
<script type="text/javascript" src="fun.js"></script>
</head>
<body>
<table>
<tr> 
	<td><a href="http://m8ta.com/index.pl">
		<img class="logo" src="m8talogo2.png"/>
		</a></td>
	<td>
		<font size = "46" color="blue">m</font><font size="44" color="orange">8</font><font size = "46" color="blue">ta</font>
		<br/>a web-document tool
		<br/>you are not logged in, <a href="login.pl">login</a>.  

		<a href="javascript:retrievePost(-1,0,'-1')">new entry</a>
	</td>
	<td>
		<table>
				<tr>
				<form method="get" action="index.pl">
				<td><font color="gray" face="monospace">text: </font><input type="text" name="search" size = "25" /></td>
				<td><input type="Submit" value="search"/></td>
				</form>
				</tr>
			<form method="get" action="index.pl">
				<tr>
				<td><font color="gray" face="monospace">tags:</font> <input type="text" name="ptags" size = "25" /></td>
				<td><input type="Submit" value="search"/></td>
				</tr>
			</form>
			<form method="get" action="index.pl">
				<tr>
				<td><font color="gray" face="monospace">type: </font><input type="text" name="ptype" size = "25" /></td>
				<td><input type="Submit" value="search"/></td>
				</tr>
			</form>
		</table>
	</td>
</tr>
</table>
<table><div id="-2" ></div>	<div id="764">
	    <div class="head">
		    <tr>
			    <td><i><font size="+1"><font color="orange">{<a href="index.pl?pid=764">764</a>}</font></font></i></td>
				<td>
				<div align="left">
				    <a href="javascript:hide(764,'764')">hide </a>/
				    <a href="javascript:retrievePost(764,2,'764')">edit[2] </a>/
				    <a href="index.pl?pid=764&amp;print=1">print</a>
				</div>
				</td>
			    <td>
			    <div align="left">
			    <font color="gray">type:</font> <a href="index.pl?ptype=work">work</a> 
			    <font color="gray">tags:</font> <a href="index.pl?ptags=ocaml">ocaml</a> <a href="index.pl?ptags=mysql">mysql</a> <a href="index.pl?ptags=programming">programming</a> <a href="index.pl?ptags=functional">functional</a> 
			    <font color="gray">date:</font> 07-03-2009 19:16 gmt
			    <font color="gray">revision:</font>2
			     <font color="orange">[<a href="javascript:displayPost(764,1,'764');">1</a>] [<a href="javascript:displayPost(764,0,'764');">0</a>] <a href="javascript:displayPost(764,-1,'764');">[head]</a></font>
			    </div>
			</td>
		</tr>
	    </div>
	    <tr><td colspan="3"><p>Foe my work I store a lot of analyzed data in SQL databases.  In one of these, I have stored the anatomical target that the data was recorded from - namely, STN or VIM thalamus.  After updating the analysis programs, I needed to copy the anatomical target data over to the new SQL tables.  Where perl may have been my previous go-to language for this task, I've had enuogh of its strange quiks, hence decided to try it in Ruby (worked, but was not so elegant, as I don't actually know Ruby!) and then Ocaml. </p>
<p><pre>ocaml
#use "topfind"
#require "mysql"

(* this function takes a query and a function that converts entries 
in a row to Ocaml tuples *)
let read_table db query rowfunc =
	let r = Mysql.exec db query in
	let col = Mysql.column r in
	let rec loop = function
		| None      -&gt; []
		| Some x    -&gt; rowfunc col x :: loop (Mysql.fetch r)
	in
	loop (Mysql.fetch r)
	;;
	

let _ = 
	let db = Mysql.quick_connect ~host:"crispy" ~database:"turner" ~password:"" ~user:"" () in
	let nn = Mysql.not_null in
	(* this function builds a table of files (recording sessions) from a given target, then 
	uses the mysql UPDATE command to propagate to the new SQL database. *)
	let propagate targ = 
		let t = read_table db 
			("SELECT file, COUNT(file) FROM `xcor2` WHERE target='"^targ^"' GROUP BY file")
			(fun col row -&gt; (
				nn Mysql.str2ml (col ~key:"file" ~row), 
				nn Mysql.int2ml (col ~key:"COUNT(file)" ~row) )
			)
		in
		List.iter (fun (fname,_) -&gt; 
			let query = "UPDATE `xcor3` SET `target`='"^targ^
				"' WHERE STRCMP(`file`,'"^fname^"')=0" in
			print_endline query ;
			ignore( Mysql.exec db query )
		) t ;
	in
	propagate "STN" ; 
	propagate "VIM" ; 
	propagate "CTX" ; 
	Mysql.disconnect db ;;
</pre></p>
<p>Interacting with MySQL is quite easy with Ocaml - though the type system adds a certain overhead, it's not too bad. </p></td></tr>
	</div>
	<div id="763">
	    <div class="head">
		    <tr>
			    <td><i><font size="+1"><font color="orange">{<a href="index.pl?pid=763">763</a>}</font></font></i></td>
				<td>
				<div align="left">
				    <a href="javascript:hide(763,'763')">hide </a>/
				    <a href="javascript:retrievePost(763,2,'763')">edit[2] </a>/
				    <a href="index.pl?pid=763&amp;print=1">print</a>
				</div>
				</td>
			    <td>
			    <div align="left">
			    <font color="gray">type:</font> <a href="index.pl?ptype=work">work</a> 
			    <font color="gray">tags:</font> <a href="index.pl?ptags=autocorrelation">autocorrelation</a> <a href="index.pl?ptags=poisson">poisson</a> <a href="index.pl?ptags=process">process</a> <a href="index.pl?ptags=test">test</a> <a href="index.pl?ptags=neural">neural</a> <a href="index.pl?ptags=data">data</a> 
			    <font color="gray">date:</font> 06-30-2009 21:07 gmt
			    <font color="gray">revision:</font>2
			     <font color="orange">[<a href="javascript:displayPost(763,1,'763');">1</a>] [<a href="javascript:displayPost(763,0,'763');">0</a>] <a href="javascript:displayPost(763,-1,'763');">[head]</a></font>
			    </div>
			</td>
		</tr>
	    </div>
	    <tr><td colspan="3"><p>I recently wrote a matlab script to measure &amp; plot the autocorrelation of a spike train; to test it, I generated a series of timestamps from a homogeneous Poisson process: 
<pre>function [x, isi]= homopoisson(length, rate)
<font color="green">% <font color="blue">function</font> [x, isi]= homopoisson(length, rate)</font>
<font color="green">% generate an instance of a poisson point process, unbinned.</font>
<font color="green">% length in seconds, rate in spikes/sec. </font>
<font color="green">% x is the timestamps, isi is the intervals between them.</font>

num = length * rate * 3; 
isi = -(1/rate).*log(1-rand(num, 1)); 
x = cumsum(isi); 
<font color="green">%%find the x that is greater than length. </font>
index = find(x &gt; length); 
x = x(1:index(1,1)-1, 1); 
isi = isi(1:index(1,1)-1, 1); 
</pre></p>
<p>The autocorrelation of a Poisson process is, as it should be, flat: </p>
<p><img src="images/763_1.jpg"/></p>
<p>Above: 
<ul> 
<li> Red lines are the autocorrelations estimated from shuffled timestamps (e.g. measure the ISIs - interspike intervals - shuffle these, and take the cumsum to generate a new series of timestamps).  Hence, red lines are a type of control. </li>
<li> Blue lines are the autocorrelations estimated from segments of the full timestamp series.  They are used to how stable the autocorrelation is over the recording</li>
<li> Black line is the actual autocorrelation estimated from the full timestamp series. </li> 
</ul></p>
<p>The problem with my recordings is that there is generally high long-range correlation, correlation which is destroyed by shuffling. </p>
<p><img src="images/763_2.jpg"/></p>
<p>Above is a plot of 1/isi for a noise channel with very high mean 'firing rate' (&gt; 100Hz) in blue.  Behind it, in red, is 1/shuffled isi.  Noise and changes in the experimental setup (bad!) make the channel very non-stationary. </p>
<p><img src="images/763_3.jpg"/></p>
<p>Above is the autocorrelation plotted in the same way as figure 1. Normally, the firing rate is binned at 100Hz and high-pass filtered at 0.005hz so that long-range correlation is removed, but I turned this off for the plot.  Note that the suffled data has a number of different offsets, primarily due to differing long-range correlations / nonstationarities. </p>
<p><img src="images/763_4.jpg"/></p>
<p>Same plot as figure 3, with highpass filtering turned on.  Shuffled data still has far more local correlation - why? </p>
<p>The answer seems to be in the relation between individual isis.  Shuffling isi order obviuosly does not destroy the distribution of isi, but it does destroy the ordering or pair-wise correlation between isi(n) and isi(n+1).  To check this, I plotted these two distributions: </p>
<p><a href="images/763_5.jpg"><img src="images/763_5_thumb_50.jpg"/></a></p>
<p>-- Original log(isi(n)) vs. log(isi(n+1) </p>
<p><a href="images/763_6.jpg"><img src="images/763_6_thumb_50.jpg"/></a></p>
<p>-- Shuffled log(isi_shuf(n)) vs. log(isi_shuf(n+1)</p>
<p><a href="images/763_7.jpg"><img src="images/763_7_thumb_33.jpg"/></a></p>
<p>-- Close-up of log(isi(n)) vs. log(isi(n+1) using alpha-blending for a channel that seems heavily corrupted with electro-cauterizer noise. </p></td></tr>
	</div>
	<div id="762">
	    <div class="head">
		    <tr>
			    <td><i><font size="+1"><font color="orange">{<a href="index.pl?pid=762">762</a>}</font></font></i></td>
				<td>
				<div align="left">
				    <a href="javascript:hide(762,'762')">hide </a>/
				    <a href="javascript:retrievePost(762,0,'762')">edit[0] </a>/
				    <a href="index.pl?pid=762&amp;print=1">print</a>
				</div>
				</td>
			    <td>
			    <div align="left">
			    <font color="gray">type:</font> <a href="index.pl?ptype=work">work</a> 
			    <font color="gray">tags:</font> <a href="index.pl?ptags=covariance">covariance</a> <a href="index.pl?ptags=matrix">matrix</a> <a href="index.pl?ptags=adaptation">adaptation</a> <a href="index.pl?ptags=learning">learning</a> <a href="index.pl?ptags=evolution">evolution</a> <a href="index.pl?ptags=continuous">continuous</a> <a href="index.pl?ptags=function">function</a> <a href="index.pl?ptags=normal">normal</a> <a href="index.pl?ptags=gaussian">gaussian</a> <a href="index.pl?ptags=statistics">statistics</a> 
			    <font color="gray">date:</font> 06-30-2009 15:07 gmt
			    <font color="gray">revision:</font>0
			     <font color="orange"><a href="javascript:displayPost(762,-1,'762');">[head]</a></font>
			    </div>
			</td>
		</tr>
	    </div>
	    <tr><td colspan="3"><p><a href="http://www.lri.fr/~hansen/cmatutorial.pdf">http://www.lri.fr/~hansen/cmatutorial.pdf</a>
<ul> 
<li> Details a method of sampling + covariance matrix approximation to find the extrema of a continuous (but intractable) fitness function</li>
<li> HAs flavors of RLS / Kalman filtering.  Indeed, i think that kalman filtering may be a more principled method for optimization? </li>
<li> Can be used in high-dimensional optimization problems like finding optimal weights for a neural network.  </li>
<li> Optimum-seeking is provided by weighting the stochastic samples (generated ala a particle filter or unscented kalman filter) by their fitness. </li>
<li> Introductory material is quite good, actually... </li> 
</ul></p></td></tr>
	</div>
	<div id="761">
	    <div class="head">
		    <tr>
			    <td><i><font size="+1"><font color="orange">{<a href="index.pl?pid=761">761</a>}</font></font></i></td>
				<td>
				<div align="left">
				    <a href="javascript:hide(761,'761')">hide </a>/
				    <a href="javascript:retrievePost(761,1,'761')">edit[1] </a>/
				    <a href="index.pl?pid=761&amp;print=1">print</a>
				</div>
				</td>
			    <td>
			    <div align="left">
			    <font color="gray">type:</font> <a href="index.pl?ptype=life">life</a> 
			    <font color="gray">tags:</font> <a href="index.pl?ptags=NYTimes">NYTimes</a> <a href="index.pl?ptags=genius">genius</a> <a href="index.pl?ptags=talent">talent</a> <a href="index.pl?ptags=skill">skill</a> <a href="index.pl?ptags=learning">learning</a> 
			    <font color="gray">date:</font> 06-27-2009 18:36 gmt
			    <font color="gray">revision:</font>1
			     <font color="orange">[<a href="javascript:displayPost(761,0,'761');">0</a>] <a href="javascript:displayPost(761,-1,'761');">[head]</a></font>
			    </div>
			</td>
		</tr>
	    </div>
	    <tr><td colspan="3"><p><a href="http://www.nytimes.com/2009/05/01/opinion/01brooks.html?_r=1">http://www.nytimes.com/2009/05/01/opinion/01brooks.html?_r=1</a> -- the 'modern view' of genius. Makes sense to me.
<ul> 
<li> quote: "By practicing in this way, performers delay the automatizing process. The mind wants to turn deliberate, newly learned skills into unconscious, automatically performed skills. But the mind is sloppy and will settle for good enough. By practicing slowly, by breaking skills down into tiny parts and repeating, the strenuous student forces the brain to internalize a better pattern of performance." -- exactly!!</li>
<li> quote: The primary trait she possesses is not some mysterious genius. It’s the ability to develop a deliberate, strenuous and boring practice routine.</li>
<li> It's not who you are, it's what you do.  (law of the cortex: you get good at what you do). </li>
<li> The subconcious / ability to push skills to the subconcious should not be neglected.  Insight apparently is mostly subconcious, and rapid decisions are too - the rational/concious brain is simply <i>too</i> slow and deliberate to form realtime behavior &amp; reactions, but as the above quote highlights, it is also too 'lazy' and accepting to carefully hone a true skill. This requires attention. </li>
<li> From <a href="http://www.guardian.co.uk/commentisfree/2009/may/01/genius-knowledge-iq-tests">the guardian</a> -- "Sometimes an overload of facts is the mark of a dull and pedestrian mind, the antithesis of intelligence."</li>
<ul> 
<li> also: "Intelligence is a matter of <i>output</i>, not scores on a test."  We know genius &amp; talent by it's output.  </li> 
</ul>
</ul></p></td></tr>
	</div>
	<div id="760">
	    <div class="head">
		    <tr>
			    <td><i><font size="+1"><font color="orange">{<a href="index.pl?pid=760">760</a>}</font></font></i></td>
				<td>
				<div align="left">
				    <a href="javascript:hide(760,'760')">hide </a>/
				    <a href="javascript:retrievePost(760,1,'760')">edit[1] </a>/
				    <a href="index.pl?pid=760&amp;print=1">print</a>
				</div>
				</td>
			    <td>
			    <div align="left">
			    <font color="gray">type:</font>  
			    <font color="gray">tags:</font>  
			    <font color="gray">date:</font> 06-27-2009 15:34 gmt
			    <font color="gray">revision:</font>1
			     <font color="orange">[<a href="javascript:displayPost(760,0,'760');">0</a>] <a href="javascript:displayPost(760,-1,'760');">[head]</a></font>
			    </div>
			</td>
		</tr>
	    </div>
	    <tr><td colspan="3"><p>How does LDA (Linear discriminant analysis) work? </p>
<p>It works by projecting data points onto a series of planes, one per class of output, and then deciding based which projection plane is the largest.</p>
<p>Below, to the left is a top-view of this projection with 9 different classes of 2D data each in a different color.  Right is a size 3D view of the projection - note the surfaces seem to form a parabola.  </p>
<p><img src="images/760_1.jpg"/></p>
<p>Here is the matlab code that computes the LDA (from <a href="http://code.google.com/p/myopen/source/browse/trunk/ceven/LDA.M">myopen's ceven</a></p>
<p><pre><font color="green">% TrainData and TrainClass are inputs, column major here.</font>
<font color="green">% (observations on columns)</font>
N = size(TrainData,1);
Ptrain = size(TrainData,2);
Ptest = size(TestData,2);

<font color="green">% add a bit of interpolating noise to the data.</font>
sc = std(TrainData(:)); 
TrainData =  TrainData + sc./1000.*randn(size(TrainData));

K = max(TrainClass); <font color="green">% number of classes.</font>

<font color="green">%%-- Compute the means and the pooled covariance matrix --%%</font>
C = zeros(N,N);
<font color="blue">for</font> l = 1:K;
	idx = find(TrainClass==l);
		<font color="green">% measure the mean per class</font>
	Mi(:,l) = mean(TrainData(:,idx)<font color="red">')'</font>;
		<font color="green">% sum all covariance matrices per class</font>
	C = C + cov((TrainData(:,idx)-Mi(:,l)*ones(1,length(idx)))<font color="red">');
<font color="blue">end</font>

C = C./K; <font color="green">% turn sum into average covariance matrix</font>
Pphi = 1/K;
Cinv = inv(C);

<font color="green">%%-- Compute the LDA weights --%%</font>
<font color="blue">for</font> i = 1:K
	Wg(:,i) = Cinv*Mi(:,i);
		<font color="green">% this is the slope of the plane</font>
	Cg(:,i) = -1/2*Mi(:,i)'</font>*Cinv*Mi(:,i) + log(Pphi)<font color="red">';
		<font color="green">% and this, the origin-intersect.</font>
<font color="blue">end</font>

<font color="green">%%-- Compute the decision functions --%%</font>
Atr = TrainData'</font>*Wg + ones(Ptrain,1)*Cg;
	<font color="green">% see - just a simple linear <font color="blue">function</font>! </font>
Ate = TestData<font color="red">'*Wg + ones(Ptest,1)*Cg;

errtr = 0;
AAtr = compet(Atr'</font>);
	<font color="green">% this compet <font color="blue">function</font> returns a sparse matrix with a 1</font>
	<font color="green">% in the position of the largest element per row. </font>
	<font color="green">% convert to indices with vec2ind, below. </font>
TrainPredict = vec2ind(AAtr);
errtr = errtr + sum(sum(abs(AAtr-ind2vec(TrainClass))))/2;
netr = errtr/Ptrain;
PeTrain = 1-netr;
</pre></p></td></tr>
	</div>
	<div id="759">
	    <div class="head">
		    <tr>
			    <td><i><font size="+1"><font color="orange">{<a href="index.pl?pid=759">759</a>}</font></font></i></td>
				<td>
				<div align="left">
				    <a href="javascript:hide(759,'759')">hide </a>/
				    <a href="javascript:retrievePost(759,3,'759')">edit[3] </a>/
				    <a href="index.pl?pid=759&amp;print=1">print</a>
				</div>
				</td>
			    <td>
			    <div align="left">
			    <font color="gray">type:</font> <a href="index.pl?ptype=work">work</a> 
			    <font color="gray">tags:</font> <a href="index.pl?ptags=yushin">yushin</a> <a href="index.pl?ptags=robot">robot</a> <a href="index.pl?ptags=data">data</a> 
			    <font color="gray">date:</font> 06-25-2009 18:35 gmt
			    <font color="gray">revision:</font>3
			     <font color="orange">[<a href="javascript:displayPost(759,2,'759');">2</a>] [<a href="javascript:displayPost(759,1,'759');">1</a>] [<a href="javascript:displayPost(759,0,'759');">0</a>] <a href="javascript:displayPost(759,-1,'759');">[head]</a></font>
			    </div>
			</td>
		</tr>
	    </div>
	    <tr><td colspan="3"><p><pre>
U141 LMV1032 microSMD-4 -2.23315 -0.03575 180. 9394. 27366. 1675. 
L7 INDUCTOR 0603 -1.7784 -0.7561 0. 13171. 34955. 1727. 
C86 0.1uf 0402 1.0946 -0.0347 360. 37107. 27524. 1710. 
TP8 TP TP 0.222 -1.0285 0. 29815. 37809. 1767. 
TP9 TP TP 0.7021 -1.2484 0. 33805. 40090. 1787. 
C67 1uf 0603 0.8146 -0.7047 270. 34758. 34540. 1752. 
C68 1uf 0603 1.1946 -0.7247 270. 37920. 34730. 1758. 
C69 1uf 0603 1.2747 -0.7247 90. 38576. 34742. 1759. 
R4 33 0402 1.6937 -0.1982 180. 42071. 29215. 1728. 
R17 10k 0402 -1.685 -0.6615 270. 13941. 33981. 1723. 
U92 LMV1032 microSMD-4 -2.53285 -0.03585 180. 6912. 27381. 1671. 
U96 LMV1032 microSMD-4 -2.23315 -0.89075 180. 9364. 36340. 1732. 
TP10 TP TP 0.222 -1.1685 0. 29811. 39233. 1776. 
TP11 TP TP 0.222 -1.3084 0. 29807. 40698. 1786. 
R23 33 0402 0.2834 0.6142 180. 30371. 20682. 1659. 
U105 LMV1032 microSMD-4 -2.23315 -0.71965 180. 9368. 34557. 1720. 
U117 LMV1032 microSMD-4 -2.23315 -0.49165 180. 9366. 32055. 1705. 
U124 LMV1032 microSMD-4 -2.18025 -0.37765 180. 9820. 30853. 1698. 
U127 LMV1032 microSMD-4 -2.18025 -0.32065 180. 9826. 30273. 1695. 
U128 LMV1032 microSMD-4 -2.28685 -0.26365 180. 8940. 29697. 1690. 
R10 50k 0402 -0.9607 -0.3308 180. 19983. 30430. 1709. 
</pre></p>
<p><img src="images/759_1.png"/></p>
<p>more data! 
<pre>
U136 LMV1032 microSMD-4 -2.18025 -0.14965 180. 9860. 28534. 1682. 
R47 20k 0402 1.1822 -1.3883 90. 37828. 41612. 1797. 
R48 20k 0402 0.942 -1.0284 270. 35838. 37757. 1771. 
U139 LMV1032 microSMD-4 -2.18025 -0.09265 180. 9863. 27964. 1678. 
C72 10nf 0603 1.3546 -0.6248 270. 39284. 33694. 1750. 
R45 12.5k 0402 1.1021 -1.3883 90. 37161. 41608. 1796. 
C37 33nF 0402 -1.0956 -0.7067 360. 18894. 34462. 1730. 
R46 12.5k 0402 1.0221 -1.0284 270. 36505. 37759. 1772. 
L7 INDUCTOR 0603 -1.7784 -0.7561 0. 13210. 34933. 1725. 
U142 LMV1032 microSMD-4 -2.18025 -0.03575 180. 9865. 27310. 1674. 
L8 INDUCTOR 0603 0.1745 -0.6447 270. 29446. 33849. 1738. 
C87 0.047uf 0402 -2.3611 -0.8811 360. 8363. 36186. 1729. 
R53 9.2k 0402 1.062 -1.3883 90. 36817. 41587. 1796. 
R36 3.3k 0402 1.9546 -0.8747 270. 44273. 36230. 1772. 
C88 0.047uf 0402 -2.361 -0.8241 360. 8356. 35593. 1725. 
R54 9.2k 0402 1.062 -1.0284 270. 36838. 37762. 1772. 
R38 3.3k 0603 0.8646 -0.8147 360. 35200. 35636. 1757. 
R37 3.3k 0402 1.9546 -1.1347 270. 44266. 38878. 1788. 
TP1 TP TP 1.302 -1.3882 0. 38828. 41596. 1797. 
C89 0.047uf 0402 -2.361 -0.7671 360. 8358. 35023. 1721. 
C83 0.1uf 0402 1.2246 -0.5147 0. 38206. 32492. 1741. 
C12 1uf 0402 0.8182 0.1876 270. 34842. 25228. 1692. 
R39 3.3k 0402 1.5146 -0.8747 90. 40609. 36213. 1767. 
TP3 TP TP 1.302 -1.2484 0. 38835. 40039. 1788. 
C85 0.1uf 0402 0.2946 -0.0348 180. 30497. 27541. 1701. 
C29 0.01uf 0402 -1.5749 -0.1575 270. 14907. 28634. 1690. 
TP4 TP TP 0.8219 -1.1684 0. 34852. 39172. 1778. 
C15 1uf 0402 1.6037 0.0518 270. 41377. 26681. 1709. 
TP5 TP TP 0.8219 -1.3084 0. 34835. 40731. 1787. 
C86 0.1uf 0402 1.0946 -0.0347 360. 37136. 27478. 1709. 
TP6 TP TP 1.3021 -1.1085 0. 38832. 38563. 1779. 
TP7 TP TP 0.7021 -1.3883 0. 33824. 41561. 1791. 
TP8 TP TP 0.222 -1.0285 0. 29855. 37751. 1763. 
C19 1uf 0402 -0.6901 -0.0599 90. 22286. 27662. 1693. 
TP9 TP TP 0.7021 -1.2484 0. 33830. 40042. 1782. 
C90 0.047uf 0402 -2.361 -0.7101 360. 8360. 34449. 1718. 
R40 3.3k 0402 1.5146 -1.1347 90. 40602. 38842. 1784. 
C28 7pf 0402 -1.0306 -0.562 270. 19447. 32944. 1722. 
C36 0.01uf 0402 -1.1968 0.0315 0. 18064. 26795. 1682. 
C67 1uf 0603 0.8146 -0.7047 270. 34787. 34503. 1750. 
R13 25 0402 -1.57 -0.34 0. 14940. 30478. 1701. 
C68 1uf 0603 1.1946 -0.7247 270. 37950. 34725. 1755. 
C38 0.01uf 0402 -0.9763 -0.1733 270. 19894. 28829. 1697. 
R14 25 0402 -1.5749 -0.4094 270. 14897. 31177. 1705. 
C69 1uf 0603 1.2747 -0.7247 90. 38616. 34707. 1755. 
R16 25 0402 -1.1956 -0.8867 180. 18053. 36282. 1739. 
R1 33 0402 1.4961 0.0314 90. 40482. 26822. 1709. 
R5 220k 0402 -0.5628 -0.1852 90. 23338. 28986. 1701. 
R3 33 0402 1.6937 -0.1282 180. 42120. 28451. 1721. 
R4 33 0402 1.6937 -0.1982 180. 42116. 29193. 1725. 
R28 2.2k 0402 1.9346 -1.4048 90. 44069. 41754. 1804. 
R29 2.2k 0402 1.8346 -1.4047 90. 43249. 41818. 1804. 
C70 1uf 0603 1.2747 -0.6246 270. 38619. 33709. 1749. 
R2 100k 0402 1.4173 0.0315 90. 39826. 26815. 1708. 
C42 0.01uf 0402 -1.1955 -0.7166 180. 18052. 34552. 1730. 
R43 3k 0402 1.242 -1.3085 270. 38319. 40701. 1792. 
C73 1uf 0603 1.8646 -0.7147 0. 43527. 34646. 1761. 
R44 3k 0402 0.882 -1.1085 90. 35337. 38556. 1776. 
R49 33k 0402 1.202 -1.2285 270. 37988. 39816. 1787. 
C77 1uf 0603 0.7446 -0.9347 0. 34197. 36870. 1764. 
C32 1uf 0402 -0.8976 -0.6615 180. 20551. 34005. 1729. 
C79 1uf 0603 0.8646 -0.8747 180. 35198. 36251. 1761. 
R30 2.2k 0402 1.7347 -1.4047 90. 42427. 41804. 1803. 
C35 1uf 0402 -1.2913 0.0315 180. 17298. 26781. 1681. 
R31 2.2k 0402 1.6346 -1.4047 90. 41584. 41800. 1802. 
R50 33k 0402 0.9345 -1.1548 90. 35772. 39028. 1779. 
R11 10k 0402 -0.0001 0.126 90. 28025. 25843. 1690. 
C46 1uf 0402 -1.1955 -0.6766 180. 18053. 34138. 1727. 
R12 10k 0402 0.0001 0.5196 90. 28038. 21612. 1662. 
R9 10k 0402 0.0001 0.2835 270. 28031. 24093. 1677. 
R17 10k 0402 -1.685 -0.6615 270. 13974. 33945. 1741. 
R18 10k 0402 -1.5998 -0.4875 90. 14688. 32018. 1710. 
C14 0.001uf 0402 -0.96 -0.26 0. 20044. 29712. 1703. 
U92 LMV1032 microSMD-4 -2.53285 -0.03585 180. 6926. 27289. 1670. 
R55 6.5k 0402 0.9821 -1.3883 90. 36150. 41583. 1795. 
R56 6.5k 0402 1.142 -1.0284 270. 37502. 37773. 1774. 
R19 22K 0402 -0.9958 -0.6867 90. 19712. 34257. 1729. 
C2 0.1uf 0402 1.6237 -0.2581 270. 41530. 29787. 1728. 
C30 5pf 0402 -1.1907 -0.562 90. 18114. 32929. 1720. 
C25 0.001uf 0402 0.2835 0.0787 180. 30398. 26352. 1694. 
C20 33pf 0402 -0.5628 -0.3352 90. 23328. 30458. 1712. 
C13 8pf 0402 1.6877 -0.4299 270. 42062. 31517. 1741. 
C27 0.001uf 0402 -0.9763 -0.5039 90. 19900. 32258. 1718. 
C17 8pf 0402 1.4476 -0.4299 90. 40063. 31519. 1738. 
C71 0.1uf 0603 1.3545 -0.7247 90. 39280. 34701. 1756. 
C49 2.2uf 0402 -2.2324 -0.9436 0. 9413. 36840. 1734. 
C50 2.2uf 0402 -2.4802 -0.9455 0. 7350. 36852. 1732. 
C51 2.2uf 0402 -2.4779 0.0152 0. 7399. 26905. 1670. 
C52 2.2uf 0402 -2.2347 0.0184 0. 9423. 26881. 1672. 
C40 0.001uf 0402 -1.1956 -0.7568 180. 18050. 34938. 1732. 
C53 2.2uf 0402 -1.9398 -0.7554 0. 11855. 34916. 1725. 
C54 2.2uf 0402 -1.6317 -0.315 270. 14433. 30225. 1700. 
C48 2.2nF 0402 -0.9154 -0.9464 90. 20377. 36919. 1747. 
C55 2.2uf 0402 -1.8616 -0.7549 180. 12506. 34903. 1726. 
C56 0.012uf 0402 -1.7107 -0.7353 270. 13762. 34716. 1726. 
C57 0.012uf 0402 -1.6956 -0.8478 90. 13875. 35886. 1733. 
R7 90k 0402 -0.8225 -0.266 90. 21176. 29782. 1704. 
C58 0.012uf 0402 -1.8891 -0.8466 90. 12274. 35834. 1731. 
R57 22k 0402 0.942 -1.3883 90. 35826. 41602. 1795. 
TP10 TP TP 0.222 -1.1685 0. 29847. 39154. 1772. 
C22 10uf 0603 -0.6428 -0.1653 360. 22687. 28750. 1700. 
TP11 TP TP 0.222 -1.3084 0. 29820. 40682. 1781. 
C23 10uf 0603 -0.7429 -0.1652 180. 21854. 28745. 1699. 
TP12 TP TP 0.7022 -1.1085 0. 33848. 38556. 1773. 
C61 2.2uf 0402 -1.8422 -0.8468 90. 12664. 35859. 1732. 
C62 2.2uf 0402 -2.0357 -0.8464 90. 11053. 35837. 1730. 
C63 2.2uf 0402 -2.0001 -0.0836 270. 11363. 27899. 1681. 
C64 2.2uf 0402 -2.0025 -0.1862 90. 11350. 28924. 1688. 
C44 1.5pF 0402 -0.8357 -0.8065 180. 21045. 35478. 1739. 
C65 0.012uf 0402 -1.8247 -0.9119 0. 12808. 36505. 1736. 
C66 0.012uf 0402 -2.0181 -0.913 0. 11198. 36540. 1734. 
C39 0.1uf 0402 -1.3229 -0.6772 180. 16993. 34136. 1726. 
R6 825k 0402 -0.5628 -0.2651 90. 23329. 29784. 1706. 
C41 0.1uf 0402 -1.1023 0.0314 180. 18851. 26789. 1683. 
C45 0.1uf 0402 -0.9763 -0.0787 90. 19897. 27845. 1691. 
R34 327k 0402 1.9046 -0.8747 270. 43856. 36228. 1771. 
R35 327k 0402 1.9046 -1.1347 90. 43849. 38858. 1788. 
R51 47k 0402 1.202 -1.3085 270. 37985. 40700. 1792. 
R52 47k 0402 0.9221 -1.1083 90. 35661. 38566. 1776. 
C74 4.7uf 0603 1.9346 -1.0047 360. 44101. 37581. 1780. 
C75 4.7uf 0603 1.9346 -0.9447 360. 44103. 36957. 1776. 
C76 4.7uf 0603 1.9346 -1.0648 180. 44099. 38174. 1784. 
R41 327k 0402 1.5646 -0.8747 90. 41026. 36215. 1768. 
C78 4.7uf 0603 1.7346 -0.7947 0. 42442. 35463. 1765. 
R42 327k 0402 1.5645 -1.1347 270. 41018. 38856. 1784. 
C59 0.1uf 0402 -1.8046 -0.2246 270. 12986. 29320. 1692. 
U124 LMV1032 microSMD-4 -2.18025 -0.37765 180. 9843. 30773. 1696. 
U127 LMV1032 microSMD-4 -2.18025 -0.32065 180. 9845. 30296. 1692. 
C80 4.7uf 0603 1.5346 -0.9447 360. 40773. 36984. 1772. 
C81 4.7uf 0603 1.5346 -1.0648 180. 40769. 38149. 1780. 
R10 50k 0402 -0.9607 -0.3308 180. 20034. 30408. 1706. 
C82 4.7uf 0603 1.5346 -1.0047 360. 40771. 37546. 1776. 
C84 4.7uf 0603 0.1746 -0.5347 270. 29464. 32629. 1732. 
C60 0.1uf 0402 -1.8032 -0.0862 270. 13012. 27892. 1683. 
R15 50k 0402 -1.1956 -0.7967 180. 18055. 35380. 1734. 
U130 LMV1032 microSMD-4 -2.18025 -0.26365 180. 9857. 29685. 1689. 
2.9mm_hole VAL** 2.9mm_hole -2.325 0.2 0. 8698. 24995. 1658. 
U133 LMV1032 microSMD-4 -2.18025 -0.20665 180. 9849. 29114. 1685. 
C47 1pF 0402 -0.8158 -0.7565 90. 21212. 34950. 1736. 

</pre>
counts spaced at exactly 1mm: 
<pre>
0 -13206.000000
1 -12795.000000
2 -12349.000000
3 -11983.000000
4 -11545.000000
5 -11117.000000
6 -10710.000000
7 -10262.000000
8 -9813.000000
9 -9395.000000
10 -8957.000000
11 -8561.000000
12 -8154.000000
13 -7726.000000
14 -7298.000000
15 -6897.000000
16 -6477.000000
17 -6093.000000
18 -5700.000000
19 -5309.000000
20 -4871.000000
21 -4453.000000
22 -4046.000000
23 -3639.000000
24 -3232.000000
25 -2836.000000
26 -2429.000000
27 -2011.000000
28 -1594.000000
29 -1187.000000
30 -780.000000
31 -352.000000
32 65.000000
33 472.000000
34 900.000000
35 1318.000000
36 1708.000000
37 2104.000000
38 2490.000000
39 2908.000000
40 3325.000000
</pre></p></td></tr>
	</div>
	<div id="758">
	    <div class="head">
		    <tr>
			    <td><i><font size="+1"><font color="orange">{<a href="index.pl?pid=758">758</a>}</font></font></i></td>
				<td>
				<div align="left">
				    <a href="javascript:hide(758,'758')">hide </a>/
				    <a href="javascript:retrievePost(758,1,'758')">edit[1] </a>/
				    <a href="index.pl?pid=758&amp;print=1">print</a>
				</div>
				</td>
			    <td>
			    <div align="left">
			    <font color="gray">type:</font> <a href="index.pl?ptype=work">work</a> 
			    <font color="gray">tags:</font> <a href="index.pl?ptags=ocaml">ocaml</a> <a href="index.pl?ptags=toplevel">toplevel</a> <a href="index.pl?ptags=ocamlfind">ocamlfind</a> 
			    <font color="gray">date:</font> 06-24-2009 14:52 gmt
			    <font color="gray">revision:</font>1
			     <font color="orange">[<a href="javascript:displayPost(758,0,'758');">0</a>] <a href="javascript:displayPost(758,-1,'758');">[head]</a></font>
			    </div>
			</td>
		</tr>
	    </div>
	    <tr><td colspan="3"><p>Ocaml has an interactive top level, but in order to make this useful (e.g. for inspecting the types of variables, trying out code before compiling it), you need to import libraries and modules.  If you have ocamlfind on your system (I think this is the requirement..), do this with: <b>#use "topfind";;</b> at the ocaml prompt, then <b>#require"<i>package names</i>" </b>.  e.g:</p>
<p><pre>
tlh24@chimera:~/svn/m8ta/yushin$ ledit | ocaml
        Objective Caml version 3.10.2

# #use "topfind";;
- : unit = ()
Findlib has been successfully loaded. Additional directives:
  #require "package";;      to load a package
  #list;;                   to list the available packages
  #camlp4o;;                to load camlp4 (standard syntax)
  #camlp4r;;                to load camlp4 (revised syntax)
  #predicates "p,q,...";;   to set these predicates
  Topfind.reset();;         to force that packages will be reloaded
  #thread;;                 to enable threads

- : unit = ()
# #require "bigarray,gsl";;
/usr/lib/ocaml/3.10.2/bigarray.cma: loaded
/usr/lib/ocaml/3.10.2/gsl: added to search path
/usr/lib/ocaml/3.10.2/gsl/gsl.cma: loaded
# #require "pcre,unix,str";;
/usr/lib/ocaml/3.10.2/pcre: added to search path
/usr/lib/ocaml/3.10.2/pcre/pcre.cma: loaded
/usr/lib/ocaml/3.10.2/unix.cma: loaded
/usr/lib/ocaml/3.10.2/str.cma: loaded
# Pcre.pmatch
  ;;
- : ?iflags:Pcre.irflag -&gt;
    ?flags:Pcre.rflag list -&gt;
    ?rex:Pcre.regexp -&gt;
    ?pat:string -&gt; ?pos:int -&gt; ?callout:Pcre.callout -&gt; string -&gt; bool
= &lt;fun&gt;
# let m = Gsl_matrix.create 3 3;;
val m : Gsl_matrix.matrix = &lt;abstr&gt;
# m;;
- : Gsl_matrix.matrix = &lt;abstr&gt;
# m.{1,1};;
- : float = 6.94305623882282e-310
# m.{0,0};;
- : float = 6.94305568087725e-310
# m.{1,1} &lt;- 1.0 ;;
- : unit = ()
# m.{2,2} &lt;- 2.0 ;;
- : unit = ()
# let mstr = Marshal.to_string m [] ;;
</pre></p>
<p>Nice!</p></td></tr>
	</div>
	<div id="757">
	    <div class="head">
		    <tr>
			    <td><i><font size="+1"><font color="orange">{<a href="index.pl?pid=757">757</a>}</font></font></i></td>
				<td>
				<div align="left">
				    <a href="javascript:hide(757,'757')">hide </a>/
				    <a href="javascript:retrievePost(757,1,'757')">edit[1] </a>/
				    <a href="index.pl?pid=757&amp;print=1">print</a>
				</div>
				</td>
			    <td>
			    <div align="left">
			    <font color="gray">type:</font> <a href="index.pl?ptype=life">life</a> 
			    <font color="gray">tags:</font> <a href="index.pl?ptags=perl">perl</a> <a href="index.pl?ptags=disaser">disaser</a> <a href="index.pl?ptags=films">films</a> <a href="index.pl?ptags=vs">vs</a> <a href="index.pl?ptags=time">time</a> 
			    <font color="gray">date:</font> 06-15-2009 23:02 gmt
			    <font color="gray">revision:</font>1
			     <font color="orange">[<a href="javascript:displayPost(757,0,'757');">0</a>] <a href="javascript:displayPost(757,-1,'757');">[head]</a></font>
			    </div>
			</td>
		</tr>
	    </div>
	    <tr><td colspan="3"><p>My friend Joey recently showed me the trailer to "The Road", and I banefully observed that it was "yet another disaster film".  This made me wonder if the number of disaster films is increasing with time - a question that was easily answered with the help of perl, matlab, and <a href="http://en.wikipedia.org/wiki/List_of_disaster_films">Wikipedia's list of disaster films</a>. </p>
<p>First, I saved the page, then converted the list of dates contained therein into a matlab-formatted string with the following quick-n-dirty script: </p>
<p><pre><font color="purple">$source</font> = <font color="purple">$ARGV</font>[0]; 
<font color="blue">open</font>(FH, <font color="red">"&lt; <font color="purple">$source</font>"</font>); 
@j = &lt;FH&gt;; <font color="green">#slurp the entire file into one string. </font>
<font color="blue">print</font> <font color="red">"dates = ["</font>; 
<font color="purple">$first</font> = 1; 
<font color="blue">foreach</font> <font color="purple">$l</font> (@j){
	<font color="blue">while</font> (<font color="purple">$l</font> =~ /&#92;((&#92;d{4})&#92;)/gs ){
		<font color="blue">if</font>(<font color="blue">not</font> <font color="purple">$first</font>){
			<font color="blue">print</font> <font color="red">","</font>; 
		}
		<font color="blue">print</font> <font color="purple">$1</font> ; 
		<font color="purple">$first</font> = 0; 
	}
}
<font color="blue">close</font> FH; 
<font color="blue">print</font> <font color="red">"]; &#92;n"</font>; 
</pre></p>
<p>then plotted it in matlab: </p>
<p><pre>hist(dates, 20) <font color="green">%average over 5-year periods</font>
</pre></p>
<p>yielding: </p>
<p><img src="images/757_1.png"/></p>
<p>thereby validating my expectations that the number of disaster films has increased with time!  (Note i did not say the <i>percentage</i> of total films - that might be constant :-)</p></td></tr>
	</div>
	<div id="756">
	    <div class="head">
		    <tr>
			    <td><i><font size="+1"><font color="orange">{<a href="index.pl?pid=756">756</a>}</font></font></i></td>
				<td>
				<div align="left">
				    <a href="javascript:hide(756,'756')">hide </a>/
				    <a href="javascript:retrievePost(756,0,'756')">edit[0] </a>/
				    <a href="index.pl?pid=756&amp;print=1">print</a>
				</div>
				</td>
			    <td>
			    <div align="left">
			    <font color="gray">type:</font> <a href="index.pl?ptype=life">life</a> 
			    <font color="gray">tags:</font> <a href="index.pl?ptags=education">education</a> <a href="index.pl?ptags=wikinomics">wikinomics</a> <a href="index.pl?ptags=internet">internet</a> <a href="index.pl?ptags=age">age</a> <a href="index.pl?ptags=college">college</a> <a href="index.pl?ptags=university">university</a> <a href="index.pl?ptags=pedagogy">pedagogy</a> 
			    <font color="gray">date:</font> 06-11-2009 12:52 gmt
			    <font color="gray">revision:</font>0
			     <font color="orange"><a href="javascript:displayPost(756,-1,'756');">[head]</a></font>
			    </div>
			</td>
		</tr>
	    </div>
	    <tr><td colspan="3"><p><a href="http://www.wikinomics.com/blog/index.php/2009/06/10/will-universities-stay-relevant/">Will universities stay relevant?</a> and the rest of the <a href="http://www.wikinomics.com/blog/">wikinomics blog</a>
<ul> 
<li> Idea: for universities to remain relevant, they will have to change their teaching styles to match the impatient and interactive internet-raised generation. </li>
<li> Notable quotes: </li>
<ul> 
<li> [College students today] want to learn, but they want to learn only from what they have to learn, and they want to learn it in a style that is best for them.</li>
<li> In the old model, teachers taught and students were expected to absorb vast quantities of content. Education was about absorbing content and being able to recall it on exams. You graduated and you were set for life - just “keeping” up in your chosen field. Today when you graduate you’re set for say, <i>15 minutes.</i> (heheh)</li> 
</ul>
<li> What matters now is a student's capacity for learning.  Hence colleges should teach meta-learning: learning how to learn.</li>
<li> My opinion: Universities will not die, they are too useful given the collaborative nature of human learning: they bring many different people together for the purpose of learning (and perhaps doing  research).  This is essential, not just for professional learning, but for life-learning (learning  from other's experience so you don't have to experience it).  Sure, people can learn by consulting google or wikipedia, but it's not nearly as good as face-to-face lectures (where you can ask questions!) or office hours, because the teacher there has some idea what is going on in the student's mind as he/she learns, and can anticipate  questions and give relevant guidance based on experience.  Google and Wikipedia, for now, cannot do this as well as a good, thoughtful teacher or friend. </li> 
</ul></p></td></tr>
	</div>
	<div id="755">
	    <div class="head">
		    <tr>
			    <td><i><font size="+1"><font color="orange">{<a href="index.pl?pid=755">755</a>}</font></font></i></td>
				<td>
				<div align="left">
				    <a href="javascript:hide(755,'755')">hide </a>/
				    <a href="javascript:retrievePost(755,1,'755')">edit[1] </a>/
				    <a href="index.pl?pid=755&amp;print=1">print</a>
				</div>
				</td>
			    <td>
			    <div align="left">
			    <font color="gray">type:</font>  
			    <font color="gray">tags:</font> <a href="index.pl?ptags=cost">cost</a> <a href="index.pl?ptags=of">of</a> <a href="index.pl?ptags=energy">energy</a> <a href="index.pl?ptags=renewable">renewable</a> 
			    <font color="gray">date:</font> 06-11-2009 12:33 gmt
			    <font color="gray">revision:</font>1
			     <font color="orange">[<a href="javascript:displayPost(755,0,'755');">0</a>] <a href="javascript:displayPost(755,-1,'755');">[head]</a></font>
			    </div>
			</td>
		</tr>
	    </div>
	    <tr><td colspan="3"><p>Gleaned from the Economist (June 6-12 2009)
 
"
<table class="user">
<tr><td>technology</td><td>price/kWh</td></tr>
<tr><td>photovoltaic cells</td><td>$0.56</td></tr>
<tr><td>wind</td><td>$0.10</td></tr>
<tr><td>biomass</td><td>$0.12</td></tr>
<tr><td>coal</td><td>$0.07</td></tr>
<tr><td>natural gas</td><td>$0.08</td></tr>
</table>
</p>
<p>Italy imports 86% of it's electricity (!)</p></td></tr>
	</div>
</table></body></html>
