<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: “Elements of Programming” Chapter 2: Transformations and&#160;Their Orbits</title>
	<atom:link href="http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/feed/" rel="self" type="application/rss+xml" />
	<link>http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/</link>
	<description>The next generation of C++</description>
	<lastBuildDate>Mon, 30 Apr 2012 15:07:48 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Vinay Sachdev</title>
		<link>http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/comment-page-1/#comment-1863</link>
		<dc:creator>Vinay Sachdev</dc:creator>
		<pubDate>Tue, 27 Dec 2011 08:09:18 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=959#comment-1863</guid>
		<description>&lt;p&gt;In that case isn&#039;t the statement &quot;We call partial procedures that are not total nontotal.” paradoxical. Is it meant that &quot;nontotal&quot; is another name for partial procedures?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>In that case isn&#8217;t the statement &#8220;We call partial procedures that are not total nontotal.” paradoxical. Is it meant that &#8220;nontotal&#8221; is another name for partial procedures?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Parent</title>
		<link>http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/comment-page-1/#comment-468</link>
		<dc:creator>Sean Parent</dc:creator>
		<pubDate>Tue, 06 Jul 2010 17:38:23 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=959#comment-468</guid>
		<description>&lt;p&gt;The definition of domain is given at the top of page 10 along with a statement indicating that the book doesn&#039;t define it for non-homogenous functions. &quot;The &lt;em&gt;domain&lt;/em&gt; of a homogeneous functional procedure is the type of its inputs. Rather than deﬁning the domain of a nonhomogeneous functional procedure as the direct product of its input types, we refer individually to the input types of a procedure. &quot; This is a simplification to avoid the complexities of dealing with equivalent representations.&lt;/p&gt;

&lt;p&gt;Glad you&#039;re enjoying the book - the book went through several very different forms before settling on this presentation (see the Class Notes section on stepanovpapers.com). Alex frequently fills his lectures with great references to the history of mathematics (and history in general) - and they can be very obscure. Several individuals gave feedback that on the lecture notes that led Alex and Paul to settle on the more traditional form of a math text. If you enjoy the stories - make sure you watch his GCD lecture &lt;a href=&quot;http://www.stepanovpapers.com/stepanov_gcd.mov&quot; rel=&quot;nofollow&quot;&gt;http://www.stepanovpapers.com/stepanov_gcd.mov&lt;/a&gt;. (There are also more recent slides on the site and a very recent video but the latest is in Russian).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The definition of domain is given at the top of page 10 along with a statement indicating that the book doesn&#8217;t define it for non-homogenous functions. &#8220;The <em>domain</em> of a homogeneous functional procedure is the type of its inputs. Rather than deﬁning the domain of a nonhomogeneous functional procedure as the direct product of its input types, we refer individually to the input types of a procedure. &#8221; This is a simplification to avoid the complexities of dealing with equivalent representations.</p>

<p>Glad you&#8217;re enjoying the book &#8211; the book went through several very different forms before settling on this presentation (see the Class Notes section on stepanovpapers.com). Alex frequently fills his lectures with great references to the history of mathematics (and history in general) &#8211; and they can be very obscure. Several individuals gave feedback that on the lecture notes that led Alex and Paul to settle on the more traditional form of a math text. If you enjoy the stories &#8211; make sure you watch his GCD lecture <a href="http://www.stepanovpapers.com/stepanov_gcd.mov" rel="nofollow">http://www.stepanovpapers.com/stepanov_gcd.mov</a>. (There are also more recent slides on the site and a very recent video but the latest is in Russian).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Petar Marendic</title>
		<link>http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/comment-page-1/#comment-467</link>
		<dc:creator>Petar Marendic</dc:creator>
		<pubDate>Wed, 30 Jun 2010 21:52:57 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=959#comment-467</guid>
		<description>&lt;p&gt;Page 16: &quot;An operation is a homogeneous function whose codomain is equal to its domain&quot;&lt;/p&gt;

&lt;p&gt;I found this sentence doubly confusing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;the lack of any formatting on &quot;codomain&quot; and &quot;domain&quot; led me to believe that they were being used in their normal mathematical sense - which further led me to believe (due to making a long break between reading chapt 1 and chapt 2) that Codomain and Domain type functions were also defined in the same mathematical vein - an immediate inspection of the presented examples proved me false to assume that.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;and more importantly, I was surprised that the definition of the Operation concept was made so strong, again departing from the usual mathematical definition. For example,&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;double ScalarProduct(Vector v1, Vector v2);&lt;/p&gt;

