<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Here Be Snarks</title>
	<atom:link href="http://snarktales.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://snarktales.wordpress.com</link>
	<description>Nothing here is meant to be read more than twice.</description>
	<lastBuildDate>Sun, 06 Dec 2009 22:32:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='snarktales.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Here Be Snarks</title>
		<link>http://snarktales.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://snarktales.wordpress.com/osd.xml" title="Here Be Snarks" />
	<atom:link rel='hub' href='http://snarktales.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Sum of Uniform random variables</title>
		<link>http://snarktales.wordpress.com/2009/12/05/sum-of-uniform-random-variables/</link>
		<comments>http://snarktales.wordpress.com/2009/12/05/sum-of-uniform-random-variables/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 22:57:11 +0000</pubDate>
		<dc:creator>snarktales</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://snarktales.wordpress.com/?p=5</guid>
		<description><![CDATA[This is an interesting problem that has long been a favorite of mine for its surprising solution. Problem: Let be a positive real. Let be i.i.d random variables uniformly distributed between and . Define the random variable as . In plain English, is the minimum number of uniform random variables one needs to add for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=snarktales.wordpress.com&amp;blog=3601608&amp;post=5&amp;subd=snarktales&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is an interesting problem that has long been a favorite of mine for its surprising solution.</p>
<p>Problem: Let <img src='http://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' /> be a positive real. Let <img src='http://s0.wp.com/latex.php?latex=U_i%2C+i+%3D+1%2C2%2C%5Cdots&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='U_i, i = 1,2,&#92;dots' title='U_i, i = 1,2,&#92;dots' class='latex' /> be i.i.d random variables uniformly distributed between <img src='http://s0.wp.com/latex.php?latex=0&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='0' title='0' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='1' title='1' class='latex' />. Define the random variable <img src='http://s0.wp.com/latex.php?latex=N&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='N' title='N' class='latex' /> as <img src='http://s0.wp.com/latex.php?latex=N%28x%29+%5Ctriangleq+%5C%7B+%5Cmin+n+%5Ccolon+%5Csum_%7Bi%3D1%7D%5E%7Bn%7D+U_i+%3E+x+%5C%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='N(x) &#92;triangleq &#92;{ &#92;min n &#92;colon &#92;sum_{i=1}^{n} U_i &gt; x &#92;}' title='N(x) &#92;triangleq &#92;{ &#92;min n &#92;colon &#92;sum_{i=1}^{n} U_i &gt; x &#92;}' class='latex' />. In plain English, <img src='http://s0.wp.com/latex.php?latex=N&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='N' title='N' class='latex' /> is the minimum number of uniform random variables one needs to add for the sum to exceed <img src='http://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' />. Find the expected value of <img src='http://s0.wp.com/latex.php?latex=N%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='N(x)' title='N(x)' class='latex' />.</p>
<p>The more famous version of this problem merely asks you to find the expectation of <img src='http://s0.wp.com/latex.php?latex=N%281%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='N(1)' title='N(1)' class='latex' />. However, a slight extension of the approach can give the answer for a general <img src='http://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' />. We shall tackle this problem using recursive expectation which is a fairly natural line of attack for these kinds of problems. Before proceeding further, let me note that it is also possible to find this expectation by actually computing the pmf of <img src='http://s0.wp.com/latex.php?latex=N%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='N(x)' title='N(x)' class='latex' /> (at least when <img src='http://s0.wp.com/latex.php?latex=0+%3C+x+%3C+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='0 &lt; x &lt; 1' title='0 &lt; x &lt; 1' class='latex' />. I don&#8217;t know it if the pmf is easy to compute for <img src='http://s0.wp.com/latex.php?latex=x+%3E+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x &gt; 1' title='x &gt; 1' class='latex' />).</p>
<p>Lets start by defining <img src='http://s0.wp.com/latex.php?latex=f%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x)' title='f(x)' class='latex' /> to be the expected value of <img src='http://s0.wp.com/latex.php?latex=N%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='N(x)' title='N(x)' class='latex' />. For reasons that will become obvious shortly, lets for now restrict x to lie between <img src='http://s0.wp.com/latex.php?latex=0&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='0' title='0' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='1' title='1' class='latex' />. A recursion can be derived for <img src='http://s0.wp.com/latex.php?latex=f%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x)' title='f(x)' class='latex' /> by conditioning on the value of the first random variable <img src='http://s0.wp.com/latex.php?latex=U_1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='U_1' title='U_1' class='latex' />.</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+%5Cint_%7B0%7D%5E%7B1%7D+%5Cmathbb%7BE%7D%28N%28x%29+%7C+U_1+%3D+a%29+da&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) = &#92;int_{0}^{1} &#92;mathbb{E}(N(x) | U_1 = a) da' title='f(x) = &#92;int_{0}^{1} &#92;mathbb{E}(N(x) | U_1 = a) da' class='latex' /></p>
<p style="text-align:left;">This integral naturally splits into two as</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+%5Cint_%7B0%7D%5E%7Bx%7D+%5Cmathbb%7BE%7D%28N%28x%29+%7C+U_1+%3D+a%29+da+%2B+%5Cint_%7Bx%7D%5E%7B1%7D+%5Cmathbb%7BE%7D%28N%28x%29+%7C+U_1+%3D+a%29+da&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) = &#92;int_{0}^{x} &#92;mathbb{E}(N(x) | U_1 = a) da + &#92;int_{x}^{1} &#92;mathbb{E}(N(x) | U_1 = a) da' title='f(x) = &#92;int_{0}^{x} &#92;mathbb{E}(N(x) | U_1 = a) da + &#92;int_{x}^{1} &#92;mathbb{E}(N(x) | U_1 = a) da' class='latex' /></p>
<p style="text-align:left;">If the value of <img src='http://s0.wp.com/latex.php?latex=U_1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='U_1' title='U_1' class='latex' /> is greater than <img src='http://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' /> (as is the case in the second integral), the sum has already exceeded <img src='http://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' /> which implies that <img src='http://s0.wp.com/latex.php?latex=%5Cmathbb%7BE%7D%28N%28x%29+%7C+U_1+%3D+a%29+%3D+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathbb{E}(N(x) | U_1 = a) = 1' title='&#92;mathbb{E}(N(x) | U_1 = a) = 1' class='latex' /> in this case. If <img src='http://s0.wp.com/latex.php?latex=U_1+%3C+x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='U_1 &lt; x' title='U_1 &lt; x' class='latex' />, we get <img src='http://s0.wp.com/latex.php?latex=%5Cmathbb%7BE%7D%28N%28x%29+%7C+U_1+%3D+a%29+%3D+1+%2B+f%28x-a%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathbb{E}(N(x) | U_1 = a) = 1 + f(x-a)' title='&#92;mathbb{E}(N(x) | U_1 = a) = 1 + f(x-a)' class='latex' />. This is the crucial step where recursion steps in. Substituting these back into the expression for <img src='http://s0.wp.com/latex.php?latex=f%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x)' title='f(x)' class='latex' /> above, we get</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+1+%2B+%5Cint_%7Bo%7D%5E%7Bx%7D+f%28x-a%29+da&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) = 1 + &#92;int_{o}^{x} f(x-a) da' title='f(x) = 1 + &#92;int_{o}^{x} f(x-a) da' class='latex' /></p>
<p style="text-align:left;">which is the same as</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+1+%2B+%5Cint_%7Bo%7D%5E%7Bx%7D+f%28a%29+da&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) = 1 + &#92;int_{o}^{x} f(a) da' title='f(x) = 1 + &#92;int_{o}^{x} f(a) da' class='latex' /></p>
<p style="text-align:left;">This integral equation can be solved by converting it into a differential equation. Differentiating yields,</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7Bd%7D%7Bdx%7D+f%28x%29+%3D+f%28x%29+%5Cquad+for+%5C%2C+0+%5Cleq+x+%3C+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;frac{d}{dx} f(x) = f(x) &#92;quad for &#92;, 0 &#92;leq x &lt; 1' title='&#92;frac{d}{dx} f(x) = f(x) &#92;quad for &#92;, 0 &#92;leq x &lt; 1' class='latex' /></p>
<p>The solution in the familiar exponential function <img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+C+e%5Ex&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) = C e^x' title='f(x) = C e^x' class='latex' />. It is easy to see that as <img src='http://s0.wp.com/latex.php?latex=x+%5Crightarrow+0&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x &#92;rightarrow 0' title='x &#92;rightarrow 0' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=f%28x%29+%5Crightarrow+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) &#92;rightarrow 1' title='f(x) &#92;rightarrow 1' class='latex' /> which implies that the constant of integration must be <img src='http://s0.wp.com/latex.php?latex=1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='1' title='1' class='latex' />. Therefore, we get that <img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+e%5Ex&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) = e^x' title='f(x) = e^x' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=0+%5Cleq+x+%3C+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='0 &#92;leq x &lt; 1' title='0 &#92;leq x &lt; 1' class='latex' />. Therefore, the expected number of uniform random variables one needs to add to cross a threshold of unity is simply <img src='http://s0.wp.com/latex.php?latex=e&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='e' title='e' class='latex' />!!!</p>
<p>Take a moment to reflect how cool this result is. Uniform random variables are everywhere around us and by simply adding them up till they cross a threshold, we can estimate one of the fundamental constants of all mathematics. This is similar to the Buffon&#8217;s needle problem which one can use to estimate <img src='http://s0.wp.com/latex.php?latex=%5Cpi&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;pi' title='&#92;pi' class='latex' /> by simply throwing a needle onto a ruled sheet. It comes with a caveat though: The variance of <img src='http://s0.wp.com/latex.php?latex=N%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='N(x)' title='N(x)' class='latex' /> is quite high (<img src='http://s0.wp.com/latex.php?latex=%5Capprox+0.8&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;approx 0.8' title='&#92;approx 0.8' class='latex' />) which means that, just as in the Buffon&#8217;s needle problem, this is a highly inefficient way of estimating the underlying constant.</p>
<p>Let us forge on and try to compute <img src='http://s0.wp.com/latex.php?latex=f%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x)' title='f(x)' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=x+%3E+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x &gt; 1' title='x &gt; 1' class='latex' />. A similar recursive equation can be derived by conditioning on <img src='http://s0.wp.com/latex.php?latex=U_1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='U_1' title='U_1' class='latex' /> as</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+%5Cint_%7B0%7D%5E%7B1%7D+%5Cmathbb%7BE%7D%28N%28x%29+%7C+U_1+%3D+a%29+da&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) = &#92;int_{0}^{1} &#92;mathbb{E}(N(x) | U_1 = a) da' title='f(x) = &#92;int_{0}^{1} &#92;mathbb{E}(N(x) | U_1 = a) da' class='latex' /></p>
<p>However, the difference is that when <img src='http://s0.wp.com/latex.php?latex=x+%3E+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x &gt; 1' title='x &gt; 1' class='latex' />, the integral doesn&#8217;t split into two parts like it did in the case when <img src='http://s0.wp.com/latex.php?latex=x+%5Cleq+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x &#92;leq 1' title='x &#92;leq 1' class='latex' />. Instead the only possible simplification is by replacing <img src='http://s0.wp.com/latex.php?latex=%5Cmathbb%7BE%7D%28N%28x%29+%7C+U_1+%3D+a%29+&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;mathbb{E}(N(x) | U_1 = a) ' title='&#92;mathbb{E}(N(x) | U_1 = a) ' class='latex' /> by <img src='http://s0.wp.com/latex.php?latex=1%2Bf%28x-a%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='1+f(x-a)' title='1+f(x-a)' class='latex' /> as before and changing the variable of integration. This gives</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+1+%2B+%5Cint_%7Bx-1%7D%5E%7Bx%7D+f%28a%29+da&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) = 1 + &#92;int_{x-1}^{x} f(a) da' title='f(x) = 1 + &#92;int_{x-1}^{x} f(a) da' class='latex' /></p>
<p>Differentiating with respect to <img src='http://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' /> gives the differential equation</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7Bd%7D%7Bdx%7D+f%28x%29+%3D+f%28x%29+-+f%28x-1%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;frac{d}{dx} f(x) = f(x) - f(x-1)' title='&#92;frac{d}{dx} f(x) = f(x) - f(x-1)' class='latex' /></p>
<p>I don&#8217;t know if there is a easy way to solve this equation but I tackled it in the following manner. We already know the form of <img src='http://s0.wp.com/latex.php?latex=f%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x)' title='f(x)' class='latex' /> when <img src='http://s0.wp.com/latex.php?latex=0+%5Cleq+x+%3C+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='0 &#92;leq x &lt; 1' title='0 &#92;leq x &lt; 1' class='latex' />. So, when <img src='http://s0.wp.com/latex.php?latex=1+%5Cleq+x+%3C+2&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='1 &#92;leq x &lt; 2' title='1 &#92;leq x &lt; 2' class='latex' />, the above equation can be converted to a familiar linear first order differential equation by substituting <img src='http://s0.wp.com/latex.php?latex=f%28x-1%29+%3D+e%5E%7B%28x-1%29%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x-1) = e^{(x-1)}' title='f(x-1) = e^{(x-1)}' class='latex' />. This results in the differential equation</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7Bd%7D%7Bdx%7D+f%28x%29+%3D+f%28x%29+-+e%5E%7Bx-1%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;frac{d}{dx} f(x) = f(x) - e^{x-1}' title='&#92;frac{d}{dx} f(x) = f(x) - e^{x-1}' class='latex' /> when <img src='http://s0.wp.com/latex.php?latex=1+%5Cleq+x+%3C+2&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='1 &#92;leq x &lt; 2' title='1 &#92;leq x &lt; 2' class='latex' /></p>
<p>whose solution is (with the boundary condition that f(1) = e)</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+e%5Ex+-+%28x-1%29e%5E%7Bx-1%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) = e^x - (x-1)e^{x-1}' title='f(x) = e^x - (x-1)e^{x-1}' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=1+%5Cleq+x+%3C+2&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='1 &#92;leq x &lt; 2' title='1 &#92;leq x &lt; 2' class='latex' />.</p>
<p>Armed with this, we can solve the differential equation for <img src='http://s0.wp.com/latex.php?latex=2+%5Cleq+x+%3C+3&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='2 &#92;leq x &lt; 3' title='2 &#92;leq x &lt; 3' class='latex' /> and so on. For example, we have</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7Bd%7D%7Bdx%7D+f%28x%29+%3D+f%28x%29+-+e%5E%7Bx-1%7D%2B%28x-2%29e%5E%7Bx-2%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;frac{d}{dx} f(x) = f(x) - e^{x-1}+(x-2)e^{x-2}' title='&#92;frac{d}{dx} f(x) = f(x) - e^{x-1}+(x-2)e^{x-2}' class='latex' /> when <img src='http://s0.wp.com/latex.php?latex=2+%5Cleq+x+%3C+3&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='2 &#92;leq x &lt; 3' title='2 &#92;leq x &lt; 3' class='latex' /></p>
<p>whose solution is</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+e%5Ex+-+%28x-1%29e%5E%7Bx-1%7D+%2B+%5Cfrac%7B%28x-2%29%5E2%7D%7B2%7D+e%5E%7Bx-2%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) = e^x - (x-1)e^{x-1} + &#92;frac{(x-2)^2}{2} e^{x-2}' title='f(x) = e^x - (x-1)e^{x-1} + &#92;frac{(x-2)^2}{2} e^{x-2}' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=2+%5Cleq+x+%3C+3&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='2 &#92;leq x &lt; 3' title='2 &#92;leq x &lt; 3' class='latex' />.</p>
<p>The form of the solution for a general <img src='http://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' /> can be easily guessed by working out the first couple of terms in the above manner. Once the form is guessed, it is easy to show that it indeed satisfies the above differential equation and that the solution is unique. Cutting to the chase, the final expression is</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+%5Csum_%7Bk+%3D+0%7D%5E%7B%5Bx%5D%7D+%28-1%29%5Ek+%5Cfrac%7B%28x-k%29%5Ek%7D%7Bk%21%7D+e%5E%7Bx-k%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) = &#92;sum_{k = 0}^{[x]} (-1)^k &#92;frac{(x-k)^k}{k!} e^{x-k}' title='f(x) = &#92;sum_{k = 0}^{[x]} (-1)^k &#92;frac{(x-k)^k}{k!} e^{x-k}' class='latex' /> where <img src='http://s0.wp.com/latex.php?latex=%5Bx%5D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='[x]' title='[x]' class='latex' /> is the integer part of <img src='http://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' />.</p>
<p style="text-align:center;">
<p style="text-align:left;">A couple of questions that I am currently trying to figure out:</p>
<p style="text-align:left;">
<ol>
<li>What is the variance of <img src='http://s0.wp.com/latex.php?latex=N%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='N(x)' title='N(x)' class='latex' />? Computer simulations suggest that it isn&#8217;t quite monotone increasing in <img src='http://s0.wp.com/latex.php?latex=%5B0%2C1%5D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='[0,1]' title='[0,1]' class='latex' />. Is there a deeper reason for this?</li>
<li>As <img src='http://s0.wp.com/latex.php?latex=x+%5Crightarrow+%5Cinfty&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x &#92;rightarrow &#92;infty' title='x &#92;rightarrow &#92;infty' class='latex' />, we expect <img src='http://s0.wp.com/latex.php?latex=f%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x)' title='f(x)' class='latex' /> to be approximately <img src='http://s0.wp.com/latex.php?latex=2x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='2x' title='2x' class='latex' />. Computer simulations suggest that <img src='http://s0.wp.com/latex.php?latex=f%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x)' title='f(x)' class='latex' /> does indeed grow linearly. However, as <img src='http://s0.wp.com/latex.php?latex=x+%5Crightarrow+%5Cinfty&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x &#92;rightarrow &#92;infty' title='x &#92;rightarrow &#92;infty' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=f%28x%29+%5Crightarrow+2x+%2B+%5Cfrac%7B2%7D%7B3%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x) &#92;rightarrow 2x + &#92;frac{2}{3}' title='f(x) &#92;rightarrow 2x + &#92;frac{2}{3}' class='latex' />. Is this fact apriori obvious? In other words, is it possible to guess the above form of <img src='http://s0.wp.com/latex.php?latex=f%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x)' title='f(x)' class='latex' /> for very large <img src='http://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' /> without going through this derivation? Also, how can this asymptotic form be derived from the exact expression for <img src='http://s0.wp.com/latex.php?latex=f%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(x)' title='f(x)' class='latex' /> given above?</li>
<li>What is the distribution of <img src='http://s0.wp.com/latex.php?latex=E%28x%29+%5Ctriangleq+%5Csum_%7Bi%3D1%7D%5E%7BN%28x%29%7D+U_i+-+x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='E(x) &#92;triangleq &#92;sum_{i=1}^{N(x)} U_i - x' title='E(x) &#92;triangleq &#92;sum_{i=1}^{N(x)} U_i - x' class='latex' />. As <img src='http://s0.wp.com/latex.php?latex=x+%5Crightarrow+0&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x &#92;rightarrow 0' title='x &#92;rightarrow 0' class='latex' />, clearly, <img src='http://s0.wp.com/latex.php?latex=E%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='E(x)' title='E(x)' class='latex' /> is uniformly distributed in <img src='http://s0.wp.com/latex.php?latex=%5Bx%2Cx%2B1%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='[x,x+1)' title='[x,x+1)' class='latex' />. When <img src='http://s0.wp.com/latex.php?latex=x+%3D+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x = 1' title='x = 1' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=E%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='E(x)' title='E(x)' class='latex' /> is definitely not uniformly distributed in <img src='http://s0.wp.com/latex.php?latex=%5B1%2C2%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='[1,2)' title='[1,2)' class='latex' />. It seems to me that for very large <img src='http://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' />, the distribution should again be uniform in <img src='http://s0.wp.com/latex.php?latex=%5Bx%2Cx%2B1%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='[x,x+1)' title='[x,x+1)' class='latex' />. Is this true? How does the procession from uniform to non-uniform to uniform again take place?</li>
<li>What kind of results can we expect if we replace the uniform distribution of <img src='http://s0.wp.com/latex.php?latex=U_i&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='U_i' title='U_i' class='latex' /> with some other distribution (which only takes positive values) like the exponential distribution?</li>
<li>One (potentially useless) side benefit of the above asymptotic is that we can use it to derive polynomial identities involving <img src='http://s0.wp.com/latex.php?latex=e&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='e' title='e' class='latex' /> that are almost integers. For example, <img src='http://s0.wp.com/latex.php?latex=f%285%29+%5Capprox+%5Cfrac%7B32%7D%7B3%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(5) &#92;approx &#92;frac{32}{3}' title='f(5) &#92;approx &#92;frac{32}{3}' class='latex' /> which gives the approximation</li>
</ol>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=24e%5E5+-96+e%5E4+%2B+108+e%5E3+-32e%5E2+%2B+e+%5Capprox+256&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='24e^5 -96 e^4 + 108 e^3 -32e^2 + e &#92;approx 256' title='24e^5 -96 e^4 + 108 e^3 -32e^2 + e &#92;approx 256' class='latex' />.</p>
<ol> The difference is only about <img src='http://s0.wp.com/latex.php?latex=10%5E%7B-4%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='10^{-4}' title='10^{-4}' class='latex' />. Higher values of <img src='http://s0.wp.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x' title='x' class='latex' /> yield better approximations. When <img src='http://s0.wp.com/latex.php?latex=x+%3D+1&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='x = 1' title='x = 1' class='latex' />, the approximation is just the first convergent (<img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7B8%7D%7B3%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;frac{8}{3}' title='&#92;frac{8}{3}' class='latex' />)  of the partial fraction expansion of <img src='http://s0.wp.com/latex.php?latex=e&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='e' title='e' class='latex' /> but higher values don&#8217;t agree with the higher convergents. Is there something to be said for such polynomial approximations (as against the linear approximations one gets through continued fraction expansions)?</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/snarktales.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/snarktales.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/snarktales.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/snarktales.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/snarktales.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/snarktales.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/snarktales.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/snarktales.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/snarktales.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/snarktales.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/snarktales.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/snarktales.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/snarktales.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/snarktales.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=snarktales.wordpress.com&amp;blog=3601608&amp;post=5&amp;subd=snarktales&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://snarktales.wordpress.com/2009/12/05/sum-of-uniform-random-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6672ce771fd1702edf7cff228ff89aeb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dinesh</media:title>
		</media:content>
	</item>
		<item>
		<title>Prime Spirals</title>
		<link>http://snarktales.wordpress.com/2008/05/18/prime-spirals/</link>
		<comments>http://snarktales.wordpress.com/2008/05/18/prime-spirals/#comments</comments>
		<pubDate>Sun, 18 May 2008 20:10:01 +0000</pubDate>
		<dc:creator>snarktales</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://snarktales.wordpress.com/?p=4</guid>
		<description><![CDATA[You know what mathematicians do when they have some spare time? They doodle with spirals and find curious and interesting patterns of prime numbers. That is what Stanislaw Ulam did back in the 60s, I imagine while sitting through a particularly boring talk at some conference. He wrote down the integers along a rectangular grid [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=snarktales.wordpress.com&amp;blog=3601608&amp;post=4&amp;subd=snarktales&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You know what mathematicians do when they have some spare time? They doodle with spirals and find curious and interesting patterns of prime numbers. That is what Stanislaw Ulam did back in the 60s, I imagine while sitting through a particularly boring talk at some conference. He wrote down the integers along a rectangular grid and noticed the location of the primes along this spiral. The primes seem to concentrate along certain patterns such as diagonals.</p>
<p>Finding patterns among the primes is among the most important problems of mathematics. Primes occupy a central position in mathematics because they can be viewed as the building blocks of all integers through the unique factorization theorem. There has been some success in characterizing them on a large scale (such as counting the number of primes less than n for some large n) but at a smaller scale things still are murky.</p>
<p>The prime spirals are one among many such tantalizing patterns involving prime numbers that are still not conclusively explained. The same patterns appear with other spirals such as Archimedean and the square root spiral. One such pattern in the Archimedean spiral corresponds to Euler&#8217;s prime generating polynomial <img src='http://s0.wp.com/latex.php?latex=n%5E2+%2B+n+%2B+41&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='n^2 + n + 41' title='n^2 + n + 41' class='latex' />, a famous prime rich polynomial that generates primes for n=1 to 39. If you want to generate a square spiral, try this in matlab: imshow(double(~isprime(spiral(n)))) generates a <img src='http://s0.wp.com/latex.php?latex=n+%5Ctimes+n&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='n &#92;times n' title='n &#92;times n' class='latex' /> prime spiral.  Look <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Sacks_spiral.svg/300px-Sacks_spiral.svg.png">here</a> for the Archimedean spiral.</p>
<p>Such patterns show how little we really understand primes and how far we still have to go. As an aside, the prime generating polynomial of Euler is very interesting. However, trying to create a polynomial that generates only primes is a doomed effort. Can you prove that any polynomial <img src='http://s0.wp.com/latex.php?latex=f%28n%29&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='f(n)' title='f(n)' class='latex' /> will surely produce a composite number for some integer <img src='http://s0.wp.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='n' title='n' class='latex' />?</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/snarktales.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/snarktales.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/snarktales.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/snarktales.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/snarktales.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/snarktales.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/snarktales.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/snarktales.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/snarktales.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/snarktales.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/snarktales.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/snarktales.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/snarktales.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/snarktales.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/snarktales.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/snarktales.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=snarktales.wordpress.com&amp;blog=3601608&amp;post=4&amp;subd=snarktales&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://snarktales.wordpress.com/2008/05/18/prime-spirals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6672ce771fd1702edf7cff228ff89aeb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dinesh</media:title>
		</media:content>
	</item>
		<item>
		<title>Almost Integers</title>
		<link>http://snarktales.wordpress.com/2008/04/28/almost-integers/</link>
		<comments>http://snarktales.wordpress.com/2008/04/28/almost-integers/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 23:32:07 +0000</pubDate>
		<dc:creator>snarktales</dc:creator>
				<category><![CDATA[Number theory]]></category>
		<category><![CDATA[almost integers]]></category>
		<category><![CDATA[Transcendental numbers]]></category>

		<guid isPermaLink="false">http://snarktales.wordpress.com/?p=3</guid>
		<description><![CDATA[&#8211; looks scary, doesn&#8217;t it? This is the so called Ramanujan&#8217;s constant and is a transcendental number. But a surprise awaits any one who tries to numerically evaluate it. Normal calculators and Matlab won&#8217;t work though. One needs more precision and if you want to give it a shot, try this arbitrary precision calculator. The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=snarktales.wordpress.com&amp;blog=3601608&amp;post=3&amp;subd=snarktales&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div style="text-align:justify;"><img src='http://s0.wp.com/latex.php?latex=e%5E%7B%5Cpi+%5Csqrt%7B163%7D%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='e^{&#92;pi &#92;sqrt{163}}' title='e^{&#92;pi &#92;sqrt{163}}' class='latex' /> &#8211; looks scary, doesn&#8217;t it? This is the so called Ramanujan&#8217;s constant and is a transcendental number. But a surprise awaits any one who tries to numerically evaluate it. Normal calculators and Matlab won&#8217;t work though. One needs more precision and if you want to give it a shot, try <a href="http://sun-microsystems.org/BigCalculator/BigCalculator.shtml">this </a>arbitrary precision calculator. The value is within <img src='http://s0.wp.com/latex.php?latex=10%5E%7B-12%7D&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='10^{-12}' title='10^{-12}' class='latex' /> of an integer!!! Who would have thought, looking at the number, that this would be the case? Ramanujan did a lot of work on these so called &#8220;<a href="http://en.wikipedia.org/wiki/Almost_integer">almost integers</a>&#8221; and hence this number is named for him. There is a beautiful mathematical theory behind this proximity to an integer involving imaginary quadratic fields. Some day, I hope to understand it. There are also other examples of these almost integers, for example, the so-called Pisot-Vijayaraghavan numbers (Vijayaraghavan is another Indian mathematician who worked with G.H.Hardy in the 1920s). For example, the golden ratio <img src='http://s0.wp.com/latex.php?latex=%5Cphi&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;phi' title='&#92;phi' class='latex' /> raised to a large power is very close to an integer. This phenomenon is also well understood. However, there are other examples which hint at mysterious and as yet undiscovered properties of <img src='http://s0.wp.com/latex.php?latex=e&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='e' title='e' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%5Cpi&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='&#92;pi' title='&#92;pi' class='latex' />. For instance <img src='http://s0.wp.com/latex.php?latex=e%5E%7B%5Cpi%7D+-+%5Cpi&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='e^{&#92;pi} - &#92;pi' title='e^{&#92;pi} - &#92;pi' class='latex' /> is within a thousandth of an integer and no one knows whether there is a reason for it or if it is just a coincidence. Truly fascinating stuff.</div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/snarktales.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/snarktales.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/snarktales.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/snarktales.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/snarktales.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/snarktales.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/snarktales.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/snarktales.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/snarktales.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/snarktales.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/snarktales.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/snarktales.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/snarktales.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/snarktales.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/snarktales.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/snarktales.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=snarktales.wordpress.com&amp;blog=3601608&amp;post=3&amp;subd=snarktales&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://snarktales.wordpress.com/2008/04/28/almost-integers/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6672ce771fd1702edf7cff228ff89aeb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dinesh</media:title>
		</media:content>
	</item>
	</channel>
</rss>
