<?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/"
	>

<channel>
	<title>mathemagicio.us</title>
	<atom:link href="http://mathemagicio.us/feed/" rel="self" type="application/rss+xml" />
	<link>http://mathemagicio.us</link>
	<description>Ramblings and musings about math, science and truth</description>
	<lastBuildDate>Wed, 14 Oct 2009 01:02:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A plea for notational common sense</title>
		<link>http://mathemagicio.us/2009/10/13/a-plea-for-notational-common-sense/</link>
		<comments>http://mathemagicio.us/2009/10/13/a-plea-for-notational-common-sense/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 01:02:47 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CS]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=585</guid>
		<description><![CDATA[Tradition can often be a retarding force in mathematics. Advancements in logic were held back by centuries due to a collective belief that Aristotle had it all figured out and there was nothing left to discover. Non-Euclidean geometry wasn&#8217;t seriously studied until the 1800s because no one could think of the parallel postulate being false.
We [...]]]></description>
			<content:encoded><![CDATA[<p>Tradition can often be a retarding force in mathematics. Advancements in logic were held back by <em>centuries</em> due to a collective belief that Aristotle had it all figured out and there was nothing left to discover. Non-Euclidean geometry wasn&#8217;t seriously studied until the 1800s because no one could think of the parallel postulate being false.</p>
<p>We nowadays tend to recognize the dangers of blindly following tradition, yet in virtually all areas of mathematics we continue to adhere to notational lunacy, and pass it on to future generations starting as early as in junior high school.</p>
<p>This lunacy is so deeply ingrained in our minds that we see nothing wrong with the following expression:</p>
<p style="text-align: center;"><img src='/wp-content/plugins/latexrender/pictures/a9da9b7a8748bc7e5a54805ffc7a30e3_3.5pt.png' title='\sin(f(x)^2)' alt='\sin(f(x)^2)'  style="vertical-align:-3.5pt;" ></p>
<p>Let&#8217;s decipher the above. We start with a number <em>x</em>, apply <em>f</em>, square the result, and finally apply <em>sin</em>. Yet how do we recover this order of operations from the symbols above? Starting at <em>x</em> in the middle we move left to <em>f</em>, right to the <img src='/wp-content/plugins/latexrender/pictures/51bb910207e57c5f8062d01966d7a221_1.0pt.png' title='\bullet^2 ' alt='\bullet^2 '  style="vertical-align:-1.0pt;" >, and far left to the <em>sin</em>.</p>
<p>Although we read and write left-to-right, and so naturally imagine time evolving in this direction, the notation <em>f(x)</em> (due to Euler) means the opposite: start with <em>x</em>, then apply <em>f</em>. Even worse is when we have an expression like <em>f(g(h(x)))</em>. The very first operation is written on the very right, and the final operation is written on the very left, in complete contrast to how we normally think.</p>
<p>Worse still is that we do read <em>some</em> operations left-to-right, like raising to a power, and so we end up mentally zig-zagging across mathematical writing to even decipher mathematical expressions.</p>
<p>But worst of all is the following: when we write a function <img src='/wp-content/plugins/latexrender/pictures/e0fcfcf1bc30612af09825187fbbad7d_2.94444pt.png' title='f:A\to B' alt='f:A\to B'  style="vertical-align:-2.94444pt;" >, <em>A</em> denotes the input domain, and <em>B</em> denotes the output domain: input on the left, output on the right. As we&#8217;d expect in a sane world. If we also have a function <img src='/wp-content/plugins/latexrender/pictures/f54369708b7c914b474a63972dc1f05a_2.94444pt.png' title='g:B\to C' alt='g:B\to C'  style="vertical-align:-2.94444pt;" >, this left-to-right notation suggests we should be able to follow the arrows (<em>A</em> to <em>B</em> to <em>C</em>) to compose <em>f</em> and <em>g</em>. Yet, of course, the composite is called <em>gf</em> rather than <em>fg</em>. When reading <em>gf</em> we are meant to mentally reverse the direction of the arrows, so that <img src='/wp-content/plugins/latexrender/pictures/e4e23d429467d6664f8498cc5566b38a_2.94444pt.png' title='g:C\gets B' alt='g:C\gets B'  style="vertical-align:-2.94444pt;" > and <img src='/wp-content/plugins/latexrender/pictures/898cb53cb1c1b732b75ed411ece724e8_2.94444pt.png' title='f:B\gets A' alt='f:B\gets A'  style="vertical-align:-2.94444pt;" >, although we never write this way!</p>
<p>This is psychotic behaviour, and we should put a stop to it. I suggest we forget tradition, and instead succumb to notational common sense to write expressions like <em>x.f.g</em> rather than <em>g(f(x))</em>.</p>
<p>This may seem bizarre at first, but at least one group of scientists adopted this notation years ago. In object-oriented programming languages a mental shift is required, where one stops thinking that <em>functions have certain inputs</em>, and instead starts to see that <em>inputs have certain functions</em>. In doing so, the left-to-right notation becomes completely natural, and we would write <code>deck.sort.pop</code> to sort a deck of cards and remove the last one, rather than <code>pop(sort(deck))</code> as we&#8217;d expect in the mathematicians&#8217; ridiculous notation.</p>
<p>I believe that a notational shift would make all of our lives easier in the long run, but of course it will likely never happen. Just as negative charge will always correspond to an excess of electrons, Euler&#8217;s notation is an unfortunate convention that is simply known by too many people. As a result, already-difficult subjects like category theory are made even more maddening for silly reasons, and high school students have far more difficulty learning precalculus than they should.</p>
<p>Help us, Barack Obama, we need Change.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/10/13/a-plea-for-notational-common-sense/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Substance abuse for thrifty individuals</title>
		<link>http://mathemagicio.us/2009/09/19/substance-abuse-for-thrifty-individuals/</link>
		<comments>http://mathemagicio.us/2009/09/19/substance-abuse-for-thrifty-individuals/#comments</comments>
		<pubDate>Sat, 19 Sep 2009 16:48:55 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Coffee]]></category>
		<category><![CDATA[Economics]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=582</guid>
		<description><![CDATA[I bought a coffee maker a year ago in an effort to avoid spending money at coffee shops. Instead, since I consume the majority of my coffee at school and work, it&#8217;s been sitting in my cupboard ever since. But now being the poor grad student that I am, I decided to unpack it and [...]]]></description>
			<content:encoded><![CDATA[<p>I bought a coffee maker a year ago in an effort to avoid spending money at coffee shops. Instead, since I consume the majority of my coffee at school and work, it&#8217;s been sitting in my cupboard ever since. But now being the poor grad student that I am, I decided to unpack it and take it to my office at the University to save gobs of money.</p>
<p>Downstairs in the ICT building, Ploughboy refills my (16 oz) coffee mug for the price of a small coffee—$1.54—a price of 77 cents per cup. This is by far the cheapest way to buy coffee on campus.</p>
<p>How much does it cost to instead make a cup of coffee myself? The local Superstore sells coffee beans for $1.79 per 100 grams, and I use 3 tablespoons of ground beans to make 4 cups of coffee. But how many grams are in a tablespoon? According to the <a href="http://www.ico.org/ecology.asp">International Coffee Organization</a>, finely-ground coffee has a density of 25 lb per cubic foot. Using the magic of Google, I calculated that <a href="http://www.google.com/search?hl=en&amp;client=safari&amp;rls=en-us&amp;q=%2817.9+CAD+%2F+1+kg%29+*+%2825+lb+%2F+cubic+foot%29+*+%283+tablespoons+%2F+4+cups%29+in+Canadian+cents+per+cup&amp;aq=f&amp;oq=&amp;aqi=">each cup of coffee costs me less than <em style="font-style: italic;">8 cents</em> to make</a>.</p>
<p>The least expensive coffee on campus is nearly <em style="font-style: italic;">ten times</em> more expensive than making my own. If I ever forget my mug and need to pay the full price for a paper cup then the cheapest alternative is The Coffee Company in MacEwan Hall which sells 16 oz coffees for $2.00, and the difference becomes closer to 13-fold.</p>
<p>Are there any other trivial-to-make foods or drinks that cost an order of magnitude more to buy out than make yourself? This sounds like an interesting project.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/09/19/substance-abuse-for-thrifty-individuals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twenty questions, in the degenerate case when 20 = lg(n)</title>
		<link>http://mathemagicio.us/2009/08/03/twenty-questions-in-the-degenerate-case-when-20-lgn/</link>
		<comments>http://mathemagicio.us/2009/08/03/twenty-questions-in-the-degenerate-case-when-20-lgn/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 03:40:35 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Complexity]]></category>
		<category><![CDATA[CS]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=554</guid>
		<description><![CDATA[A new post at Computational Complexity asks the following question:
(Problem 1.) You are trying to determine a secret integer x between 1 and n inclusive, using only queries of the form &#8220;is x = a (mod b)?&#8221; for integers a and b of your choosing. How many queries are required to determine x in the [...]]]></description>
			<content:encoded><![CDATA[<p>A new <a href="http://blog.computationalcomplexity.org/2009/08/find-number-again.html">post at Computational Complexity</a> asks the following question:</p>
<p style="padding-left: 30px; ">(Problem 1.) You are trying to determine a secret integer <em>x</em> between 1 and <em>n </em>inclusive, using only queries of the form &#8220;is x = <em>a</em> (mod <em>b</em>)?&#8221; for integers <em>a</em> and <em>b</em> of your choosing. How many queries are required to determine <em>x</em> in the worst case?</p>
<p>And more restrictively,</p>
<p style="padding-left: 30px; ">(Problem 2.) Same as above but you are only allowed to make queries where <em>b</em> is prime.</p>
<p>The comments section seems to reveal at least a partial solution, but these are fun problems, so at least give them a shot before reading the solution there (or here.) If you&#8217;d like the solution spoiled anyway, read on!<span id="more-554"></span></p>
<p>First let&#8217;s talk about a problem that has a more intuitive solution. Namely, the same problem of finding an integer between 1 and <em>n</em>, but where we are allowed to ask questions of the form &#8220;is x <em>≤</em> a?&#8221; for our choice of integers <em>a</em>.</p>
<p>Computer scientists in the audience should recognize the solution: first, find out about the midpoint. That is, whether <em>x</em> ≤ <em>n</em>/2. Whatever the answer is, we split the search space in half! That is, we originally knew that <em>x</em> must be one of <em>n</em> values. After the first query, we know that <em>x</em> must be one of <em>n</em>/2 values: either 1 ≤ x ≤ n/2 or n/2 &lt; x ≤ n. Either way, we can simply repeat the process again! After the second query, we know it must be one of <em>n</em>/4 values. And so on. For example, for 1 ≤ <em>x</em> ≤ 8, the following sequence of questions would reveal that the answer is <em>x</em> = 3.</p>
<p style="text-align: center; "><img class="aligncenter size-medium wp-image-555" title="Binary search" src="http://mathemagicio.us/wp-content/uploads/2009/08/binary-search-300x285.gif" alt="Binary search" width="240" height="228" /></p>
<p>It should be easy to convince yourself of the fact that you can only make these divisions lg(<em>n</em>) (that&#8217;s log-base-2*) times before you determine <em>x</em>.</p>
<p>Furthermore, this is the best we can do: any algorithm that finds <em>x</em> using only true/false queries requires at least lg(<em>n</em>) queries in the worst case. Why? Essentially, because this is how many bits there are in the binary expansion of <em>x</em>. Take <em>n</em> = 8 for example. If you could determine any 1 ≤ <em>x ≤ 8</em> using only two queries in the worst case, then any such <em>x</em> could be written uniquely using only 2 bits, which is impossible.</p>
<p>But let&#8217;s go back to Problem 1. Notice that the above argument applies for <em>any</em> algorithm that may only make queries about <em>x</em> whose answers are boolean. So we may immediately say that <em>at least</em> lg(<em>n</em>) queries are required by any algorithm that solves it.</p>
<p>However, is the answer again <em>exactly</em> lg(<em>n</em>)? Our binary search problem had the &#8220;nice&#8221; property that no matter what the answer to our previous query was, we could always construct <em>another</em> query that cut the search space in half <em>again</em>. Any boolean query may be thought of as a filter that eliminates a certain portion of the search space (which here is simply the set {1, 2, &#8230;, n}.) But not all queries may have this nice property. For example, if we were only allowed to ask questions of the form &#8220;is <em>x</em> = <em>a</em>?&#8221; then we would need to ask <em>n &#8211; 1</em> questions in the worst case—because no matter in what order we guess numbers, our first <em>n &#8211; 1</em> guesses could be wrong.</p>
<p>It turns out that the queries in Problem 1 do indeed have this nice property. The algorithm works like so:</p>
<ol>
<li>Ask whether <em>x</em> = 0 (mod 2). Doing so cuts the search space in half.</li>
<li>If the answer above was Yes, then ask whether <em>x</em> = 0 (mod 4). Since the previous answer was Yes, it must be the case that either <em>x</em> = 0 (mod 4) or <em>x</em> = 2 (mod 4), and the answer to this query again cuts the search space in half.</li>
<li>If the answer above was No, then ask whether <em>x</em> = 1 (mod 4). From the same reasoning as above, we again cut the search space in half.</li>
<li>Repeat the process using mod 8, 16, 32, etc., crafting the appropriate query.</li>
</ol>
<p>It shouldn&#8217;t be too hard to find the correct question to ask in each case. As an example,</p>
<p style="text-align: center; "><img class="aligncenter size-medium wp-image-557" title="Problem 1 solution example" src="http://mathemagicio.us/wp-content/uploads/2009/08/amodb-300x285.png" alt="Problem 1 solution example" width="240" height="228" /></p>
<p style="text-align: center;">
<p>This process can always be completed in lg(<em>n</em>) queries, which is the answer to Problem 1.</p>
<p>Note, however, that we always use a modulus of the form <img src='/wp-content/plugins/latexrender/pictures/fe401f62231ac24e3399751a415a4eaa_1.0pt.png' title='2^k' alt='2^k'  style="vertical-align:-1.0pt;" >, so this solution doesn&#8217;t help us solve Problem 2, where the modulus must always be prime! Don&#8217;t panic; I will discuss a solution to this problem in my next blog post.</p>
<p>* Here I&#8217;m assuming that <em>n</em> is a power of 2 to make the formula simpler, but if it isn&#8217;t then the correct answer is simply the <em>ceiling</em> of lg(<em>n</em>). That is, round lg(<em>n</em>) up. In fact, whenever I write lg(<em>n</em>) you can assume this is what I mean.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/08/03/twenty-questions-in-the-degenerate-case-when-20-lgn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Not so fundamental anymore, now are ya?</title>
		<link>http://mathemagicio.us/2009/07/31/not-so-fundamental-anymore-now-are-ya/</link>
		<comments>http://mathemagicio.us/2009/07/31/not-so-fundamental-anymore-now-are-ya/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 02:23:17 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Science!]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=551</guid>
		<description><![CDATA[So apparently the electron is not indivisible after all. Except, this is actually old news? What exactly is going on here?
]]></description>
			<content:encoded><![CDATA[<p>So apparently the electron is <a href="http://www.admin.cam.ac.uk/news/dp/2009073101">not indivisible</a> after all. Except, this is actually <a href="http://www.lbl.gov/Science-Articles/Archive/ALS-spinons-holons.html">old news</a>? What exactly is going on here?</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/07/31/not-so-fundamental-anymore-now-are-ya/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Who says computer scientists don&#8217;t know how to have fun?</title>
		<link>http://mathemagicio.us/2009/07/30/who-says-computer-scientists-dont-know-how-to-have-fun/</link>
		<comments>http://mathemagicio.us/2009/07/30/who-says-computer-scientists-dont-know-how-to-have-fun/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 02:23:02 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Complexity]]></category>
		<category><![CDATA[CS]]></category>
		<category><![CDATA[Science!]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=541</guid>
		<description><![CDATA[Who says computer scientists don&#8217;t know how to have fun? As a counterexample, consider a new post over at Gödel&#8217;s Lost Letter that was obviously the result of some Wednesday-night festivities and intoxication.
I think, in a sense, we are the accelerators. As we smash ideas together sometimes we discover the further structure of our fundamental particles—our complexity classes.
Duuuuude.
]]></description>
			<content:encoded><![CDATA[<p>Who says computer scientists don&#8217;t know how to have fun? As a counterexample, consider a new <a href="http://rjlipton.wordpress.com/2009/07/30/complexity-classes-meet-particle-physics/">post</a> over at Gödel&#8217;s Lost Letter that was obviously the result of some Wednesday-night festivities and intoxication.</p>
<blockquote><p>I think, in a sense, we are the accelerators. As we smash ideas together sometimes we discover the further structure of our fundamental particles—our complexity classes.</p></blockquote>
<p><em>Duuuuude</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/07/30/who-says-computer-scientists-dont-know-how-to-have-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Fresnel integral</title>
		<link>http://mathemagicio.us/2009/07/29/the-fresnel-integral/</link>
		<comments>http://mathemagicio.us/2009/07/29/the-fresnel-integral/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 16:39:50 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=505</guid>
		<description><![CDATA[Here&#8217;s a deceptively simple-looking integral:
.
At first glance, it&#8217;s not even obvious whether the above converges.
On the other hand, it is easy to see that  does not exist (at least not in in the traditional sense) and is analogous to the alternating sequence { 1, -1, 1, -1, &#8230; }. But what of squaring the x? [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a deceptively simple-looking integral:</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/4f42934a90d5ff364d575cd2858d5f03_4.5556pt.png' title='\int_0^{\infty} sin(x^2)dx' alt='\int_0^{\infty} sin(x^2)dx'  style="vertical-align:-4.5556pt;" >.</p>
<p>At first glance, it&#8217;s not even obvious whether the above converges.</p>
<p>On the other hand, it is easy to see that <img src='/wp-content/plugins/latexrender/pictures/6eb6ca639eadabe95c02cb991bee1569_4.5556pt.png' title='\int_0^{\infty} sin(x)dx' alt='\int_0^{\infty} sin(x)dx'  style="vertical-align:-4.5556pt;" > does not exist (at least not in in the traditional sense) and is analogous to the alternating sequence { 1, -1, 1, -1, &#8230; }. But what of squaring the <em>x</em>? The function <img src='/wp-content/plugins/latexrender/pictures/b93efbe271528375e2f5c06c8bf87b24_3.5pt.png' title='sin(x^2)' alt='sin(x^2)'  style="vertical-align:-3.5pt;" > alternates between positive and negative as well, so one might be tempted to say that its integral also diverges.</p>
<p>But before jumping to conclusions, let&#8217;s take a look at its graph:</p>
<p><img class="aligncenter size-full wp-image-510" title="sin(x^2)" src="http://mathemagicio.us/wp-content/uploads/2009/07/msp719196g71dgh20bcf8e0000674e64fhe257033g.gif" alt="sin(x^2)" width="300" height="179" /></p>
<p><span id="more-505"></span>As <em>x</em> increases, the areas under the positive and negative parts of the curve become smaller and smaller. The question is, do the areas become small <em>fast enough</em> for the integral to converge? The answer turns out to be yes, but proving so (and evaluating its value) turns out to be less straight-forward than the problem seems.</p>
<p>To prove convergence, we can show that <img src='/wp-content/plugins/latexrender/pictures/96e357b83338f89b0898ba2f6dc501d6_4.5556pt.png' title='\int_1^{\infty} sin(x^2)dx' alt='\int_1^{\infty} sin(x^2)dx'  style="vertical-align:-4.5556pt;" > converges. By substituting <img src='/wp-content/plugins/latexrender/pictures/895eb82beb5dd5830d1e5fdd599086d6_1.0pt.png' title='u=x^2' alt='u=x^2'  style="vertical-align:-1.0pt;" > the integral becomes <img src='/wp-content/plugins/latexrender/pictures/eb89883afe0d5cb6f6c001f0501c87f1_6.43994pt.png' title='\frac{1}{2}\int_1^{\infty} \frac{sin(u)}{\sqrt u} du' alt='\frac{1}{2}\int_1^{\infty} \frac{sin(u)}{\sqrt u} du'  style="vertical-align:-6.43994pt;" >, and integrating by parts (ignoring the constant factor of 1/2) yields</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/d978436a74e26d0621705089f4090d25_4.5556pt.png' title='-[cos(u)u^{-1/2}]^{\infty}_1 + \frac{1}{2}\int_1^{\infty} cos(u)u^{-3/2}' alt='-[cos(u)u^{-1/2}]^{\infty}_1 + \frac{1}{2}\int_1^{\infty} cos(u)u^{-3/2}'  style="vertical-align:-4.5556pt;" ></p>
<p>It&#8217;s easy to see that the left term vanishes at infinity, so we need only worry about the integral in the right term. But this converges as well—in fact, absolutely, because</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/f5f82457e30fc54c6ed174ee80ed0a99_4.5556pt.png' title='\int_1^{\infty} |cos(u)|u^{-3/2}\le\int_1^{\infty} u^{-3/2}' alt='\int_1^{\infty} |cos(u)|u^{-3/2}\le\int_1^{\infty} u^{-3/2}'  style="vertical-align:-4.5556pt;" ></p>
<p>where the right-hand side converges by the &#8220;p-test.&#8221;</p>
<p>So we&#8217;ve proved that the bugger converges, but what about <em>evaluating it</em>?</p>
<p>This also turns out to be more difficult than it has any right to be. The antiderivative of <img src='/wp-content/plugins/latexrender/pictures/b93efbe271528375e2f5c06c8bf87b24_3.5pt.png' title='sin(x^2)' alt='sin(x^2)'  style="vertical-align:-3.5pt;" > doesn&#8217;t have any nice, closed form. The standard method for evaluating it involves observing that <img src='/wp-content/plugins/latexrender/pictures/3b84c2f270789af0efbcb80537b2e008_3.5pt.png' title='e^{iz^2} = \cos(z^2) + i\sin(z^2)' alt='e^{iz^2} = \cos(z^2) + i\sin(z^2)'  style="vertical-align:-3.5pt;" > and considering the contour integral of <em>this</em> function around a pizza slice-shaped region in the complex plane which includes a line on the positive x-axis.</p>
<p><img class="aligncenter size-full wp-image-524" title="Pizza slice contour" src="http://mathemagicio.us/wp-content/uploads/2009/07/250px-fresnel_integral_contoursvg.png" alt="Pizza slice contour" width="250" height="175" />(Image stolen from the <a href="http://en.wikipedia.org/wiki/Fresnel_integral">Wikipedia entry</a>.)</p>
<p>As the radius <em>R</em> of the pizza slice goes to infinity, evaluating the line integral of <img src='/wp-content/plugins/latexrender/pictures/837dee47aecdaf2f1e53857d7ee2ecc0_1.0pt.png' title='e^{iz^2}' alt='e^{iz^2}'  style="vertical-align:-1.0pt;" > along γ<sub>1</sub> and taking its imaginary part would give us the value of the integral we want. Unfortunately, this integral is no easier to evaluate directly. However, <img src='/wp-content/plugins/latexrender/pictures/837dee47aecdaf2f1e53857d7ee2ecc0_1.0pt.png' title='e^{iz^2}' alt='e^{iz^2}'  style="vertical-align:-1.0pt;" > has no singularities, so by the <a href="http://en.wikipedia.org/wiki/Residue_theorem">residue theorem</a> its path integral all the way around the above path must be zero. Furthermore, we can prove that its integral along the crust goes to zero as <em>R</em> tends to infinity.</p>
<p>Therefore, the path integral along the diagonal γ<sub>3</sub> (from the origin outward) must be equal to the integral along γ<sub>1</sub> (also outward from the origin.)</p>
<p>We can parametrize the diagonal by <img src='/wp-content/plugins/latexrender/pictures/e065a7c7bd6b28b8e27bd0bb9f06d96e_3.5pt.png' title='g(t) = te^{i\pi / 4}' alt='g(t) = te^{i\pi / 4}'  style="vertical-align:-3.5pt;" >, so the path integral across the diagonal is</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/62b5fd49d4c02fae7c9d6315da0c18cf_4.5556pt.png' title='\int_0^{\infty} e^{ig(t)^2}g\prime (t)dt = e^{i\pi / 4} \int_0^{\infty} e^{-t^2}dt' alt='\int_0^{\infty} e^{ig(t)^2}g\prime (t)dt = e^{i\pi / 4} \int_0^{\infty} e^{-t^2}dt'  style="vertical-align:-4.5556pt;" ></p>
<p>Taking only the imaginary part, we arrive at</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/2f79c1e35d03cb915620be0f717d98b9_6.43994pt.png' title='\int_0^{\infty} sin(x^2) dx = \frac{1}{\sqrt 2} \int_0^{\infty} e^{-t^2}dt = \sqrt{2\pi}/4 ' alt='\int_0^{\infty} sin(x^2) dx = \frac{1}{\sqrt 2} \int_0^{\infty} e^{-t^2}dt = \sqrt{2\pi}/4 '  style="vertical-align:-6.43994pt;" ></p>
<p>where the second integral is simply half of the Gaussian integral.</p>
<p>The contribution of complex analysis is to prove the first identity above. My question is, is there a more elementary way of establishing it? It seems as though we shouldn&#8217;t need the theory of complex functions to evaluate something like this, but I can&#8217;t find any other way.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/07/29/the-fresnel-integral/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Circles covering squares and points</title>
		<link>http://mathemagicio.us/2009/06/12/circles-covering-squares-and-points/</link>
		<comments>http://mathemagicio.us/2009/06/12/circles-covering-squares-and-points/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 07:17:52 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=392</guid>
		<description><![CDATA[The following question appeared in an issue of π in the Sky:
Show that given any 201 points inside a 10-by-10 square, there is a unit circle containing at least 3 of those points.
It is natural to ask, for what other number of points n does the above hold? And what is the smallest such n?
One way to [...]]]></description>
			<content:encoded><![CDATA[<p>The following question appeared in an issue of <a href="http://www.pims.math.ca/pi/">π in the Sky</a>:</p>
<blockquote><p>Show that given any 201 points inside a 10-by-10 square, there is a unit circle containing at least 3 of those points.</p></blockquote>
<p>It is natural to ask, for what other number of points <em>n</em> does the above hold? And what is the smallest such <em>n</em>?<span id="more-392"></span></p>
<p>One way to bound <em>n</em> geometrically follows from noticing the obvious fact that</p>
<p style="padding-left: 30px;">given <em>k</em> circles covering a square and <em>m</em> points inside that square with any individual circle containing at most two of them, then it must be the case that <em>m ≤ 2k</em>.</p>
<p>which is just a restatement of the fact that</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/de33a72642cde993b8269a2e32e05a0f_4.00005pt.png' title=' \sum_i |A_i| \ge |\cup_i A_i | ' alt=' \sum_i |A_i| \ge |\cup_i A_i | '  style="vertical-align:-4.00005pt;" ></p>
<p>So it is sufficient to produce a covering of the square by 100 unit circles to prove the original statement, i.e. when <em>n = 201</em>.</p>
<p><em>Two-hundred and one</em> turns out to be a very generous bound, though. It&#8217;s quite easy to construct a covering of 60 (maybe 61?) circles, by an arrangement similar to the one below:</p>
<div id="attachment_462" class="wp-caption aligncenter" style="width: 292px"><img class="size-full wp-image-462  " title="Four circles in an arrangement" src="http://mathemagicio.us/wp-content/uploads/2009/06/circles.gif" alt="Tiling this arrangement of radius-0.1 circles allows you cover the unit square with 60 of them" width="282" height="281" /><p class="wp-caption-text">Tiling this arrangement of unit circles allows you cover a 10-by-10 square with 60 of them</p></div>
<p>This allows us to reduce the number of points from 201 in the original puzzle to only 2*60 + 1 = 121.</p>
<p>How much further can we reduce this number by this method? Worded slightly differently, what is the smallest number of unit circles that can cover a 10-by-10 square? This turns out to be a difficult problem, and <a href="http://www.stetson.edu/~efriedma/packing.html">Erich&#8217;s Packing Center</a> has <a href="http://www.stetson.edu/~efriedma/circovsqu/">the answer for the opposite question</a> (that is, &#8220;what is the largest <em>s-by-s</em> square that <em>n</em> unit circles can cover?&#8221;) for small values of <em>n</em>, with <em>s</em> reaching values of only about half of in what we&#8217;re interested.</p>
<p>Using Wolfram Alpha, we can <a href="http://www30.wolframalpha.com/input/?i=1.414%2C+1.788%2C+1.984%2C+2.828%2C+3.065%2C+3.347%2C+3.645%2C+3.841%2C+4.335%2C+4.582%2C+4.705%2C+4.943">plot these values</a> and observe that <em>s</em> appears to increase approximately linearly with <em>n</em>, and <a href="http://www30.wolframalpha.com/input/?i=linear+fit+%7B1.414%2C+1.788%2C+1.984%2C+2.828%2C+3.065%2C+3.347%2C+3.645%2C+3.841%2C+4.335%2C+4.582%2C+4.705%2C+4.943%7D">perform a linear fit</a>. Solving the resulting equation for <em>s = 10</em>, we might expect that a covering of a 10-by-10 square is possible using only 27 unit circles, which if true would bring the bound proved above down from 121 to only 55.</p>
<p>Finding such coverings allows us to prove that the original statement holds for (say) all <em>n ≥ 121</em>, but would finding the optimal covering give us the smallest <em>n</em> for which it holds? That doesn&#8217;t seem obvious, as this method essentially gives us a fixed set of circles we are allowed to use, independent of the points in the square, while the original statement allows for the circle to be a function of the points. So can we prove anything directly from the statement itself?</p>
<p>Again, it doesn&#8217;t seem obvious how, but what we <em>can</em> do easily is prove that the original statement fails for <em>n ≤ 49</em>. Simply consider a square lattice of points separated horizontally and vertically by a distance of <img src='/wp-content/plugins/latexrender/pictures/1fd9097e6e6e320446c6e7737a7b8846_2.32779pt.png' title='\sqrt{2} + \varepsilon' alt='\sqrt{2} + \varepsilon'  style="vertical-align:-2.32779pt;" >, so that each point is separated diagonally by at least a distance of 2. If we take <em>ε</em> to be small enough, say <em>ε = 0.1</em>, we can fit a grid of <em>7*7 = 49</em> points inside a 10-by-10 square, and it&#8217;s easy to convince yourself that no unit circle can cover three of the points in the lattice.</p>
<div id="attachment_483" class="wp-caption aligncenter" style="width: 253px"><img class="size-full wp-image-483  " title="Lattice of points" src="http://mathemagicio.us/wp-content/uploads/2009/06/lattice2.gif" alt="Lattice of points" width="243" height="264" /><p class="wp-caption-text">Spacing each point apart horizontally and vertically by √2+ε units ensures that no unit circle will cover three points</p></div>
<p>So we have an interesting situation: we can prove that the statement <em>fails</em> for all <em>n ≤ C</em> by constructing sets of points, and prove that the statement <em>holds</em> for all <em>n ≥ C</em> by constructing sets of circles, but neither method easily provides an exact answer.</p>
<p>Can we do better?</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/06/12/circles-covering-squares-and-points/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>President Obama continues not to be Jesus</title>
		<link>http://mathemagicio.us/2009/06/06/president-obama-continues-not-to-be-jesus/</link>
		<comments>http://mathemagicio.us/2009/06/06/president-obama-continues-not-to-be-jesus/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 21:57:12 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Obama]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=452</guid>
		<description><![CDATA[From MESH, Walter Laqueur&#8217;s pithy response to worries that Obama&#8217;s speech to &#8220;the Muslim world&#8221; offered style over substance:
What of the impact of the speech? An unfair question: soft power, however desirable, has its limits. Pericles’ funeral oration did not lead to the resurrection of the dead and there is still much sin in the [...]]]></description>
			<content:encoded><![CDATA[<p>From MESH, Walter Laqueur&#8217;s <a href="http://blogs.law.harvard.edu/mesh/2009/06/obama-and-the-muslims/">pithy response</a> to worries that Obama&#8217;s speech to &#8220;the Muslim world&#8221; offered style over substance:</p>
<blockquote><p>What of the impact of the speech? An unfair question: soft power, however desirable, has its limits. Pericles’ funeral oration did not lead to the resurrection of the dead and there is still much sin in the world despite the Sermon on the Mount.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/06/06/president-obama-continues-not-to-be-jesus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This physically pains me</title>
		<link>http://mathemagicio.us/2009/05/21/this-physically-pains-me/</link>
		<comments>http://mathemagicio.us/2009/05/21/this-physically-pains-me/#comments</comments>
		<pubDate>Fri, 22 May 2009 03:58:23 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CS]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=436</guid>
		<description><![CDATA[Here&#8217;s a real excerpt (slightly modified to protect the stupid, and now fixed) from a web app I inherited. GRAAAAAAAARGH!

def encrypt_password
  ...
  self.salt = md5&#40;&#34;#{Time.now.to_s}-#{login}&#34;&#41;
  ...
end
&#160;
def generate_confirm_hash
  ...
  self.confirm_hash = md5&#40;&#34;#{Time.now.to_s}-#{email}&#34;&#41;
  ..
end

Pro-tip for hiring managers: ask candidates to identify problems in the above code, and smack any who fail [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a real excerpt (slightly modified to protect the stupid, and now fixed) from a web app I inherited. <strong><em>GRAAAAAAAARGH!</em></strong></p>

<div class="wp_syntax"><div class="code"><pre class="rails rails" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> encrypt_password
  ...
  <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">salt</span> = md5<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{Time.now.to_s}-#{login}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  ...
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> generate_confirm_hash
  ...
  <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">confirm_hash</span> = md5<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{Time.now.to_s}-#{email}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  ..
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Pro-tip for hiring managers: ask candidates to identify problems in the above code, and smack any who fail to do so.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/05/21/this-physically-pains-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pop quiz</title>
		<link>http://mathemagicio.us/2009/05/04/pop-quiz/</link>
		<comments>http://mathemagicio.us/2009/05/04/pop-quiz/#comments</comments>
		<pubDate>Mon, 04 May 2009 23:35:15 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CS]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=405</guid>
		<description><![CDATA[All right, class. Who can tell me what the following program will output? Bear with me, I promise this gets interesting.

1
2
3
4
5
6
int main &#40;&#41;
&#123;
  int x = 0, y = 0;
  y = ++x + 10;
  printf&#40;&#34;%d, %d\n&#34;, x, y&#41;;
&#125;

That&#8217;s easy, it&#8217;s exactly what you expect: &#8220;1, 11&#8243;.
What about if you replace line [...]]]></description>
			<content:encoded><![CDATA[<p>All right, class. Who can tell me what the following program will output? Bear with me, I promise this gets interesting.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="c c" style="font-family:monospace;"><span style="color: #993333;">int</span> main <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> x <span style="color: #339933;">=</span> <span style="color:#800080;">0</span><span style="color: #339933;">,</span> y <span style="color: #339933;">=</span> <span style="color:#800080;">0</span>;
  y <span style="color: #339933;">=</span> <span style="color: #339933;">++</span>x <span style="color: #339933;">+</span> <span style="color: #0000dd;">10</span>;
  <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d, %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> x<span style="color: #339933;">,</span> y<span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>That&#8217;s easy, it&#8217;s exactly what you expect: &#8220;1, 11&#8243;.</p>
<p>What about if you replace line 4 with the following?</p>

<div class="wp_syntax"><div class="code"><pre class="c c" style="font-family:monospace;">y <span style="color: #339933;">=</span> x<span style="color: #339933;">++</span> <span style="color: #339933;">+</span> <span style="color: #0000dd;">10</span>;</pre></div></div>

<p>Again, easy! This time, the expression <code>x++</code> evaluates to the value of <code>x</code> <em>before</em> it is incremented, so the answer is &#8220;1, 10&#8243;.</p>
<p>Now, what about this?</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="c c" style="font-family:monospace;"><span style="color: #993333;">int</span> main <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> x <span style="color: #339933;">=</span> <span style="color:#800080;">0</span>;
  x <span style="color: #339933;">=</span> <span style="color: #339933;">++</span>x <span style="color: #339933;">+</span> <span style="color: #0000dd;">10</span>;
  <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> x<span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This is no different than the first example, except that we&#8217;ve chucked the variable <code>y</code>, so the answer is &#8220;11&#8243;.</p>
<p>Last question: (and I&#8217;m sure you can see where this is going) what if you replace line 4 with the following?</p>

<div class="wp_syntax"><div class="code"><pre class="c c" style="font-family:monospace;">x <span style="color: #339933;">=</span> x<span style="color: #339933;">++</span> <span style="color: #339933;">+</span> <span style="color: #0000dd;">10</span>;</pre></div></div>

<p>&nbsp;</p>
<p><span style="font-size: 200%">I&#8217;m obviously trying to trick you, so you must realize that the answer is surprisingly also &#8220;11&#8243;, but can anyone tell me <em>why</em> it is so?</span></p>
<p>&nbsp;</p>
<p><strong>Extra credit:</strong> explain what happens if you replace line 4 with this seemingly-equivalent statement:</p>

<div class="wp_syntax"><div class="code"><pre class="c c" style="font-family:monospace;"><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>x<span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>x<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000dd;">10</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/05/04/pop-quiz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