&lt;p&gt;doesn&#039;t qualify as an operation, whereas&lt;/p&gt;

&lt;p&gt;double ScalarProduct(double x1, y1, x2, y2);&lt;/p&gt;

&lt;p&gt;does, even though both function represent the same idea. In my opinion, the &quot;troublesome&quot; sentence would read much better if &quot;operation&quot; was replaced with &quot;HomogeneousOperation&quot;, &quot;domain&quot; with &quot;Domain&quot; and &quot;codomain&quot; with &quot;Codomain&quot;, and all three appropriately formatted.
At this point, I&#039;m also surprised that Domain and Codomain are defined for homogeneous functions only - just ads up to the overall confusion.&lt;/p&gt;

&lt;p&gt;Also, the definition of Operation as it stands, checks three times whether Op is homogeneous if it in fact is. I&#039;m not sure if this is necessarily a bad thing, as I&#039;ve not yet seen or compiled actual C++ code using these concepts.&lt;/p&gt;

&lt;p&gt;Anyhow, a great book thus far! Though, after going through Alex&#039;s lecture notes that this book was based upon, I was expecting a bit more flavor (in form of his amusing reflections) to the text.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Page 16: &#8220;An operation is a homogeneous function whose codomain is equal to its domain&#8221;</p>

<p>I found this sentence doubly confusing:</p>

<ol>
<li><p>the lack of any formatting on &#8220;codomain&#8221; and &#8220;domain&#8221; led me to believe that they were being used in their normal mathematical sense &#8211; which further led me to believe (due to making a long break between reading chapt 1 and chapt 2) that Codomain and Domain type functions were also defined in the same mathematical vein &#8211; an immediate inspection of the presented examples proved me false to assume that.</p></li>
<li><p>and more importantly, I was surprised that the definition of the Operation concept was made so strong, again departing from the usual mathematical definition. For example,</p></li>
</ol>

<p>double ScalarProduct(Vector v1, Vector v2);</p>

<p>doesn&#8217;t qualify as an operation, whereas</p>

<p>double ScalarProduct(double x1, y1, x2, y2);</p>

<p>does, even though both function represent the same idea. In my opinion, the &#8220;troublesome&#8221; sentence would read much better if &#8220;operation&#8221; was replaced with &#8220;HomogeneousOperation&#8221;, &#8220;domain&#8221; with &#8220;Domain&#8221; and &#8220;codomain&#8221; with &#8220;Codomain&#8221;, and all three appropriately formatted.
At this point, I&#8217;m also surprised that Domain and Codomain are defined for homogeneous functions only &#8211; just ads up to the overall confusion.</p>

<p>Also, the definition of Operation as it stands, checks three times whether Op is homogeneous if it in fact is. I&#8217;m not sure if this is necessarily a bad thing, as I&#8217;ve not yet seen or compiled actual C++ code using these concepts.</p>

<p>Anyhow, a great book thus far! Though, after going through Alex&#8217;s lecture notes that this book was based upon, I was expecting a bit more flavor (in form of his amusing reflections) to the text.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Parent</title>
		<link>http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/comment-page-1/#comment-466</link>
		<dc:creator>Sean Parent</dc:creator>
		<pubDate>Thu, 11 Mar 2010 20:16:29 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=959#comment-466</guid>
		<description>&lt;p&gt;I apologize for taking a long break from this discussion (tough to have a day job). So far I believe we&#039;ve only received one submission for the exercises to chapter 2 so please e-mail your homework right away. Let&#039;s get started on Chapter 3!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I apologize for taking a long break from this discussion (tough to have a day job). So far I believe we&#8217;ve only received one submission for the exercises to chapter 2 so please e-mail your homework right away. Let&#8217;s get started on Chapter 3!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Parent</title>
		<link>http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/comment-page-1/#comment-465</link>
		<dc:creator>Sean Parent</dc:creator>
		<pubDate>Thu, 11 Mar 2010 20:11:47 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=959#comment-465</guid>
		<description>&lt;p&gt;Ad 1. It was - I was part of the discussion.&lt;/p&gt;

