<?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>Nate&#039;s blog &#187; nate</title>
	<atom:link href="http://www.natenewz.com/author/nate/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.natenewz.com</link>
	<description>My various projects</description>
	<lastBuildDate>Tue, 29 Jun 2010 18:00:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Sorting Version Numbers in PHP</title>
		<link>http://www.natenewz.com/2010/06/29/sorting-version-numbers-in-php/</link>
		<comments>http://www.natenewz.com/2010/06/29/sorting-version-numbers-in-php/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 17:51:50 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[None]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[numbers]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[sorting]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=371</guid>
		<description><![CDATA[What&#8217;s the problem? Say you have a version number such as 1.2.3 stored in a MySql database as a varchar, and you want to sort this version number. Without any decimals, here is the sorting descending:
+&#8212;&#8212;&#8212;+
&#124; version &#124;
+&#8212;&#8212;&#8212;+
&#124; 9960    &#124;
&#124; 9952    &#124;
&#124; 9765    &#124;
&#124; 9764  [...]]]></description>
			<content:encoded><![CDATA[<p>What&#8217;s the problem? Say you have a version number such as 1.2.3 stored in a MySql database as a varchar, and you want to sort this version number. Without any decimals, here is the sorting descending:<br />
+&#8212;&#8212;&#8212;+<br />
| version |<br />
+&#8212;&#8212;&#8212;+<br />
| 9960    |<br />
| 9952    |<br />
| 9765    |<br />
| 9764    |<br />
| 10011   |<br />
+&#8212;&#8212;&#8212;+<br />
5 rows in set (0.00 sec)<br />
It thinks 9960 &gt; 10011<br />
If you don&#8217;t have a decimal point this can be easily remedied by doing:<br />
ORDER BY CAST(version AS UNSIGNED) DESC<br />
But as soon as you put a decimal into the version, it ignores everything to the right of the decimal point.<br />
My solution is a PHP sorting algorithm.<br />
$versions is an indexed array that has this format, which could easily come from a database<br />
array<br/>&nbsp;&nbsp;0&nbsp;=&gt;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;array<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8217;id&#8217;&nbsp;=&gt;&nbsp;int&nbsp;88<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8217;version&#8217;&nbsp;=&gt;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&gt;&nbsp;int&nbsp;0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&gt;&nbsp;int&nbsp;9<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&gt;&nbsp;int&nbsp;10011<br/>&nbsp;&nbsp;1&nbsp;=&gt;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;array<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8217;id&#8217;&nbsp;=&gt;&nbsp;int&nbsp;87<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8217;version&#8217;&nbsp;=&gt;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&gt;&nbsp;int&nbsp;0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&gt;&nbsp;int&nbsp;9<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&gt;&nbsp;int&nbsp;9960</p>
<pre  id='PHP' class="prettyprint" >
// convert all values to ints
array_walk_recursive($versions, function(&amp;$val, $i)
{
    if (is_string($val))
        $val = (int)$val;
});
// make to arrays the same length by padding them with 0s
function normalize($a, $b)
{
    $al = count($a);
    $bl = count($b);
    if ($al &lt; $bl)
    {
        // add 0s to $a until they are the same size
        while (count($a) &lt; $bl)
            $a[] = 0;
    }
    elseif ($al &gt; $bl)
    {
        // add 0s to $b until they are the same size
        while ($al &gt; count($b))
            $b[] = 0;
    }
    return array($a, $b);
}
//compare to integers and decide which one is bigger
// return 0 if they are equal
function check($a, $b)
{
    if ($a &lt; $b)
        return 1;
    elseif ($a &gt; $b)
        return -1;
    else
        return 0;
}
// sort the array
usort($versions, function($a, $b)
{
    // make sure the major_version arrays have the same length, pad with 0s to correct
    list($a['version'], $b['version']) = normalize($a['version'], $b['version']);
    for ($i=0; $i &lt; count($a['version']); $i++)
        $check = check($a['version'][$i], $b['version'][$i]);
    return $check;
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2010/06/29/sorting-version-numbers-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Carburetor Tuning with DIY Manometer</title>
		<link>http://www.natenewz.com/2010/06/13/carburetor-tuning-with-diy-manometer/</link>
		<comments>http://www.natenewz.com/2010/06/13/carburetor-tuning-with-diy-manometer/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 00:39:26 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[Mechanical]]></category>
		<category><![CDATA[Motorcycle]]></category>
		<category><![CDATA[adjustment]]></category>
		<category><![CDATA[air flow]]></category>
		<category><![CDATA[balance]]></category>
		<category><![CDATA[DIY manometer]]></category>
		<category><![CDATA[linkage]]></category>
		<category><![CDATA[manormeter]]></category>
		<category><![CDATA[tuning carburettors]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=359</guid>
		<description><![CDATA[My motorcycle wasn&#8217;t running very well. There was an intermittent miss fire at varying throttle positions, and it wasn&#8217;t idling very well. I checked the spark plugs, which looked fine, and decided that the ignition system was probably all right. That isolated the problem to the carburettors.
My motorcycle has 4 inline carburettors, with a shared [...]]]></description>
			<content:encoded><![CDATA[<p>My motorcycle wasn&#8217;t running very well. There was an intermittent miss fire at varying throttle positions, and it wasn&#8217;t idling very well. I checked the spark plugs, which looked fine, and decided that the ignition system was probably all right. That isolated the problem to the carburettors.</p>
<div id="attachment_364" class="wp-caption alignleft" style="width: 310px"><a href="http://www.natenewz.com/wp-content/uploads/2010/06/P1000998.jpg"><img class="size-medium wp-image-364" title="P1000998" src="http://www.natenewz.com/wp-content/uploads/2010/06/P1000998-300x225.jpg" alt="" width="300" height="225" /></a><p class="wp-caption-text">Vacuum ports and Adjustment Screws</p></div>
<p>My motorcycle has 4 inline carburettors, with a shared linkage, 3 adjustment screws between each pair of carbs, and the throttle connected in the middle.<br />
The problem was that each carburettor wasn&#8217;t allowing the same amount of air through. This can be remedied with a tool called a manometer that measures the pressure difference at two points. Most multi carb setups have a small vacuum port between each carb and the engine, which is usually plugged with a screw. I took that screw out and found out it was an M5 x .8 metric thread. I then bought a hex bolt with that size, and drilled a hole down the center.</p>
<div id="attachment_361" class="wp-caption alignright" style="width: 160px"><a href="http://www.natenewz.com/wp-content/uploads/2010/06/P1000999.jpg"><img class="size-thumbnail wp-image-361" title="P1000999" src="http://www.natenewz.com/wp-content/uploads/2010/06/P1000999-150x150.jpg" alt="hex bolt with hole drilled through it" width="150" height="150" /></a><p class="wp-caption-text">hex bolt with hole drilled through it</p></div>
<p>I then built the following tool from <a title="DIY Manometer" href="http://obairlann.net/reaper/motorcycle/manometer.html" target="_blank">these plans</a>, slipped the hex bolt into the end of the tube, filled it up with water, and balanced all of the cylinders. This took some trial and error, and I had to be careful that the carbs weren&#8217;t too far off or else there would be enough pressure to suck the water into the engine. I started on the right two cylinders, and adjusted the farthest right adjustment screw. I then moved left. When I was done, the problem was fixed, and the motorcycle was running perfectly.</p>
<div id="attachment_360" class="wp-caption alignright" style="width: 162px"><a href="http://www.natenewz.com/wp-content/uploads/2010/06/manometer.png"><img class="size-medium wp-image-360" title="manometer" src="http://www.natenewz.com/wp-content/uploads/2010/06/manometer-152x300.png" alt="" width="152" height="300" /></a><p class="wp-caption-text">DIY manometer</p></div>
<p><div id="attachment_365" class="wp-caption alignright" style="width: 74px"><a href="http://www.natenewz.com/wp-content/uploads/2010/06/P10009961.jpg"><img class="size-medium wp-image-365" title="P1000996" src="http://www.natenewz.com/wp-content/uploads/2010/06/P10009961-64x300.jpg" alt="manometer" width="64" height="300" /></a><p class="wp-caption-text">DIY Manometer</p></div><br />
<br style='display: block; width: 100%;' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2010/06/13/carburetor-tuning-with-diy-manometer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Force PHP function to return instead of echo</title>
		<link>http://www.natenewz.com/2010/06/09/force-php-function-to-return-instead-of-echo/</link>
		<comments>http://www.natenewz.com/2010/06/09/force-php-function-to-return-instead-of-echo/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 00:15:06 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[draw]]></category>
		<category><![CDATA[echo]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[return]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=347</guid>
		<description><![CDATA[Have you ever working on some PHP software that had functions that echo&#8217;ed and you want them to return so you can echo later or pass the data to something else? I found a nice way of presenting the solution. All of the php functions that start with ob_ such as ob_start() allow you to [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever working on some PHP software that had functions that echo&#8217;ed and you want them to return so you can echo later or pass the data to something else? I found a nice way of presenting the solution. All of the php functions that start with ob_ such as ob_start() allow you to do this, but it takes several lines of code, and doesn&#8217;t seem very clean. I&#8217;ve put these into a a function that can be used as follows:</p>
<pre id='PHP' class="prettyprint" >
/**
 * Captures output from a function
 *
 * @param $callback is the name of the function
 * @return the output of the function
 */
function capture($callback)
{
    $args = func_get_args();
    array_shift($args);
    ob_start();
    if (count($args))
        call_user_func_array($callback, $args);
    else
        call_user_func($callback);
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
$sidebar = capture('get_sidebar');
// or if it was a function you needed to pass arguments into
$title = 'Test';
$author = 'Nate Nuzum';
$header = capture('get_header', $title, $author);

// works in the newer version of php 5
$sidebar = capture(function()
{
    get_sidebar();
});
function get_sidebar()
{
    echo 'hello';
}
function get_header($title, $author)
{
    echo "{$title} {$author}";
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2010/06/09/force-php-function-to-return-instead-of-echo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text File Paragraph Formatting with Vim</title>
		<link>http://www.natenewz.com/2010/04/05/text-file-paragraph-formatting-with-vim/</link>
		<comments>http://www.natenewz.com/2010/04/05/text-file-paragraph-formatting-with-vim/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 04:55:25 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[formatting]]></category>
		<category><![CDATA[line breaks]]></category>
		<category><![CDATA[paragraph]]></category>
		<category><![CDATA[paragraph formatting]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=344</guid>
		<description><![CDATA[I recently had to fix 50 files of plain text user content to be more readable. Line breaks needed to be added to make the paragraphs look more coherent. Here is my solution to fixing a file quickly.
Add the following to your .vimrc Set 100 to the max number of characters that you want in [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to fix 50 files of plain text user content to be more readable. Line breaks needed to be added to make the paragraphs look more coherent. Here is my solution to fixing a file quickly.</p>
<p>Add the following to your .vimrc Set 100 to the max number of characters that you want in a line.</p>
<p>:nmap &lt;c-a&gt; ggVGgq<br />
	:setlocal textwidth=100</p>
<p>save and quit.</p>
<p>Open up a file to edit, press Control-A and voila!</p>
<p>	&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2010/04/05/text-file-paragraph-formatting-with-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disabling the Wordpress Flash Uploader</title>
		<link>http://www.natenewz.com/2010/03/06/disabling-the-wordpress-flash-uploader/</link>
		<comments>http://www.natenewz.com/2010/03/06/disabling-the-wordpress-flash-uploader/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 16:42:58 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[None]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[disabling]]></category>
		<category><![CDATA[flash uploader]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=328</guid>
		<description><![CDATA[Sometimes it can be finnigy &#8212; the wordpress flash uploader. When it works, it works nicely, but when it doesn&#39;t work it can be frustrating to troubleshoot and fix. If you ever decide that you don&#39;t want it anymore, there is a very simple snippet that will make it look like wordpress never had a [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it can be finnigy &#8212; the wordpress flash uploader. When it works, it works nicely, but when it doesn&#39;t work it can be frustrating to troubleshoot and fix. If you ever decide that you don&#39;t want it anymore, there is a very simple snippet that will make it look like wordpress never had a flash uploader at all, and all you see is the html uploader. Create a plugin, add these two lines of code to it, and activate it.</p>
<pre class="prettyprint" id="PHP">&lt;?php
// Disable the flash uploader
add_action(&#39;flash_uploader&#39;, &#39;disableFlashUploader&#39;);
function disableFlashUploader(){return false;}
?&gt;
</pre>
<p><a href="http://www.natenewz.com/wp-content/uploads/2010/03/before.png"><img alt="screenshot of before disabling flash uploader" class="alignleft size-full wp-image-339" height="147" src="http://www.natenewz.com/wp-content/uploads/2010/03/before.png" title="Before" width="486" /></a><a href="http://www.natenewz.com/wp-content/uploads/2010/03/after.png"><img alt="After Disabling the flash uploader" class="alignleft<br />
 size-full wp-image-338" height="147" src="http://www.natenewz.com/wp-content/uploads/2010/03/after.png" title="after" width="416" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2010/03/06/disabling-the-wordpress-flash-uploader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Euler&#8217;s Formula and Trig Identities</title>
		<link>http://www.natenewz.com/2009/12/16/eulers-identity-and-trig-identities/</link>
		<comments>http://www.natenewz.com/2009/12/16/eulers-identity-and-trig-identities/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 06:12:32 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[Complex Analysis]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[analysis]]></category>
		<category><![CDATA[complex]]></category>
		<category><![CDATA[cubed]]></category>
		<category><![CDATA[derivation]]></category>
		<category><![CDATA[derive]]></category>
		<category><![CDATA[identity]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[sin]]></category>
		<category><![CDATA[sine]]></category>
		<category><![CDATA[trig]]></category>
		<category><![CDATA[trigonometry]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=250</guid>
		<description><![CDATA[Electrical Engineers tend to use imaginary numbers quite often for various reasons. The term &#8216;imaginary&#8217; can be misleading. In algebra II, when I heard that term, I was skeptical about the usefulness of an imaginary quantity. But if you can get over the name, they can be used as a powerful tool in many math, [...]]]></description>
			<content:encoded><![CDATA[<p>Electrical Engineers tend to use imaginary numbers quite often for various reasons. The term &#8216;imaginary&#8217; can be misleading. In algebra II, when I heard that term, I was skeptical about the usefulness of an imaginary quantity. But if you can get over the name, they can be used as a powerful tool in many math, and physics problems. I took a whole class on complex variable analysis in the spring of 09&#8242; after I realized how important they were to electrical engineering problems. Anyways, to illustrate one simple use of a complex number, I thought I would derive a trig formula. This technique comes in handy if you ever forget a trig formula, and you need to figure it out quick.<br />
<img src='http://s.wordpress.com/latex.php?latex=sin%28x%29%5E%7B3%7D%3D%3F&#038;bg=T&#038;fg=000000&#038;s=1' alt='sin(x)^{3}=?' title='sin(x)^{3}=?' class='latex' /><br />
<img src='http://s.wordpress.com/latex.php?latex=sin%28x%29%3D%5Cfrac%7Be%5E%7Bix%7D-e%5E%7B-ix%7D%7D%7B2i%7D&#038;bg=T&#038;fg=000000&#038;s=1' alt='sin(x)=\frac{e^{ix}-e^{-ix}}{2i}' title='sin(x)=\frac{e^{ix}-e^{-ix}}{2i}' class='latex' />&#8211; Euler&#8217;s Identity<br />
<img src='http://s.wordpress.com/latex.php?latex=y%3De%5E%7Bix%7D&#038;bg=T&#038;fg=000000&#038;s=1' alt='y=e^{ix}' title='y=e^{ix}' class='latex' />&#8211; a Variable substitution to simplify things<br />
<img src='http://s.wordpress.com/latex.php?latex=sin%28x%29%5E%7B3%7D%3D%28%5Cfrac%7By-1%2Fy%7D%7B2i%7D%29%5E%7B3%7D&#038;bg=T&#038;fg=000000&#038;s=1' alt='sin(x)^{3}=(\frac{y-1/y}{2i})^{3}' title='sin(x)^{3}=(\frac{y-1/y}{2i})^{3}' class='latex' /><br />
<img src='http://s.wordpress.com/latex.php?latex=%3D%5Cfrac%7B%28%7By-1%2Fy%7D%29%5E%7B3%7D%7D%7B%282i%29%5E3%7D%3D%5Cfrac%7By%5E3-3y%2B%5Cfrac%7B3%7D%7By%7D-%5Cfrac%7B1%7D%7By%5E3%7D%7D%7B%282i%29%5E3%7D&#038;bg=T&#038;fg=000000&#038;s=1' alt='=\frac{({y-1/y})^{3}}{(2i)^3}=\frac{y^3-3y+\frac{3}{y}-\frac{1}{y^3}}{(2i)^3}' title='=\frac{({y-1/y})^{3}}{(2i)^3}=\frac{y^3-3y+\frac{3}{y}-\frac{1}{y^3}}{(2i)^3}' class='latex' /><br />
<img src='http://s.wordpress.com/latex.php?latex=%3D%5Cfrac%7By%5E3-1%2Fy%5E3%7D%7B%282i%29%5E3%7D-3%5Cfrac%7By-1%2Fy%7D%7B%282i%29%5E3%7D&#038;bg=T&#038;fg=000000&#038;s=1' alt='=\frac{y^3-1/y^3}{(2i)^3}-3\frac{y-1/y}{(2i)^3}' title='=\frac{y^3-1/y^3}{(2i)^3}-3\frac{y-1/y}{(2i)^3}' class='latex' /><br />
<img src='http://s.wordpress.com/latex.php?latex=i%2Ai%3D-1&#038;bg=T&#038;fg=000000&#038;s=1' alt='i*i=-1' title='i*i=-1' class='latex' /><br />
<img src='http://s.wordpress.com/latex.php?latex=%282i%29%5E3%3D-4%2A2i&#038;bg=T&#038;fg=000000&#038;s=1' alt='(2i)^3=-4*2i' title='(2i)^3=-4*2i' class='latex' /><br />
<img src='http://s.wordpress.com/latex.php?latex=%3D-%5Cfrac%7B1%7D%7B4%7D%5Cfrac%7By%5E3-1%2Fy%5E3%7D%7B2i%7D%2B%5Cfrac%7B3%7D%7B4%7D%5Cfrac%7By-1%2Fy%7D%7B2i%7D&#038;bg=T&#038;fg=000000&#038;s=1' alt='=-\frac{1}{4}\frac{y^3-1/y^3}{2i}+\frac{3}{4}\frac{y-1/y}{2i}' title='=-\frac{1}{4}\frac{y^3-1/y^3}{2i}+\frac{3}{4}\frac{y-1/y}{2i}' class='latex' /><br />
<img src='http://s.wordpress.com/latex.php?latex=%3D-%5Cfrac%7B1%7D%7B4%7D%5Cfrac%7Be%5E%7Bi3x%7D-e%5E%7B-i3x%7D%7D%7B2i%7D%2B%5Cfrac%7B3%7D%7B4%7D%5Cfrac%7Be%5E%7Bix%7D-e%5E%7B-ix%7D%7D%7B2i%7D&#038;bg=T&#038;fg=000000&#038;s=1' alt='=-\frac{1}{4}\frac{e^{i3x}-e^{-i3x}}{2i}+\frac{3}{4}\frac{e^{ix}-e^{-ix}}{2i}' title='=-\frac{1}{4}\frac{e^{i3x}-e^{-i3x}}{2i}+\frac{3}{4}\frac{e^{ix}-e^{-ix}}{2i}' class='latex' /><br />
<img src='http://s.wordpress.com/latex.php?latex=sin%28x%29%5E3%3D-%5Cfrac%7B1%7D%7B4%7Dsin%283x%29%29%2B%5Cfrac%7B3%7D%7B4%7Dsin%28x%29&#038;bg=T&#038;fg=000000&#038;s=1' alt='sin(x)^3=-\frac{1}{4}sin(3x))+\frac{3}{4}sin(x)' title='sin(x)^3=-\frac{1}{4}sin(3x))+\frac{3}{4}sin(x)' class='latex' /><br />
<img src="http://www.natenewz.com/wp-content/uploads/2009/12/sin3.bmp" alt="two functions graphed on top of each other" title="sin3" class="alignright size-full wp-image-260" style='width: 100%;'/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2009/12/16/eulers-identity-and-trig-identities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>US Bank &#8211; Funny Ad</title>
		<link>http://www.natenewz.com/2009/12/15/us-bank-funny-ad/</link>
		<comments>http://www.natenewz.com/2009/12/15/us-bank-funny-ad/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 04:20:43 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Humor]]></category>
		<category><![CDATA[ad]]></category>
		<category><![CDATA[bank]]></category>
		<category><![CDATA[credit card]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[funny ad]]></category>
		<category><![CDATA[intelligence]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[smart]]></category>
		<category><![CDATA[stupid]]></category>
		<category><![CDATA[U.S. Bank]]></category>
		<category><![CDATA[US bank]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=224</guid>
		<description><![CDATA[ If you get this Credit Card, We will hit you in the face with a golf club. &#8211; US Bank
Iowa State has a high dollar deal with U.S. Bank that allows students to use their university id as a debit card. They have it set up such that, if you come to ISU, during [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; width: 50%;"><a href="http://www.natenewz.com/wp-content/uploads/2009/12/2009-12-10-12.30.27-725x1024.jpg"><img alt="2009-12-10 12.30.27" class="size-large wp-image-226 " src="http://www.natenewz.com/wp-content/uploads/2009/12/2009-12-10-12.30.27-725x1024.jpg" style="width: 94%;" title="2009-12-10 12.30.27" /></a> If you get this Credit Card, We will hit you in the face with a golf club. &#8211; US Bank</div>
<p>Iowa State has a high dollar deal with U.S. Bank that allows students to use their university id as a debit card. They have it set up such that, if you come to ISU, during your registration for classes, you automatically get routed into a line to sign up for a new U.S. bank debit card. And they make it seem like it is part of registering for ISU. A friend of mine called U.S. Bank about getting a loan. He asked them why he should get a loan from them if their rate wasn&#39;t that good. The service representative said, we have no reason to offer good rates, we make all of our money off of overdraft fees on college kids. Another friend of mine, over-drafted on accident. Each time she tried to use her debit card, for about 3 days, they charged her around $30. Her charges went up to over $500. We asked them why the card kept working if she was several hundred dollars in the negative, and the U.S. Bank employee replied, &quot;We allow it to continue working to save the customer from the embarrassment of their card not working in the grocery store.&quot; I personally would much rather be slightly embarrassed by my debit card not working than to get charged hundreds of dollars in overdraft fees.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2009/12/15/us-bank-funny-ad/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Freebording &#8211; Snowboarding in the Summer</title>
		<link>http://www.natenewz.com/2009/11/29/freebording-snowboarding-in-the-summer/</link>
		<comments>http://www.natenewz.com/2009/11/29/freebording-snowboarding-in-the-summer/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 01:20:01 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[Recreation]]></category>
		<category><![CDATA[Freebording]]></category>
		<category><![CDATA[ISU Freebording]]></category>
		<category><![CDATA[ISU Freebording club]]></category>
		<category><![CDATA[summer snowboarding]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=190</guid>
		<description><![CDATA[Skateboarding, a sport I enjoy, originated from surfers who wanted to &#34;surf the streets&#34;. A new sport, freebording, that some friends of mine at ISU are pioneering in the ISU Freebord Club, is allowing them to &#34;snowboard the streets&#34;.  A Freebord is like a long skateboard with two wheels placed along the center axis [...]]]></description>
			<content:encoded><![CDATA[<p>Skateboarding, a sport I enjoy, originated from surfers who wanted to &quot;surf the streets&quot;. A new sport, freebording, that some friends of mine at ISU are pioneering in the ISU Freebord Club, is allowing them to &quot;snowboard the streets&quot;. <img alt="Freebord" class="size-medium wp-image-191" src="http://www.natenewz.com/wp-content/uploads/2009/11/freebord-300x143.jpg" style="width: 80%; max-width: 300px;" title="freebord" /> A Freebord is like a long skateboard with two wheels placed along the center axis inline with the two outside wheels on the front and back. The center wheels are lower than the two outside wheels, and they swivel. This and the slip-in bindings allows the the freebord to carve sideways like a snowboard on the streets. I think that this sport might actually catch on because of the possible trick variations, no cost after initial investment, and close ties with snowboarding. Here is a video that some of my friends made. They have a better video that I will post as soon as they put it up. <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" height="344" width="425"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/BFUmehnL1oA&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed allowfullscreen="true" allowscriptaccess="always" height="344" src="http://www.youtube.com/v/BFUmehnL1oA&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" width="425"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2009/11/29/freebording-snowboarding-in-the-summer/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Convolution of Two Uniform Probability Distributions</title>
		<link>http://www.natenewz.com/2009/11/01/convolution-of-two-uniform-probability-distributions/</link>
		<comments>http://www.natenewz.com/2009/11/01/convolution-of-two-uniform-probability-distributions/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 10:36:27 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[arrival time]]></category>
		<category><![CDATA[central limit theorem]]></category>
		<category><![CDATA[continuous]]></category>
		<category><![CDATA[convolution]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[probability density function]]></category>
		<category><![CDATA[step function]]></category>
		<category><![CDATA[uniform]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=140</guid>
		<description><![CDATA[The Problem
Two friends A and B meet every morning at the Grand Central Station around 7 am. Suppose the actual times they arrive are independent and uniformly distributed between 6:55 am and 7:05am. Let Z denote the time between arrivals, i.e. Z = time B arrives &#8211; time A arrives (can be negative!).
(a) What is [...]]]></description>
			<content:encoded><![CDATA[<h3>The Problem</h3>
<p>Two friends A and B meet every morning at the Grand Central Station around 7 am. Suppose the actual times they arrive are independent and uniformly distributed between 6:55 am and 7:05am. Let Z denote the time between arrivals, i.e. Z = time B arrives &#8211; time A arrives (can be negative!).<br />
(a) What is the range of values of Z (i.e Im(Z))?<br />
(b) Find the density of Z (derive a formula similar to the convolution formula derived in class).</p>
<h3>The Solution</h3>
<p>(a) The times for Z can vary from -10 to 10. Suppose friend A arrives at 6:55 and friend B arrives at 7:05. Z would = -10. The other way around will result in Z = 10<br />
(b)</p>
<h4>Define Random Variables</h4>
<p>X = # of minutes (continuous) after 6:55 friend A arrives<br />
Y = # of minutes (continuous) after 6:55 friend B arrives</p>
<h4>Outline of Problem</h4>
<ul>
<li>The probability distribution functions of X and Y are uniform (constant and area = 1)</li>
<li>The convolution of the pdf&#8217;s of X and the negative of Y (X-Y) equal the pdf of Z</li>
<li>The result should look closer to the normal curve because of the Central Limit Theorem</li>
</ul>
<h4>The two input pdf&#8217;s and the result of the convolution which is the pdf of Z</h4>
<div style="overflow: auto;"><a href="http://fooplot.com/index.php?&amp;type0=0&amp;type1=0&amp;type2=0&amp;type3=0&amp;type4=0&amp;y0=1/10*%28-2x*u%28x%29%2B%28x%2B10%29*u%28x%2B10%29%2B%28x-10%29*u%28x-10%29%29&amp;y1=u%28x%29-u%28x-10%29&amp;y2=u%28x%2B10%29-u%28x%29&amp;y3=&amp;y4=&amp;r0=&amp;r1=&amp;r2=&amp;r3=&amp;r4=&amp;px0=&amp;px1=&amp;px2=&amp;px3=&amp;px4=&amp;py0=&amp;py1=&amp;py2=&amp;py3=&amp;py4=&amp;smin0=0&amp;smin1=0&amp;smin2=0&amp;smin3=0&amp;smin4=0&amp;smax0=2pi&amp;smax1=2pi&amp;smax2=2pi&amp;smax3=2pi&amp;smax4=2pi&amp;thetamin0=0&amp;thetamin1=0&amp;thetamin2=0&amp;thetamin3=0&amp;thetamin4=0&amp;thetamax0=2pi&amp;thetamax1=2pi&amp;thetamax2=2pi&amp;thetamax3=2pi&amp;thetamax4=2pi&amp;ipw=0&amp;ixmin=-5&amp;ixmax=5&amp;iymin=-3&amp;iymax=3&amp;igx=1&amp;igy=0.1&amp;igl=1&amp;igs=0&amp;iax=1&amp;ila=1&amp;xmin=-10.639526885769323&amp;xmax=10.834918728558375&amp;ymin=-0.23476296218988496&amp;ymax=1.6345029848685044"><img class="alignleft size-full wp-image-158" title="pdf's and the result of convolution" src="http://www.natenewz.com/wp-content/uploads/2009/11/save.png" alt="pdf's and the result of convolution" width="500" height="300" /></a></div>
<h4>Performing the convolution</h4>
<p><strong>Note: a=10</strong></p>
<ul style='list-style: none;'>
<li><img src='http://s.wordpress.com/latex.php?latex=Z%3DX-Y&#038;bg=T&#038;fg=000000&#038;s=1' alt='Z=X-Y' title='Z=X-Y' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=f_x%28t%29%20%3D%201%2Fa%2A%28u%28t%29%20%2B%20u%28t-a%29%29&#038;bg=T&#038;fg=000000&#038;s=1' alt='f_x(t) = 1/a*(u(t) + u(t-a))' title='f_x(t) = 1/a*(u(t) + u(t-a))' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=f_y%28t%29%20%3D%201%2Fa%2A%28u%28t%29%20%2B%20u%28t-a%29%29&#038;bg=T&#038;fg=000000&#038;s=1' alt='f_y(t) = 1/a*(u(t) + u(t-a))' title='f_y(t) = 1/a*(u(t) + u(t-a))' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=%5Cint_%7B-%5Cinfty%7D%5E%7B%5Cinfty%20%7Df_x%28t%29dt%20%3D%201&#038;bg=T&#038;fg=000000&#038;s=1' alt='\int_{-\infty}^{\infty }f_x(t)dt = 1' title='\int_{-\infty}^{\infty }f_x(t)dt = 1' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=%5Cint_%7B-%5Cinfty%7D%5E%7B%5Cinfty%20%7Df_y%28t%29dt%20%3D%201&#038;bg=T&#038;fg=000000&#038;s=1' alt='\int_{-\infty}^{\infty }f_y(t)dt = 1' title='\int_{-\infty}^{\infty }f_y(t)dt = 1' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=f_z%28t%29%3Df_x%28t%29%5Cstar%20f_y%28-t%29&#038;bg=T&#038;fg=000000&#038;s=1' alt='f_z(t)=f_x(t)\star f_y(-t)' title='f_z(t)=f_x(t)\star f_y(-t)' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=f%28t%29%20%5Cstar%20g%28t%29%3D%5Cint_%7B-%5Cinfty%7D%5E%7B%5Cinfty%20%7Df%28%5Ctau%20%29g%28t-%5Ctau%20%29d%5Ctau%20&#038;bg=T&#038;fg=000000&#038;s=1' alt='f(t) \star g(t)=\int_{-\infty}^{\infty }f(\tau )g(t-\tau )d\tau ' title='f(t) \star g(t)=\int_{-\infty}^{\infty }f(\tau )g(t-\tau )d\tau ' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=f_x%28t%29%20%5Cstar%20f_y%28-t%29%3D%5Cfrac%7B1%7D%7Ba%7D%20%5Cint_%7B-a%7D%5E%7Ba%7D%5Bu%28%5Ctau%20%29-u%28%5Ctau%20-a%29%5D%5Bu%28t-%5Ctau%20%2Ba%29-u%28t-%5Ctau%20%29%5Dd%5Ctau%20&#038;bg=T&#038;fg=000000&#038;s=1' alt='f_x(t) \star f_y(-t)=\frac{1}{a} \int_{-a}^{a}[u(\tau )-u(\tau -a)][u(t-\tau +a)-u(t-\tau )]d\tau ' title='f_x(t) \star f_y(-t)=\frac{1}{a} \int_{-a}^{a}[u(\tau )-u(\tau -a)][u(t-\tau +a)-u(t-\tau )]d\tau ' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=%3D%5Cfrac%7B1%7D%7Ba%7D%20%5Cint_%7B-a%7D%5E%7Ba%7Du%28%5Ctau%20%29u%28t-%5Ctau%20%2Ba%29%20-u%28%5Ctau%20%29u%28t-%5Ctau%20%29-u%28%5Ctau%20-a%29u%28t-%5Ctau%20%2Ba%29%2Bu%28%5Ctau%20-a%29u%28t-%5Ctau%29d%5Ctau%20&#038;bg=T&#038;fg=000000&#038;s=1' alt='=\frac{1}{a} \int_{-a}^{a}u(\tau )u(t-\tau +a) -u(\tau )u(t-\tau )-u(\tau -a)u(t-\tau +a)+u(\tau -a)u(t-\tau)d\tau ' title='=\frac{1}{a} \int_{-a}^{a}u(\tau )u(t-\tau +a) -u(\tau )u(t-\tau )-u(\tau -a)u(t-\tau +a)+u(\tau -a)u(t-\tau)d\tau ' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=0%3D%20%5Cint_%7B-a%7D%5E%7Ba%7Du%28%5Ctau%20-a%29u%28t-%5Ctau%20%2Ba%29%2Bu%28%5Ctau%20-a%29u%28t-%5Ctau%29d%5Ctau%20&#038;bg=T&#038;fg=000000&#038;s=1' alt='0= \int_{-a}^{a}u(\tau -a)u(t-\tau +a)+u(\tau -a)u(t-\tau)d\tau ' title='0= \int_{-a}^{a}u(\tau -a)u(t-\tau +a)+u(\tau -a)u(t-\tau)d\tau ' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=%3D%5Cfrac%7B1%7D%7Ba%7D%5Cint_%7B-a%7D%5E%7Ba%7Du%28%5Ctau%20%29u%28t-%5Ctau%20%2Ba%29d%5Ctau%20%3D%20%5Cint_%7B0%7D%5E%7Ba%7Du%28t-%5Ctau%20%2Ba%29d%5Ctau&#038;bg=T&#038;fg=000000&#038;s=1' alt='=\frac{1}{a}\int_{-a}^{a}u(\tau )u(t-\tau +a)d\tau = \int_{0}^{a}u(t-\tau +a)d\tau' title='=\frac{1}{a}\int_{-a}^{a}u(\tau )u(t-\tau +a)d\tau = \int_{0}^{a}u(t-\tau +a)d\tau' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=%5Cint_%7B0%7D%5E%7Ba%7Du%28t-%5Ctau%20%2Ba%29d%5Ctau%5C%3B%20x%3Dt-%5Ctau%20%2Ba%5C%3B%20%5Cfrac%7B%5Cmathrm%7Bd%7D%20x%7D%7B%5Cmathrm%7Bd%7D%20%5Ctau%7D%20%3D%20-1&#038;bg=T&#038;fg=000000&#038;s=1' alt='\int_{0}^{a}u(t-\tau +a)d\tau\; x=t-\tau +a\; \frac{\mathrm{d} x}{\mathrm{d} \tau} = -1' title='\int_{0}^{a}u(t-\tau +a)d\tau\; x=t-\tau +a\; \frac{\mathrm{d} x}{\mathrm{d} \tau} = -1' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=-%5Cint_%7Bt%2B10%7D%5E%7Bt%7Du%28x%29dx&#038;bg=T&#038;fg=000000&#038;s=1' alt='-\int_{t+10}^{t}u(x)dx' title='-\int_{t+10}^{t}u(x)dx' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=-tu%28t%29%2B%28t%2Ba%29u%28t%2Ba%29&#038;bg=T&#038;fg=000000&#038;s=1' alt='-tu(t)+(t+a)u(t+a)' title='-tu(t)+(t+a)u(t+a)' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=%5Cint_%7B0%7D%5E%7Ba%7Du%28t-%5Ctau%20%29d%5Ctau%5C%3B%20x%3Dt-%5Ctau%5C%3B%20%5Cfrac%7B%5Cmathrm%7Bd%7D%20x%7D%7B%5Cmathrm%7Bd%7D%20%5Ctau%7D%20%3D%20-1&#038;bg=T&#038;fg=000000&#038;s=1' alt='\int_{0}^{a}u(t-\tau )d\tau\; x=t-\tau\; \frac{\mathrm{d} x}{\mathrm{d} \tau} = -1' title='\int_{0}^{a}u(t-\tau )d\tau\; x=t-\tau\; \frac{\mathrm{d} x}{\mathrm{d} \tau} = -1' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=%5Cint_%7Bt%7D%5E%7Bt-10%7Du%28x%29dx&#038;bg=T&#038;fg=000000&#038;s=1' alt='\int_{t}^{t-10}u(x)dx' title='\int_{t}^{t-10}u(x)dx' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=%28t-a%29u%28t-a%29-tu%28t%29&#038;bg=T&#038;fg=000000&#038;s=1' alt='(t-a)u(t-a)-tu(t)' title='(t-a)u(t-a)-tu(t)' class='latex' /></li>
<li><img src='http://s.wordpress.com/latex.php?latex=f%28t%29%20%5Cstar%20g%28t%29%3D%5Cfrac%7B1%7D%7Ba%7D%28-2tu%28t%29%2B%28t%2Ba%29u%28t%2Ba%29%2B%28t-a%29u%28t-a%29%29&#038;bg=T&#038;fg=000000&#038;s=1' alt='f(t) \star g(t)=\frac{1}{a}(-2tu(t)+(t+a)u(t+a)+(t-a)u(t-a))' title='f(t) \star g(t)=\frac{1}{a}(-2tu(t)+(t+a)u(t+a)+(t-a)u(t-a))' class='latex' /></li>
</ul>
<h4>Simulation</h4>
<ul>
<li>Random number generator is a uniform distribution</li>
<li>Histogram of Randbetween(0,10)-Randbetween(0,10) 2092 times divided by 2092</li>
<li>Discrete version of this problem</li>
</ul>
<p><img class="alignleft size-full wp-image-182" style="width: 100%;" title="Excel Simulation" src="http://www.natenewz.com/wp-content/uploads/2009/11/simulation.jpg" alt="Excel Simulation" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2009/11/01/convolution-of-two-uniform-probability-distributions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
