<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/1.5.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Conquering divide</title>
	<link>http://bit-player.org/2007/conquering-divide</link>
	<description>An amateur's outlook on computation and mathematics.</description>
	<pubDate>Fri, 29 Aug 2008 07:39:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.2</generator>

	<item>
 		<title>Comment on Conquering divide by: Barry Cipra</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1520</link>
		<pubDate>Tue, 16 Oct 2007 16:49:27 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1520</guid>
					<description>&quot;...this is the first nontrivial algorithm most of us encounter in life, and it’s a really weird one.&quot;

Speaking of weird algorithms, does anyone else (in the appropriate, geriatric age bracket) recall learning a long-hand algorithm for taking square roots?  I remember doing so back in the early 1960s.  The mechanics looked a lot like long division, except you had to guess successive digits of the divisor along with the quotient (which of course are supposed to be equal).  As in long division, the algorithm could keep churning out decimal digits.

Is computing the (integer part of the) square root also in Logspace?</description>
		<content:encoded><![CDATA[	<p>&#8220;&#8230;this is the first nontrivial algorithm most of us encounter in life, and it’s a really weird one.&#8221;</p>
	<p>Speaking of weird algorithms, does anyone else (in the appropriate, geriatric age bracket) recall learning a long-hand algorithm for taking square roots?  I remember doing so back in the early 1960s.  The mechanics looked a lot like long division, except you had to guess successive digits of the divisor along with the quotient (which of course are supposed to be equal).  As in long division, the algorithm could keep churning out decimal digits.</p>
	<p>Is computing the (integer part of the) square root also in Logspace?
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: brian</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1519</link>
		<pubDate>Tue, 16 Oct 2007 16:06:30 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1519</guid>
					<description>Toby: IANAM either, and perhaps that's why I don't understand your question. I assert there's an asymmetry: A standard &quot;times table&quot; supplies a product for every combination of multiplier and multiplicand in a certain range, but the same table does not provide (by a simple lookup) the quotient for every combination of divisor and dividend. No?</description>
		<content:encoded><![CDATA[	<p>Toby: IANAM either, and perhaps that&#8217;s why I don&#8217;t understand your question. I assert there&#8217;s an asymmetry: A standard &#8220;times table&#8221; supplies a product for every combination of multiplier and multiplicand in a certain range, but the same table does not provide (by a simple lookup) the quotient for every combination of divisor and dividend. No?
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: Toby</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1518</link>
		<pubDate>Mon, 15 Oct 2007 21:54:35 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1518</guid>
					<description>IANAM, but:

&quot;No such searching (or guessing) step is needed with multiplication.&quot;

Is it not the case that both algorithms benefit *equally* from a lookup table - specifically the so-called &quot;times tables&quot; that we learned by rote as children? Or are you suggesting (absent a table) that children do the sub-multiplies by repeated addition? :-)</description>
		<content:encoded><![CDATA[	<p>IANAM, but:</p>
	<p>&#8220;No such searching (or guessing) step is needed with multiplication.&#8221;</p>
	<p>Is it not the case that both algorithms benefit *equally* from a lookup table - specifically the so-called &#8220;times tables&#8221; that we learned by rote as children? Or are you suggesting (absent a table) that children do the sub-multiplies by repeated addition? :-)
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: Barry Cipra</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1516</link>
		<pubDate>Sat, 13 Oct 2007 13:43:20 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1516</guid>
					<description>Ryan, thanks for the clarification.</description>
		<content:encoded><![CDATA[	<p>Ryan, thanks for the clarification.
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: Carlos</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1515</link>
		<pubDate>Fri, 12 Oct 2007 20:06:38 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1515</guid>
					<description>I never had a problem with the long division algorithm once I understood it exactly as the algorithm in Barry Cipra's comment above: add a bunch of zeros to the divisor and the quotient and start subtracting away. When you can't any longer, shift right and repeat. 

(I also like the connection with CRC algorithms, GF(2) and XOR gates. CRC hardware is in the end really perform long division, if I remember things right)</description>
		<content:encoded><![CDATA[	<p>I never had a problem with the long division algorithm once I understood it exactly as the algorithm in Barry Cipra&#8217;s comment above: add a bunch of zeros to the divisor and the quotient and start subtracting away. When you can&#8217;t any longer, shift right and repeat. </p>
	<p>(I also like the connection with CRC algorithms, GF(2) and XOR gates. CRC hardware is in the end really perform long division, if I remember things right)
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: Jonathan Katz</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1514</link>
		<pubDate>Fri, 12 Oct 2007 15:48:38 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1514</guid>
					<description>Yes, a logspace algorithm uses space that is logarithmic in its input length, which in this case is the number of digits n.</description>
		<content:encoded><![CDATA[	<p>Yes, a logspace algorithm uses space that is logarithmic in its input length, which in this case is the number of digits n.
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: ryan williams</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1513</link>
		<pubDate>Fri, 12 Oct 2007 15:40:18 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1513</guid>
					<description>A logspace algorithm would use &quot;memory proportional to the logarithm of the number of digits in the input&quot;. (We assume the input is on a read-only storage and the final output is written on a write-only storage, so those digits are not counted as part of the working memory.) 

For an example, if you want to compute the digit that occurs the most often in a given input number (to break ties, let's say you want the smallest digit with this property), this can be done in logspace by keeping 10 binary counters (one for each digit) and incrementing the appropriate counter as you read the input from left to right. Each counter requires O(log n) bits to store, where n is the number of digits.</description>
		<content:encoded><![CDATA[	<p>A logspace algorithm would use &#8220;memory proportional to the logarithm of the number of digits in the input&#8221;. (We assume the input is on a read-only storage and the final output is written on a write-only storage, so those digits are not counted as part of the working memory.) </p>
	<p>For an example, if you want to compute the digit that occurs the most often in a given input number (to break ties, let&#8217;s say you want the smallest digit with this property), this can be done in logspace by keeping 10 binary counters (one for each digit) and incrementing the appropriate counter as you read the input from left to right. Each counter requires O(log n) bits to store, where n is the number of digits.
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: Barry Cipra</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1512</link>
		<pubDate>Fri, 12 Oct 2007 03:25:49 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1512</guid>
					<description>It seems to me what's lacking is a clear definition of &quot;logspace.&quot;  I was going by Brian's parenthetical description, &quot;memory proportional to the number of digits in the input.&quot;  The algorithm I outlined certainly fits that bill.</description>
		<content:encoded><![CDATA[	<p>It seems to me what&#8217;s lacking is a clear definition of &#8220;logspace.&#8221;  I was going by Brian&#8217;s parenthetical description, &#8220;memory proportional to the number of digits in the input.&#8221;  The algorithm I outlined certainly fits that bill.
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: ryan williams</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1511</link>
		<pubDate>Thu, 11 Oct 2007 22:05:57 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1511</guid>
					<description>Whoops-- ignore the &quot;exponential time&quot; statement in my post, I conflated your algorithm with Brian's-- your algorithm DOES run in polynomial time, but it also uses polynomial space as well.</description>
		<content:encoded><![CDATA[	<p>Whoops&#8211; ignore the &#8220;exponential time&#8221; statement in my post, I conflated your algorithm with Brian&#8217;s&#8211; your algorithm DOES run in polynomial time, but it also uses polynomial space as well.
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: ryan williams</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1510</link>
		<pubDate>Thu, 11 Oct 2007 20:56:50 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1510</guid>
					<description>Barry: Your algorithm runs in polynomial space and exponential time, not logspace and polynomial time. The input to the division problem is two n-bit integers. In the worst case, the integers you keep around in your algorithm (especially at the beginning of its execution) have at least Omega(n) bits-- not O(log n) bits.</description>
		<content:encoded><![CDATA[	<p>Barry: Your algorithm runs in polynomial space and exponential time, not logspace and polynomial time. The input to the division problem is two n-bit integers. In the worst case, the integers you keep around in your algorithm (especially at the beginning of its execution) have at least Omega(n) bits&#8211; not O(log n) bits.
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: Mitch</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1508</link>
		<pubDate>Thu, 11 Oct 2007 18:16:46 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1508</guid>
					<description>Re: the 'real'-world symmetry of multiplication/division vs the asymmetry in numbers...real life is like the continuous reals, where multiplication and division -are- symmetric. But in discrete integers, all pairs of numbers multiply to give a single integer, but not so with division.</description>
		<content:encoded><![CDATA[	<p>Re: the &#8216;real&#8217;-world symmetry of multiplication/division vs the asymmetry in numbers&#8230;real life is like the continuous reals, where multiplication and division -are- symmetric. But in discrete integers, all pairs of numbers multiply to give a single integer, but not so with division.
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: Suresh</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1507</link>
		<pubDate>Thu, 11 Oct 2007 17:48:55 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1507</guid>
					<description>I think the point of Allender's article is that we want to find the &quot;natural&quot; complexity of division. In the absence of true lower bounds, the next best thing is to find the complexity class that division is &quot;complete&quot; for, which basically means that division is an example of the hardest problem in this class. His paper describes the final nailing of this, with the result that division is complete for a circuit class called TC^0 with a uniformity condition (see the &lt;a href=&quot;http://qwiki.caltech.edu/wiki/Complexity_Zoo#tc0&quot; rel=&quot;nofollow&quot;&gt;complexity zoo entry on TC^0&lt;/a&gt; for more information)</description>
		<content:encoded><![CDATA[	<p>I think the point of Allender&#8217;s article is that we want to find the &#8220;natural&#8221; complexity of division. In the absence of true lower bounds, the next best thing is to find the complexity class that division is &#8220;complete&#8221; for, which basically means that division is an example of the hardest problem in this class. His paper describes the final nailing of this, with the result that division is complete for a circuit class called TC^0 with a uniformity condition (see the <a href="http://qwiki.caltech.edu/wiki/Complexity_Zoo#tc0" rel="nofollow">complexity zoo entry on TC^0</a> for more information)
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: brian</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1506</link>
		<pubDate>Thu, 11 Oct 2007 16:25:45 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1506</guid>
					<description>Barry: I'm sure you're not missing anything. As noted above, division is indeed in P (the polynomial-time complexity class) and in L (the logspace complexity class). What am *I* missing?</description>
		<content:encoded><![CDATA[	<p>Barry: I&#8217;m sure you&#8217;re not missing anything. As noted above, division is indeed in P (the polynomial-time complexity class) and in L (the logspace complexity class). What am *I* missing?
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: Barry Cipra</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1505</link>
		<pubDate>Thu, 11 Oct 2007 15:53:55 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1505</guid>
					<description>I must be missing something in the definitions, because it seems to me there's a fairly simple logspace algorithm for division.  Here's my proposal.  First, multiply the divisor by 10 -- i.e., put zeros at its end -- as long as the result stays less than (or equal to) the dividend.  Then subtract, increment the appropriate digit of the quotient by 1, and repeat.  Each step is clearly polynomial (the &quot;hardest&quot; part is the subtraction), and the number of repetitions is clearly no more than 9 times the number of digits in the dividend (the worst case occurs when you divide 9999...99 by 1), so everything overall is polynomial.  What makes it logspace -- if I understand what logspace means (which is probably the sticking point) -- is that after you've done the subtraction, you can forget the original number.

For example, dividing 29 into 40321 (your example) proceeds as follows, with each step written in a separate line:

40321-29000=11321, Q=(1000)
11321-2900=8421, Q=(1100)
8421-2900=5521, Q=(1200)
5521-2900=2621, Q=(1300)
2621-290=2331, Q=(1310)
2331-290=2041, Q=(1320)
2041-290=1751, Q=(1330)
1751-290=1461, Q=(1340)
1461-290=1171, Q=(1350)
1171-290=881, Q=(1360)
881-290=591, Q=(1370)
591-290=301, Q=(1380)
301-290=11, Q=(1390), R=11

The logspaciousness resides in the fact that once you've completed a step, you can erase everything in the step above it -- think of it as alternating between two blackboards.

So what am I missing?</description>
		<content:encoded><![CDATA[	<p>I must be missing something in the definitions, because it seems to me there&#8217;s a fairly simple logspace algorithm for division.  Here&#8217;s my proposal.  First, multiply the divisor by 10 &#8212; i.e., put zeros at its end &#8212; as long as the result stays less than (or equal to) the dividend.  Then subtract, increment the appropriate digit of the quotient by 1, and repeat.  Each step is clearly polynomial (the &#8220;hardest&#8221; part is the subtraction), and the number of repetitions is clearly no more than 9 times the number of digits in the dividend (the worst case occurs when you divide 9999&#8230;99 by 1), so everything overall is polynomial.  What makes it logspace &#8212; if I understand what logspace means (which is probably the sticking point) &#8212; is that after you&#8217;ve done the subtraction, you can forget the original number.</p>
	<p>For example, dividing 29 into 40321 (your example) proceeds as follows, with each step written in a separate line:</p>
	<p>40321-29000=11321, Q=(1000)<br />
11321-2900=8421, Q=(1100)<br />
8421-2900=5521, Q=(1200)<br />
5521-2900=2621, Q=(1300)<br />
2621-290=2331, Q=(1310)<br />
2331-290=2041, Q=(1320)<br />
2041-290=1751, Q=(1330)<br />
1751-290=1461, Q=(1340)<br />
1461-290=1171, Q=(1350)<br />
1171-290=881, Q=(1360)<br />
881-290=591, Q=(1370)<br />
591-290=301, Q=(1380)<br />
301-290=11, Q=(1390), R=11</p>
	<p>The logspaciousness resides in the fact that once you&#8217;ve completed a step, you can erase everything in the step above it &#8212; think of it as alternating between two blackboards.</p>
	<p>So what am I missing?
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Conquering divide by: Jonathan Katz</title>
		<link>http://bit-player.org/2007/conquering-divide#comment-1504</link>
		<pubDate>Thu, 11 Oct 2007 11:44:27 +0000</pubDate>
		<guid>http://bit-player.org/2007/conquering-divide#comment-1504</guid>
					<description>This post leads me to wonder...how is division done on real computers? (I.e., how is division handled by a C compiler or, better yet, how is division handled by, e.g., the 80x86 instruction set?)</description>
		<content:encoded><![CDATA[	<p>This post leads me to wonder&#8230;how is division done on real computers? (I.e., how is division handled by a C compiler or, better yet, how is division handled by, e.g., the 80&#215;86 instruction set?)
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