&lt;p&gt;Ad 5. Yes, often times preconditions cannot be checked (or cannot be checked without violating the time complexity of the function).&lt;/p&gt;

&lt;p&gt;Ad 7. From page 3 of the errata:&lt;/p&gt;

&lt;p&gt;Page 24, fourth line: Change &#092;q &gt; 0&quot; to &#092;q &gt; 0&quot; and &#092;when slow enters the
cycle&quot; to &#092;when it collides with slow&quot;. (Reported by Bob English and John
Banning.)&lt;/p&gt;

&lt;p&gt;See theorem 3.1.&lt;/p&gt;

&lt;p&gt;Ad 8. The distance between any point and itself is always 0. But the distance between the first 0 and the second is 1, the first 0 and the third  is 2... etc. If you start at the collision point and advance one step you are at the start of the orbit, and you are back to where you started.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Ad 1. It was &#8211; I was part of the discussion.</p>

<p>Ad 5. Yes, often times preconditions cannot be checked (or cannot be checked without violating the time complexity of the function).</p>

<p>Ad 7. From page 3 of the errata:</p>

<p>Page 24, fourth line: Change &#092;q &gt; 0&#8243; to &#092;q &gt; 0&#8243; and &#092;when slow enters the
cycle&#8221; to &#092;when it collides with slow&#8221;. (Reported by Bob English and John
Banning.)</p>

<p>See theorem 3.1.</p>

<p>Ad 8. The distance between any point and itself is always 0. But the distance between the first 0 and the second is 1, the first 0 and the third  is 2&#8230; etc. If you start at the collision point and advance one step you are at the start of the orbit, and you are back to where you started.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Parent</title>
		<link>http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/comment-page-1/#comment-464</link>
		<dc:creator>Sean Parent</dc:creator>
		<pubDate>Thu, 11 Mar 2010 19:26:17 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=959#comment-464</guid>
		<description>&lt;p&gt;To analyze a given seed you&#039;ll need to grab the source for rand() so you can treat rand() as a function returning it&#039;s global state. Unfortunately the C standard doesn&#039;t include access to this state.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>To analyze a given seed you&#8217;ll need to grab the source for rand() so you can treat rand() as a function returning it&#8217;s global state. Unfortunately the C standard doesn&#8217;t include access to this state.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Piotr Jachowicz</title>
		<link>http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/comment-page-1/#comment-463</link>
		<dc:creator>Piotr Jachowicz</dc:creator>
		<pubDate>Fri, 29 Jan 2010 07:11:08 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=959#comment-463</guid>
		<description>&lt;p&gt;Sorry for late reply, I was on vacation.&lt;/p&gt;

&lt;p&gt;Ad 1. I don&#039;t think the intention was to allow precondition to return not-bool. But if so, few words of comment would help to avoid confusion.&lt;/p&gt;

&lt;p&gt;Ad 2. Mathematicians usually say &quot;direct product&quot; when they mean Cartesian product empowered with default structure, like direct product of two groups, linear spaces, manifolds.&lt;/p&gt;

&lt;p&gt;Ad 5. Precondition is expressed only in comment, instead of explicit procedure.&lt;/p&gt;

&lt;p&gt;Ad 6. Sorry, I don&#039;t see any virtue in considering impossible case. In my opinion, chapter would become clearer if infinite orbit would be removed, with appropriate comment.&lt;/p&gt;

&lt;p&gt;Ad 7. Sorry, I don&#039;t see in this errata any definition correction for chapter 2. What do you mean?&lt;/p&gt;

&lt;p&gt;Ad 8. No, it cannot. Consider for example int f(int i) {return 0;} with starting x = 0. It produces constant orbit (0, 0, 0, ...), which is circular and distance between any two points of this orbit is 0. This is counterexample for last paragraph on pg 24, which says &quot;In the case of a circular orbit, h = 0, r = 0, and the distance from the collision point to the beginning of the orbit is e = 1&quot;.&lt;/p&gt;

&lt;p&gt;According to chapter 2.4, I was wrong; it is ok in case c = 1&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Sorry for late reply, I was on vacation.</p>

<p>Ad 1. I don&#8217;t think the intention was to allow precondition to return not-bool. But if so, few words of comment would help to avoid confusion.</p>

<p>Ad 2. Mathematicians usually say &#8220;direct product&#8221; when they mean Cartesian product empowered with default structure, like direct product of two groups, linear spaces, manifolds.</p>

<p>Ad 5. Precondition is expressed only in comment, instead of explicit procedure.</p>

<p>Ad 6. Sorry, I don&#8217;t see any virtue in considering impossible case. In my opinion, chapter would become clearer if infinite orbit would be removed, with appropriate comment.</p>

<p>Ad 7. Sorry, I don&#8217;t see in this errata any definition correction for chapter 2. What do you mean?</p>

<p>Ad 8. No, it cannot. Consider for example int f(int i) {return 0;} with starting x = 0. It produces constant orbit (0, 0, 0, &#8230;), which is circular and distance between any two points of this orbit is 0. This is counterexample for last paragraph on pg 24, which says &#8220;In the case of a circular orbit, h = 0, r = 0, and the distance from the collision point to the beginning of the orbit is e = 1&#8243;.</p>

<p>According to chapter 2.4, I was wrong; it is ok in case c = 1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Ruzon</title>
		<link>http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/comment-page-1/#comment-462</link>
		<dc:creator>Mark Ruzon</dc:creator>
		<pubDate>Mon, 25 Jan 2010 19:12:49 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=959#comment-462</guid>
		<description>&lt;p&gt;Thanks, Sean, that&#039;s very elegant, although reseeding every time appears to mask the behavior of an individual seed, which I am curious about.&lt;/p&gt;

&lt;p&gt;I also remembered that I had already implemented a better random number generator.  It uses the linear congruential method described in Section 3.2.1 of Donald Knuth&#039;s &lt;em&gt;The Art of Computer Programming&lt;/em&gt;.  The modulus m is 2^32 - 5 as suggested by Section 3.2.1.1 and the table in Section 4.5.4.  Unlike the behavior of rand(), this one has a fixed cycle size of 421,412,441 regardless of the seed.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks, Sean, that&#8217;s very elegant, although reseeding every time appears to mask the behavior of an individual seed, which I am curious about.</p>

<p>I also remembered that I had already implemented a better random number generator.  It uses the linear congruential method described in Section 3.2.1 of Donald Knuth&#8217;s <em>The Art of Computer Programming</em>.  The modulus m is 2^32 &#8211; 5 as suggested by Section 3.2.1.1 and the table in Section 4.5.4.  Unlike the behavior of rand(), this one has a fixed cycle size of 421,412,441 regardless of the seed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Parent</title>
		<link>http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/comment-page-1/#comment-461</link>
		<dc:creator>Sean Parent</dc:creator>
		<pubDate>Mon, 25 Jan 2010 18:53:24 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=959#comment-461</guid>
		<description>&lt;p&gt;If you want to do a serious analysis of your random number generator you will need the sources - then you can treat rand() as an action on it&#039;s own global state. A decent way to simulate that for this exercise is to analyze the following:&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;
int random(int x) {
    srand(x);
    return rand();
}
&lt;/pre&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>If you want to do a serious analysis of your random number generator you will need the sources &#8211; then you can treat rand() as an action on it&#8217;s own global state. A decent way to simulate that for this exercise is to analyze the following:</p>

<p><pre>
int random(int x) {
    srand(x);
    return rand();
}
</pre></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Ruzon</title>
		<link>http://cpp-next.com/archive/2010/01/%e2%80%9celements-of-programming%e2%80%9d-chapter-2-transformations-and-their-orbits/comment-page-1/#comment-460</link>
		<dc:creator>Mark Ruzon</dc:creator>
		<pubDate>Mon, 25 Jan 2010 05:53:30 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=959#comment-460</guid>
		<description>&lt;p&gt;I&#039;m having a problem with Exercise 2.5 on random number generators.  Since rand() takes no arguments, the only way I see to find the collision point is to have a function object that reseeds the random number generator and generates random numbers until the argument is found, and then return the random number after that.  This is O(N^2).  Anybody know a faster way?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;m having a problem with Exercise 2.5 on random number generators.  Since rand() takes no arguments, the only way I see to find the collision point is to have a function object that reseeds the random number generator and generates random numbers until the argument is found, and then return the random number after that.  This is O(N^2).  Anybody know a faster way?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

