<?xml version='1.0' encoding='iso-8859-1'?>
<rss version='2.0'>
   <channel>
      <title>Featured Topics at Dream.In.Code</title>
      <link>http://www.dreamincode.net/forums</link>
      <description>Web Development, Programming, and Coding Community. Browse forums, snippets, and tutorials to get you on the right track. Experts in C++, PHP, VisualBasic, HTML, JavaScript, ColdFusion, and more!</description>
         <item>
            <link>http://www.dreamincode.net/forums/topic/323158-dress-code-at-workin-it-of-course/</link>
            <title>Dress Code At Work(in IT Of Course)</title>
            <description>&amp;quot;If you look back fifty years, every picture you see of a computer programmer boasts an outfit with a white shirt and a thin black tie. Fast forward to today, and you&amp;#39;re as likely to see someone in an Adventure Time t-shirt and shorts as a suit and tie.&lt;br /&gt;
&lt;br /&gt;
Does the dress make the man/woman, or is it almost a requirement for the most talented of the geeks to go ultracasual? What do you wear to work, and why?</description>
			<category>Caffeine Lounge</category>
			<pubDate>Mon, 17 Jun 2013 22:28:10 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/323095-programming-languages-now-and-then/</link>
            <title>Programming Languages - Now And Then</title>
            <description>I&amp;#39;m interested in people&amp;#39;s current predictions on what will happen to the various languages over the next few years.&lt;br /&gt;
&lt;br /&gt;
Java has had a bad press in recent years but has a major new release. Is this a new lease of life, particularly with Android taking off so rapidly?&lt;br /&gt;
C++ questions seem second only to Java in popularity here, but perhaps this is due more to college curricula rather than an indicator of current widespread use?&lt;br /&gt;
C# questions are not as frequent as I would have anticipated. Is this a sign?&lt;br /&gt;
&lt;br /&gt;
In particular, which languages are likely to become more popular?</description>
			<category>Corner Cubicle</category>
			<pubDate>Sun, 16 Jun 2013 18:35:42 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/323069-computer-science-cheat-sheet-your-requests/</link>
            <title>Computer Science Cheat Sheet- Your Requests</title>
            <description>A lot of our language forums have &lt;a href='http://www.dreamincode.net/forums/topic/17946-java-quick-reference-cheat-sheet/' class='bbc_url' title='External link' rel='external'&gt;cheat sheets&lt;/a&gt;. I figure it&amp;#39;s probably time for Computer Science to have a cheat sheet as well. Below are some of my ideas. Does anyone have additional input for content to put on the cheat sheet? &lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Note:&lt;/strong&gt; A Cheat Sheet isn&amp;#39;t a bulky tutorial on various data structures, etc. It&amp;#39;s more comparable to a quick reference sheet or couple of pages at the front of a textbook. &lt;br /&gt;
&lt;br /&gt;
-Logic/Set Theory &lt;ul class='bbc'&gt;&lt;li&gt; And/Intersection&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Or/Union&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Negation/Complementary Sets&lt;br /&gt;&lt;/li&gt;&lt;li&gt; XOR/Symmetric Difference&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Implication/Biconditionals&lt;br /&gt;&lt;/li&gt;&lt;li&gt; DeMorgan&amp;#39;s Rule, Idempotent Law, etc.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Set Difference&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Quantifiers&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
-Number Theory &lt;ul class='bbc'&gt;&lt;li&gt; Basic Congruences&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Quotient Remainder Theorem&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Euclidean Algorithm&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Definition of Co-prime&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Definition of Modular Inverse&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Chinese Remainder Theorem&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Pidgeonhole Principle&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Fermat&amp;#39;s Little Theorem&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
-Computational Complexity Theory &lt;ul class='bbc'&gt;&lt;li&gt; Big-Oh, Big-Omega, Big-Theta (Definitions, examples)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
-Sorting Algorithms (1-2 sentence description, pseudo-code, Big-Oh) &lt;ul class='bbc'&gt;&lt;li&gt; Bubble&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Selection&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Insertion&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Merge&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Quick&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Heap&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Radix&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
-Series: &lt;ul class='bbc'&gt;&lt;li&gt; Geometric Series&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Harmonic Series&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Telescoping Series&lt;/li&gt;&lt;/ul&gt;</description>
			<category>Computer Science</category>
			<pubDate>Sun, 16 Jun 2013 04:26:15 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/323063-linear-algebra-primer-part-5-linear-transformations/</link>
            <title>Linear Algebra Primer: Part 5- Linear Transformations</title>
            <description>&lt;strong class='bbc'&gt;Linear Algebra Primer: Part 5- Linear Transformations&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Linear Transformations are at the heart of many applications of Linear Algebra, most notably game and graphics programming. The CSS specification even describes Linear Transformations for many common formatting techniques like italicization or scaling fonts. This tutorial will introduce the concepts of Linear Transformations, as well as using matrices to represent transformation. In support of these concepts, defining vectors in terms of bases will also be discussed.&lt;br /&gt;
&lt;br /&gt;
Attached is a typeset copy:&lt;br /&gt;
[attachment=33275:Linear_Algebra_Part5_Tutorial.pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Defining a Linear Transformation&lt;/strong&gt;&lt;br /&gt;
A Linear Transformation is a function that operates on Vector Spaces, with the two following properties: &lt;ul class='bbc'&gt;&lt;li&gt; T(&lt;strong class='bbc'&gt;x&lt;/strong&gt; + &lt;strong class='bbc'&gt;y&lt;/strong&gt;) = T(&lt;strong class='bbc'&gt;x&lt;/strong&gt;) + T(&lt;strong class='bbc'&gt;y&lt;/strong&gt;)&lt;br /&gt;&lt;/li&gt;&lt;li&gt; T(c&lt;strong class='bbc'&gt;x&lt;/strong&gt;) = cT(&lt;strong class='bbc'&gt;x&lt;/strong&gt;) (c is a constant in the Field)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to prove a function is a linear transformation, it is only necessary to show that the above properties hold. Consider some familiar linear transformations: the derivative and integral. &lt;br /&gt;
&lt;br /&gt;
Let &lt;span class=&quot;inlinecode&quot;&gt;T: P&lt;sub class='bbc'&gt;3&lt;/sub&gt;&amp;reg; -&amp;gt; P&lt;sub class='bbc'&gt;3&lt;/sub&gt;&amp;reg;&lt;/span&gt; by the transformation &lt;span class=&quot;inlinecode&quot;&gt;T(f(x)) = f&amp;#39;(x)&lt;/span&gt;. Since a derivative is a limit, &lt;span class=&quot;inlinecode&quot;&gt;(f(x) + g(x))&amp;#39; = f&amp;#39;(x) + g&amp;#39;(x)&lt;/span&gt; by the limit rules. Similarly, scalar constants can be pulled out front by the limit rules, so &lt;span class=&quot;inlinecode&quot;&gt;(kf(x))&amp;#39; = kf&amp;#39;(x)&lt;/span&gt;. Thus, &lt;span class=&quot;inlinecode&quot;&gt;T&lt;/span&gt; is a linear transformation. The proof to show an integral holds as a linear transformation works in essentially the same manner.&lt;br /&gt;
&lt;br /&gt;
In contrast, it would be easy to show that &lt;span class=&quot;inlinecode&quot;&gt;T: &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt; -&amp;gt; &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;&lt;/span&gt; defined by &lt;span class=&quot;inlinecode&quot;&gt;T(a, b) = (3a, 3b) + (1, 1)&lt;/span&gt; is not a linear transformation, as &lt;span class=&quot;inlinecode&quot;&gt;T(a + c, b + d) = (3(a+c), 3(b+d)) + (1, 1)&lt;/span&gt;, which is not equal to &lt;span class=&quot;inlinecode&quot;&gt;T(a, b) + T(c, d) = 3(a + c, b + d) + (2, 2)&lt;/span&gt;. So any transformation that appends constants to the resultant vectors fails to constitute a linear transformation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Vectors as Basis Coordinates&lt;/strong&gt;&lt;br /&gt;
Before proceeding to evaluating linear transformations as matrices, it is first important to understand how to treat vectors as coordinates with respect to bases. First, let&amp;#39;s introduce the term ordered basis. An ordered basis simply orders the elements, which is important in treating a vector as a coordinate. Consider the (x, y) plane. In (x, y) coordinates, the x-coordinate comes first and the y-coordinate comes second. So an ordered basis for &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt; would be &lt;span class=&quot;inlinecode&quot;&gt;{(0, 1), (1, 0)}&lt;/span&gt;. This means that an (x, y) coordinate represents the linear combination &lt;span class=&quot;inlinecode&quot;&gt;x * (1, 0) + y * (0, 1)&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
Similarly, if the mapping of &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt; was done using (y; x) coordinates, then the ordered basis would be &lt;span class=&quot;inlinecode&quot;&gt;{(0, 1), (1, 0)}&lt;/span&gt; with the vectors written in terms of &lt;span class=&quot;inlinecode&quot;&gt;y * (0, 1) + x * (1, 0)&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
Consider one nal example with a non-standard basis for &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;: &lt;span class=&quot;inlinecode&quot;&gt;B = {(2, 1), (1, 3)}&lt;/span&gt;. Now let&amp;#39;s write &lt;span class=&quot;inlinecode&quot;&gt;(5, 4)&lt;/span&gt; in terms of &lt;span class=&quot;inlinecode&quot;&gt;B&lt;/span&gt;. So &lt;span class=&quot;inlinecode&quot;&gt;(5, 4) = x * (2, 1) + y * (1, 3)&lt;/span&gt;. &lt;br /&gt;
&lt;br /&gt;
This equation can also be written in the form:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
|2 1| |x| = |5|
|1 3| |y|   |4|
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Solving for the (x, y) vector yields the result &lt;span class=&quot;inlinecode&quot;&gt;1/5 * (11, 3)&lt;/span&gt;. So &lt;span class=&quot;inlinecode&quot;&gt;(5, 4)&lt;/span&gt; is expressed as &lt;span class=&quot;inlinecode&quot;&gt;1/5 * (11, 3)&lt;/span&gt; when using the basis &lt;span class=&quot;inlinecode&quot;&gt;B&lt;/span&gt; rather than the standard basis for &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Linear Transformations as Matrices&lt;/strong&gt;&lt;br /&gt;
Linear Transformations (in the form &lt;span class=&quot;inlinecode&quot;&gt;T(&lt;strong class='bbc'&gt;v&lt;/strong&gt;) = &lt;strong class='bbc'&gt;x&lt;/strong&gt;)&lt;/span&gt; can be represented as matrices in the form: &lt;span class=&quot;inlinecode&quot;&gt;A&lt;strong class='bbc'&gt;v&lt;/strong&gt; = &lt;strong class='bbc'&gt;x&lt;/strong&gt;&lt;/span&gt;. So through matrix multiplication, &lt;strong class='bbc'&gt;v&lt;/strong&gt; is mapped to &lt;strong class='bbc'&gt;x&lt;/strong&gt;. This representation provides a number of tools for analyzing linear transformations with regards to topics like invertibility, isomorphisms, and eigentheory, which will be covered in later tutorials.&lt;br /&gt;
&lt;br /&gt;
The first step however is to discuss how to represent a linear transformation as a matrix. For any vector space, there are often times an infinite number of bases, and the matrix representation is dependent on the bases used. Specifically, the matrix takes the basis vectors for the domain&amp;#39;s basis, and transforms them into vectors based on the codomain&amp;#39;s basis. Remember that basis vectors are analogous to coordinate axes, so think about the transformation matrix as mapping points from one vector space using the standard (American) system to another vector space using the metric system. The basis vectors just provide units of measurement.&lt;br /&gt;
&lt;br /&gt;
This matrix can be determined quite algorithmically. The first step is to take a basis vector and transform it, so find &lt;span class=&quot;inlinecode&quot;&gt;T(D&lt;sub class='bbc'&gt;i&lt;/sub&gt;)&lt;/span&gt; for basis D. Next, write &lt;span class=&quot;inlinecode&quot;&gt;T(D&lt;sub class='bbc'&gt;i&lt;/sub&gt;)&lt;/span&gt;, the vector in the codomain, in terms of the codomain basis. So if there are bases D (domain) and C (Codomain), the transformation matrix can be written as &lt;span class=&quot;inlinecode&quot;&gt;[T]&lt;sub class='bbc'&gt;D&lt;/sub&gt;&lt;sup class='bbc'&gt;C&lt;/sup&gt;&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s look at an example. Consider the transformation &lt;span class=&quot;inlinecode&quot;&gt;T: &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt; -&amp;gt; &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;3&lt;/sup&gt;&lt;/strong&gt;&lt;/span&gt; by &lt;span class=&quot;inlinecode&quot;&gt;T(a, b) = (a + 2b, b, 2a + b)&lt;/span&gt; with the bases &lt;span class=&quot;inlinecode&quot;&gt;D (Domain) = {(1, 3), (2, 1)}&lt;/span&gt; and &lt;span class=&quot;inlinecode&quot;&gt;C = {(1, 0, 0), (0, 1, 0), (0, 0, 1)&lt;/span&gt;. &lt;br /&gt;
&lt;br /&gt;
The first step is to transform in the first basis vector in D, which leaves &lt;span class=&quot;inlinecode&quot;&gt;T(1, 3) = (7, 3, 5)&lt;/span&gt;. As C is the standard basis for &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;3&lt;/sup&gt;&lt;/strong&gt;, the resultant of the transformation will not need to be rewritten. &lt;br /&gt;
&lt;br /&gt;
The second basis vector in D, when transformed, leaves &lt;span class=&quot;inlinecode&quot;&gt;T(2, 1) = (4, 1, 5)&lt;/span&gt;. Thus, &lt;span class=&quot;inlinecode&quot;&gt;A = [T]&lt;sub class='bbc'&gt;D&lt;/sub&gt;&lt;sup class='bbc'&gt;C&lt;/sup&gt;&lt;/span&gt; can be written as follows:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
7  4
3  1
5  5
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Notice that when evaluating: &lt;span class=&quot;inlinecode&quot;&gt;A * (1, 0) = (7, 3, 5)&lt;/span&gt;, which is the result of &lt;span class=&quot;inlinecode&quot;&gt;T(1, 3)&lt;/span&gt;. The reason that &lt;span class=&quot;inlinecode&quot;&gt;(1, 0)&lt;/span&gt; is used is because it is written in terms of the basis vectors for D. Thus, &lt;span class=&quot;inlinecode&quot;&gt;(1, 0)&lt;/span&gt; is a point along the axes (basis vectors in D). Another way of saying this is that &lt;span class=&quot;inlinecode&quot;&gt;(1, 0)&lt;/span&gt; contains the coefficients of the linear equation: &lt;span class=&quot;inlinecode&quot;&gt;1(1, 3) + 0(2, 1)&lt;/span&gt;. This is an important point to remember when both developing and using transformation matrices. When the standard basis is not used, vectors will have to be rewritten in terms of &amp;quot;units&amp;quot; of the basis vectors used. Thus, &lt;span class=&quot;inlinecode&quot;&gt;(1, 0)&lt;/span&gt; is one unit of &lt;span class=&quot;inlinecode&quot;&gt;(1, 3)&lt;/span&gt; and zero units of &lt;span class=&quot;inlinecode&quot;&gt;(2, 1)&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Composite Transformations&lt;/strong&gt;&lt;br /&gt;
Often times, composite transformations are necessary to achieve a desired result. Throughout prior algebra and calculus classes, it is common to see composite functions such as &lt;span class=&quot;inlinecode&quot;&gt;f(g(x))&lt;/span&gt;. The notation is the same with linear transformations. It also follows that since the matrices can be used to represent linear transformations, matrix multiplication can be used to achieve the transformations. Since matrix multiplication is not commutative, the order of the matrices matters in the matrix representation of composite transformations. The rule is that the inner function&amp;#39;s matrix goes to the right of the outer function&amp;#39;s matrix. So T(U(&lt;strong class='bbc'&gt;v&lt;/strong&gt;)) is represented by [T][U], where [T] and [U] are the matrix representations&lt;br /&gt;
of the respective linear transformations.&lt;br /&gt;
&lt;br /&gt;
Consider scaling in two dimensions. So the transformation would look something like what is below.  &lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
|a b| * |x|
|c d|   |y|
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
What would the final matrix look like if the intent was to scale the x-coordinate by 2 and the y-coordinate by 3? Let&amp;#39;s look at these as two distinct transformations- scaling the x-coordinate by 2, and scaling the y-coordinate by 3.&lt;br /&gt;
&lt;br /&gt;
Consider the transformation &lt;span class=&quot;inlinecode&quot;&gt;T(x, y) = (2x, y)&lt;/span&gt;, which scales the x-coordinate by 2. Using the standard basis for &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt; (which is &lt;span class=&quot;inlinecode&quot;&gt;{(1, 0), (0, 1)}&lt;/span&gt;, the matrix for T can be derived by plugging in the basis vectors. So:&lt;br /&gt;
T(1, 0) = (2, 0)&lt;br /&gt;
T(0, 1) = (0, 1)&lt;br /&gt;
&lt;br /&gt;
Thus, the matrix is:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
|2 0|
|0 1|
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Similarly, the matrix for scaling the y-coordinate by 3 would look like:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
|1 0|
|0 3|
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Multiplying these two matrices produces a transformation matrix that scales the x-coordinate by 2 and the y-coordinate by 3. Both the intermediate and final matrices are written in terms of the standard basis for &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;. So the final matrix is:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
|2 0|
|0 3|
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Applying this logic to a more general case, the &lt;span class=&quot;inlinecode&quot;&gt;A&lt;sub class='bbc'&gt;ii&lt;/sub&gt;&lt;/span&gt; entry in the transformation matrix is used to scale the &lt;span class=&quot;inlinecode&quot;&gt;ith&lt;/span&gt; component in the vector. This has clear and direct applications to scaling images.&lt;br /&gt;
&lt;br /&gt;
Another type of transformation is the skew-symmetric transformation. Visually, this transformation would change a square or rectangle into a parallelogram. The rule for a skew-symmetric transformation is that the matrix representation of the transformation U, call it [U], is equal to -[U]&lt;sup class='bbc'&gt;T&lt;/sup&gt;, which represents the transpose of the matrix. Thus, [U]&lt;sub class='bbc'&gt;ij&lt;/sub&gt; = -[U]&lt;sub class='bbc'&gt;ji&lt;/sub&gt;. An application of this transformation would&lt;br /&gt;
be italicizing fonts. So now linear algebra provides toolsets for scaling and italicizing text.&lt;br /&gt;
&lt;br /&gt;
Finally, consider rotation in &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;. The rotation matrix is in the form:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
|cos(t)  -sin(t)|
|sin(t)   cos(t)|
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
From basic trig, it is known that x = cos(t) and y = sin(t) on the unit circle. Thus, the transformation matrix, aplied to the first vector in the standard basis for &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;.&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
|a  b| * |1| = |cos(t)|
|c  d|   |0|   |sin(t)|
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
This forces a = cos(t) and c = sin(t). Applying the transformation matrix to &lt;span class=&quot;inlinecode&quot;&gt;(0, 1)&lt;/span&gt;, the second vector in the standard basis for &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;, yields b = -sin(t) and d = cos(t). Thus, the transformation matrix.</description>
			<category>Software Development Tutorials</category>
			<pubDate>Sun, 16 Jun 2013 02:12:55 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322932-link-understanding-algebras-and-haskell/</link>
            <title>[Link] Understanding Algebras And Haskell</title>
            <description>I found this article quite intriguing. It discusses F-Algebras and really hits at the lower-levels of what constitutes an algebra. It&amp;#39;s neat that it brings it back to Haskell so nicely. This should hopefully be a fun read for any of the math enthusiasts&amp;#33;&lt;br /&gt;
&lt;br /&gt;
&lt;a href='https://www.fpcomplete.com/user/bartosz/understanding-algebras' class='bbc_url' title='External link' rel='external'&gt;https://www.fpcomple...anding-algebras&lt;/a&gt;</description>
			<category>Functional Programming</category>
			<pubDate>Thu, 13 Jun 2013 05:05:08 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322888-is-playstation-4-the-future-for-xna-developers/</link>
            <title>Is Playstation 4 The Future For XNA Developers?</title>
            <description>So in a role-reversal from last gen, it&amp;#39;s looking increasingly as though Sony are the champion of indie game development. We don&amp;#39;t yet know the process for sign-up, but the current rumor (according to neogaf) is that PSM (playstation mobile) games will be compatible with the indie games platform on PS4. Adding some weight to that argument is the recent announcement that dualshock 3 support has been added to PSM. &lt;br /&gt;
&lt;br /&gt;
Also keep in mind that both Transistor (Super Giant Games) and Mercenary Kings - two games announced as part of PS4&amp;#39;s initial indie offering - were written in C# and use Monogame (the open source version of XNA) for their Steam/PC releases. &lt;br /&gt;
&lt;br /&gt;
Time will tell exactly how open the platform is in terms of self-publishing, but I tend to think this is a promising development, and potentially the shot in the arm monogame needed to raise its credibility.</description>
			<category>XNA</category>
			<pubDate>Wed, 12 Jun 2013 14:39:04 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322791-challenge-new-facebook-banner-image/</link>
            <title>Challenge: New Facebook Banner Image</title>
            <description>Folks,&lt;br /&gt;
&lt;br /&gt;
It&amp;#39;s been brought to my attention - numerous amounts of times - that our &lt;a href='https://www.facebook.com/dreamincode' class='bbc_url' title='External link' rel='external'&gt;facebook&lt;/a&gt; header image is a bit.. dated.  (One internet gold star if you know why&amp;#33;)  What I am looking to do is replace that old image with something new &lt;span style='color: #808080'&gt;(*cough* less depreciated code */cough*)&lt;/span&gt; and generally jazz up the header&amp;#33;  &lt;br /&gt;
&lt;br /&gt;
I know we enjoy the Signature of the Month I thought it could be fun to turn this over to the community as well.  Be it a: collage, original drawing, picture, 3d rendering, or so on.  Let your creative juices surge and gin up something you believe encapsulates DreamInCode.  &lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;&lt;span class='bbc_underline'&gt;The rules:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
1.  It must be jpg or png.  &lt;br /&gt;
2.  No bigger than: 960px × 720px, and no smaller than 851px x 315px.  &lt;br /&gt;
3.  Let&amp;#39;s keep the profanity* and obscenity* to a minimum.&lt;br /&gt;
&lt;span style='color: #808080'&gt;&lt;em class='bbc'&gt;* both determined by me.  &lt;img src='http://cdn.dreamincode.net/forums/public/style_emoticons/&lt;#EMO_DIR#&gt;/wink2.gif' class='bbc_emoticon' alt=';)' /&gt;/&amp;gt; &lt;/em&gt; &lt;/span&gt;&lt;br /&gt;
4.  No need to add your user name to the image - we&amp;#39;ll thank you when the image is uploaded.  &lt;br /&gt;
5.  You understand if your image is picked you give us permission to to use the image - including uploading the image to the facebook site for all to view and we may not never, ever, for-EVER take it down.  (Even if you ask&amp;#33;)&lt;br /&gt;
6.  The winner will be determined by a secret cabal and I.. but said secret cabal is influenced by public opinion - so feel free to comment your likes or dislikes as the entries flow in&amp;#33;&lt;br /&gt;
7.  Let&amp;#39;s make this due a month out.. so &lt;strong class='bbc'&gt;due: July 10th&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
Winning the contest not only has *your* work out for the world to see, but you&amp;#39;ll get a special awards badge for your profile&amp;#33;  Take a shot, give it a whirl, and let your perspective flow.&lt;br /&gt;
&lt;br /&gt;
&lt;em class='bbc'&gt;Please post a link to the image or just directly upload the image to this thread.&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style='font-size: 21px;'&gt;&lt;strong class='bbc'&gt;Good luck&amp;#33;  &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em class='bbc'&gt;FAQ:&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class='bbc_underline'&gt;Things that are *not* required (but if you want to use them then go a head)&lt;/span&gt;&lt;br /&gt;
&lt;ul class='bbc'&gt;&lt;li&gt;Referencing &amp;#39;Dream In Code&amp;#39;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Site colors&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The content, look, feel, and so on does not need to conform to the existing image&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class='bbc_underline'&gt;Exiting Image:&lt;/span&gt;&lt;br /&gt;
&lt;div class='bbc_spoiler'&gt;
	&lt;span&gt;Spoiler&lt;/span&gt; &lt;input type='button' class='bbc_spoiler_show' value='Show' /&gt;
	&lt;div class='bbc_spoiler_wrapper'&gt;&lt;div class='bbc_spoiler_content' style=&quot;display:none;&quot;&gt;&lt;br /&gt;
[attachment=33248:post-91103-137089957395.jpg]&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href='https://www.facebook.com/dreamincode' class='bbc_url' title='External link' rel='external'&gt;Existing Image in situ.&lt;/a&gt;</description>
			<category>Graphic Design</category>
			<pubDate>Tue, 11 Jun 2013 02:41:06 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/index.php?automodule=blog&amp;blogid=847&amp;showentry=4479</link>
            <title>Which Math Course(s) Should I Take?</title>
            <description>There are a lot of threads asking about math courses to take, so I figured it was time to put together a blog entry on this. I&amp;#39;m making the assumption that you, the reader, are some sort of an IT or CS major, so I&amp;#39;m starting at Calculus and moving my way up. This isn&amp;#39;t a complete or comprehensive list of math courses commonly available to undergraduates, but this is my opinion of a set of course that a well-rounded computer scientist will find of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Calc I-II&lt;/strong&gt;: These classes cover differential and integral calculus, as well as series and sequences on most occasions. These courses should provide a good foundation to understanding rates, changes, motion, basic optimization on the real numbers, and some basic modeling. When working with a lot of dynamical systems or moving objects, it&amp;#39;s important to understand calculus. &lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Multivariable Calculus&lt;/strong&gt;- This class covers calculus on two or more variables. Topics covered include partial derivatives and multiple integrals. Weaker courses may cover series and sequences, and stronger courses focus on topics like Stokes Theorem, Green&amp;#39;s Theorem, and Divergence Theorem. Economists, Mathematicians, and Engineers need this course, and it is helpful for computer scientists focusing on graphics or scientific computing.&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Differential Equations&lt;/strong&gt;- This class covers solving equations with derivatives (usually ordinary differential equations), which is extremely helpful for modeling pretty much any system with changing variables. The topics are very applicable to graphics programming, scientific computing, numerical methods, and dynamical systems. This is a very important class for computer scientists, amongst other majors.&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Linear Algebra&lt;/strong&gt;- I highly recommend a strong linear algebra class to anyone. Linear Algebra has applications everywhere, including numerical methods, scientific computing, mathematical modeling, graph theory, and graphics programming. Make sure to take a strong, abstract and proofs-based version to really get a good flavor. It has been my experience that classes solely focused on number crunching don&amp;#39;t encourage a lot of thinking, which isn&amp;#39;t as beneficial to a computer scientist (or anyone really) as a class that forces one to think. The other benefit of Linear Algebra is that it introduces rigorous proof-writing, for those who may not have previously taken a formal proof-writing course.&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Discrete Math&lt;/strong&gt;- This class is often times taught as a survey class, based on the professor&amp;#39;s interests. You will almost always learn something new repeating this course at a different school or with a different professor. Topics are generally relevant to computer science, and may include logic, set theory, Boolean algebras, computational complexity, number theory, graph theory, combinatorics, languages, proof by induction, and discrete probability. This is another staple course for computer scientists.&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Number Theory&lt;/strong&gt;- Number Theory is the study of the integers. Topics include primality, primitive roots, quadratic reciprocity, factoring, and more. Number Theory is applied in the context of cryptography, so this is a very relevant course for computer scientists. This course is similar to Linear Algebra in the fact that it introduces proof-writing to those who may not have seen it before. Unlike Linear Algebra, however, Number Theory stresses proof by induction.&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Combinatorics and Graph Theory&lt;/strong&gt;- Combinatorics and Graph Theory covers a wide mix of topics. Combinatorial topics include combinations, permutations, inclusion-exclusion, recurrence relations, generating functions, and combinatorial proofs. Graph Theory topics generally include coloring, cliques, trees, network flow, path-finding, and combinatorial optimization. This course will provide a strong foundation for upper-level classes like algorithm analysis, formal languages, compilers, artificial intelligence, and game theory, so I highly recommend taking it.</description>
			<category>Macosxnerd101&#39;s Blog</category>
			<pubDate>Mon, 10 Jun 2013 05:41:00 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322601-simple-arithmetic-program/</link>
            <title>Simple Arithmetic Program</title>
            <description>Today I will be presenting a nice simple little program that will conduct addition, subtraction, multiplication, and division on two integers that have been chosen by the user.  I will take it step by step as to help beginners learn the process of design.  I am by no means a professional but I wanted to contribute what I could to this forum.  It has been more than helpful to me in my education and my development as a computer science student.  Dream in Code RULES&amp;#33;&amp;#33;&amp;#33;&amp;#33;&lt;br /&gt;
&lt;br /&gt;
Step 1:&lt;br /&gt;
&lt;br /&gt;
I&amp;#39;m sure with most code editors the first program you will ever see is this fun little &amp;gt; 10 line chunk of code here:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
#include &amp;lt;iostream&amp;gt;

using namespace std;

int main()
{
    cout &amp;lt;&amp;lt; &amp;quot;Hello world&amp;#33;&amp;quot; &amp;lt;&amp;lt; endl;
    return 0;
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
As simplistic as this &amp;quot;program&amp;quot; is, I thought this was the coolest thing ever when I saw it for the first time last semester.  I made my computer talk with a pop up window on my desktop&amp;#33;  What else could I make my computer do?&lt;br /&gt;
&lt;br /&gt;
Step 2:&lt;br /&gt;
&lt;br /&gt;
Now let&amp;#39;s go a step further.  Let&amp;#39;s do some math&amp;#33; &lt;br /&gt;
     - To begin take out your cout hello world line....&lt;br /&gt;
     - Replace that line with&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
cout &amp;lt;&amp;lt; &amp;quot;Enter two numbers you want to perform addition, subtraction, multiplication,  and division on:&amp;quot; &amp;lt;&amp;lt; endl;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Not much has changed.  You are still telling the your program to output text with &amp;quot;cout &amp;lt;&amp;lt;&amp;quot;.  Except this time, we are asking the user to do something.  We want them to input two integers to begin our arithmetic.  How do we save those responses?  Well...instead of outputting information with cout....we could &lt;strong class='bbc'&gt;TAKE IN&lt;/strong&gt; information with &lt;strong class='bbc'&gt;cin &amp;gt;&amp;gt;&lt;/strong&gt;.&lt;br /&gt;
     -Right below your new cout line, place this code.&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
double x, y;
cin &amp;gt;&amp;gt; x &amp;gt;&amp;gt; y;
&lt;/pre&gt;&lt;br /&gt;
     - We have told our compiler that the user is inputting two double numbers, x and y.&lt;br /&gt;
     - A double number is taken out multiple decimal places (great for division).&lt;br /&gt;
     - Take note that the above is the same thing as:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
double x;
double y;
cin &amp;gt;&amp;gt; x;
cin &amp;gt;&amp;gt; y;
&lt;/pre&gt;&lt;br /&gt;
     - Notice how much more efficient the first code was.  Why waste time typing all of that (2nd code)?&lt;br /&gt;
&lt;br /&gt;
Step 3:&lt;br /&gt;
Now we need to perform our operations with the numbers provided to us.  How do we add, subtract, etc?  This is a good time to introduce functions.  Think of a C++ program as a house; inside that house are rooms with shut bedroom doors and living rooms.  Think of the living rooms as the main () function and the bedrooms as our other functions.  Inside of those bedrooms there are instructions doing their own thing and don&amp;#39;t care what their housemates are doing outside their room.  Let&amp;#39;s see what is going on in the addition room.&lt;br /&gt;
     -Above the main function but below using namespace std; Type the following:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
double add(double a, double b)
{
  double r;
  r = a + b;
  return (r);
}
&lt;/pre&gt;&lt;br /&gt;
     - double is the &amp;quot;type&amp;quot; of our function&lt;br /&gt;
     - add is simply the &amp;quot;name&amp;quot; of our function&lt;br /&gt;
     - the items inside of the (....) are our parameters (allow us to pass arguments to the function when it is called)&lt;br /&gt;
What does that stuff inside the {} mean?  Well, we are saying that a double (integer) r exists.  We are also saying that r is equal to a + b.  I.E one number plus another number.  Finally, we are saying, &amp;quot;spit out the answer&amp;quot; with return r; when we ask for it.  I bet you can think of what we are going to do for subtraction and the rest.&lt;br /&gt;
&lt;br /&gt;
Step 4:&lt;br /&gt;
&lt;br /&gt;
Below the addition function finish up by coding in the other functions:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
double subtract(double a, double b)
{
	double r;
	r = a - b;
	return (r);
}

double multiply(double a, double b)
{
	double r;
	r = a * b;
	return (r);
}

double divide(double a, double b)
{
	double r;
	r = a / b;
	return (r);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
     -Inside all of these other rooms you may notice it is the same kind of setup as our addition.  Only our logic (arithmetic) has changed.  &lt;br /&gt;
&lt;br /&gt;
Step 5:&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s get some answers&amp;#33;  Alright, now remember the metaphor about the bedrooms?  Let&amp;#39;s pretend we are writing down some numbers (x, y) on a piece of paper and sliding them under the door to our functions.  Once inside the room our scribbled down numbers are being manipulated by the instructions.  Keep in mind the final instruction in each &amp;quot;room&amp;quot; was a return statement.  That means that the function will slip our paper under the door back to us in the living room with an answer when it is finished&amp;#33;&lt;br /&gt;
     -Type this code inside our main function below our cin &amp;gt;&amp;gt; line where we first asked for our two numbers (x, y).  &lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
cout &amp;lt;&amp;lt; &amp;quot;The result of addition is:&amp;quot; &amp;lt;&amp;lt; &amp;#91;b&amp;#93;add(x, y)&amp;#91;/b&amp;#93; &amp;lt;&amp;lt; endl;
&lt;/pre&gt;&lt;br /&gt;
     -We called our add function by &amp;quot;calling its name from the living room&amp;quot;.  We also slid it some numbers under the door.  Notice how our call is similar to &amp;quot;add (double a, double b)&amp;quot;?  The function is using our new numbers (x, y) as (a, b) so that they may be manipulated.&lt;br /&gt;
     - The process to call the other functions is the same.&lt;br /&gt;
&lt;br /&gt;
Step 6:&lt;br /&gt;
The final program....&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
#include &amp;lt;iostream&amp;gt;

using namespace std;

double add(double a, double b)
{
	double r;
	r = a + b;
	return (r);
}

double subtract(double a, double b)
{
	double r;
	r = a - b;
	return (r);
}

double multiply(double a, double b)
{
	double r;
	r = a * b;
	return (r);
}

double divide(double a, double b)
{
	double r;
	r = a / b;
	return (r);
}

int main()
{
	cout &amp;lt;&amp;lt;
		&amp;quot;Enter two numbers you want to perform addition, subtraction, multiplication,  and division on:&amp;quot;
		&amp;lt;&amp;lt; endl;

	double x, y;
	cin &amp;gt;&amp;gt; x &amp;gt;&amp;gt; y;

	cout &amp;lt;&amp;lt; &amp;quot;The result of addition is:&amp;quot; &amp;lt;&amp;lt; add(x, y) &amp;lt;&amp;lt; endl;

	cout &amp;lt;&amp;lt; &amp;quot;The result of subtraction:&amp;quot; &amp;lt;&amp;lt; subtract(x, y) &amp;lt;&amp;lt; endl;

	cout &amp;lt;&amp;lt; &amp;quot;The result of multiplication is:&amp;quot; &amp;lt;&amp;lt; multiply(x, y) &amp;lt;&amp;lt; endl;

	cout &amp;lt;&amp;lt; &amp;quot;The result of division is:&amp;quot; &amp;lt;&amp;lt; divide(x, y) &amp;lt;&amp;lt; endl;

return 0; //This tells our program to GTFO we are done with it.
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
I hope I did not bore any viewers.  The reason I drug this out so much was because, being a beginner, I know it is necessary for some people to need to see a program come together with explanations instead of slapping them with a finished product saying &amp;quot;here it is, learn&amp;quot; when they have no idea what is going on inside.  Any thoughts from professionals are welcome and please feel free to add suggested changes as I&amp;#39;m sure somewhere it could have been coded more elegantly. Though, for a simple program, I feel it is sufficient to learn some basics.&lt;br /&gt;
&lt;br /&gt;
Happy coding&amp;#33;</description>
			<category>C++ Basics</category>
			<pubDate>Fri, 07 Jun 2013 15:51:51 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322570-linear-algebra-primer-part-4-functions/</link>
            <title>Linear Algebra Primer: Part 4- Functions</title>
            <description>&lt;strong class='bbc'&gt;Linear Algebra Primer: Part 4- Functions&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial, Functions will be introduced. Much of this terminology is fairly basic, but critical to upper level mathematics, including linear algebra. Thus, this tutorial will precede the tutorial on linear transformations to provide sufficient background on functions.&lt;br /&gt;
&lt;br /&gt;
For those who would prefer to view this tutorial in a typeset format:&lt;br /&gt;
[attachment=33230:Linear_Algebra_Primer_Part4.pdf]&lt;br /&gt;
&lt;br /&gt;
Functions are introduced in lower-level mathematics, often lacking the formality. This section will add the formality and some terminology. &lt;br /&gt;
&lt;br /&gt;
A Function is a mapping between two sets, known as the Domain and Codomain. The Domain is the input set, and the Codomain is the set to which the Domain is mapped. The Range is the subset of the codomain whose elements are actually mapped. The codomain can contain unmapped elements. All functions map uniquely. That means that no element in the domain can map to more than one element in the codomain. However, a single element in the codomain can have multiple values in the domain map to it.&lt;br /&gt;
&lt;br /&gt;
Consider the following function: &lt;span class=&quot;inlinecode&quot;&gt;f: R -&amp;gt; R&lt;/span&gt;, such that &lt;span class=&quot;inlinecode&quot;&gt;f(x) = x&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/span&gt;. It&amp;#39;s easy to see why &lt;span class=&quot;inlinecode&quot;&gt;f&lt;/span&gt; is a function. Notice that the codomain is the set of real numbers. However, since the domain is limited to the real numbers, the range is set of the non-negative reals. Thus, the range is a subset of the codomain.&lt;br /&gt;
&lt;br /&gt;
Functions can also be one-to-one, onto, or both. These terms are important in developing an intuition about linear transformations, and provide a lot of tools including the isomorphisms and equivalence relations. &lt;br /&gt;
&lt;br /&gt;
A function is &lt;strong class='bbc'&gt;one-to-one&lt;/strong&gt; if for all &lt;span class=&quot;inlinecode&quot;&gt;x, y&lt;/span&gt; in the domain, &lt;span class=&quot;inlinecode&quot;&gt;f(x) = f(y)&lt;/span&gt; only when &lt;span class=&quot;inlinecode&quot;&gt;x = y&lt;/span&gt;. An example of a one-to-one function is &lt;span class=&quot;inlinecode&quot;&gt;f(x) = 5x&lt;/span&gt;. Consider as well the sets &lt;span class=&quot;inlinecode&quot;&gt;X = {A, B, C}&lt;/span&gt; and &lt;span class=&quot;inlinecode&quot;&gt;Y = {1, 2, 3, 4}&lt;/span&gt; with &lt;span class=&quot;inlinecode&quot;&gt;F: X -&amp;gt; Y&lt;/span&gt; defined by:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
F(A) = 1
F(B) = 2
F(C) = 3
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is a one-to-one function. Every element in the domain maps uniquely to an element in the codomain. Notice though that there are unmapped elements in the codomain. In a domain D, a function can have at most |D| distinct mappings, which is achieved in a one-to-one function. It makes no guarantees that all the elements in the codomain are mapped. Thus, a one-to-one function guarantees that the cardinality of the codomain is no smaller than the cardinality of the domain.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A function is considered &lt;strong class='bbc'&gt;onto&lt;/strong&gt; if all the elements in the codomain are mapped. More precisely, for all &lt;span class=&quot;inlinecode&quot;&gt;y&lt;/span&gt; in the codomain, there exists an &lt;span class=&quot;inlinecode&quot;&gt;x&lt;/span&gt; in the domain such that &lt;span class=&quot;inlinecode&quot;&gt;f(x) = y&lt;/span&gt;. Consider the example [/il]f:R -&amp;gt; R[/il] by the mapping &lt;span class=&quot;inlinecode&quot;&gt;f(x) = x&lt;sup class='bbc'&gt;3&lt;/sup&gt;&lt;/span&gt;. It is easy to see by graphing the function that it is onto, as it covers the entire real number system. However, if &lt;span class=&quot;inlinecode&quot;&gt;f&lt;/span&gt; was defined such that &lt;span class=&quot;inlinecode&quot;&gt;f:Q -&amp;gt; R&lt;/span&gt;, then the function would not be onto, as plugging in only rationals will not cover the entire set of reals. &lt;br /&gt;
&lt;br /&gt;
Consider another example with the sets &lt;span class=&quot;inlinecode&quot;&gt;X = {A, B, C}&lt;/span&gt; and &lt;span class=&quot;inlinecode&quot;&gt;Y = {1, 2, 3, 4}&lt;/span&gt; with &lt;span class=&quot;inlinecode&quot;&gt;F: Y -&amp;gt; X&lt;/span&gt;:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
F(1) = A
F(2) = B
F(3) = C
F(4) = A
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
This function is onto, as it covers the entire codomain, which is set &lt;span class=&quot;inlinecode&quot;&gt;X&lt;/span&gt;. However, it is not one-to-one. Thus, if a function is onto, then |Domain| &amp;gt;= |Codomain|. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, a function is a &lt;strong class='bbc'&gt;bijection&lt;/strong&gt; if it is both one-to-one and onto. As a one-to-one function guarantees that &lt;span class=&quot;inlinecode&quot;&gt;|Domain| &amp;lt;= |Codomain|&lt;/span&gt; and an onto function guarantees that &lt;span class=&quot;inlinecode&quot;&gt;|Domain| &amp;gt;= |Codomain|&lt;/span&gt;, a bijection guarantees that &lt;span class=&quot;inlinecode&quot;&gt;|Domain| = |Codomain|&lt;/span&gt;. For this reason, bijections are commonly used in combinatorial applications for counting. This combinatorial intuition, once developed, is highly applicable to answering questions regarding linear transformations. For now though, let&amp;#39;s introduce a couple examples of bijections. The function seen earlier &lt;span class=&quot;inlinecode&quot;&gt;f: R -&amp;gt; R&lt;/span&gt; by &lt;span class=&quot;inlinecode&quot;&gt;f(x) = x&lt;sup class='bbc'&gt;3&lt;/sup&gt;&lt;/span&gt; is a bijection. It covers all the real numbers, so it is onto, and it maps elements in the domain uniquely to elements in the codomain.&lt;br /&gt;
&lt;br /&gt;
Consider as well: &lt;span class=&quot;inlinecode&quot;&gt;f: Z -&amp;gt; Z_even&lt;/span&gt;, so mapping the integers to the even integers by &lt;span class=&quot;inlinecode&quot;&gt;f(x) = 2x&lt;/span&gt;. Even integers are defined such that &lt;span class=&quot;inlinecode&quot;&gt;n = 2x&lt;/span&gt;, where &lt;span class=&quot;inlinecode&quot;&gt;x&lt;/span&gt; is an integer. And &lt;span class=&quot;inlinecode&quot;&gt;2x = 2y&lt;/span&gt; only when &lt;span class=&quot;inlinecode&quot;&gt;x = y&lt;/span&gt;, so this function is one-to-one and onto. Looking at the function the other way, &lt;span class=&quot;inlinecode&quot;&gt;f&lt;sup class='bbc'&gt;-1&lt;/sup&gt;: Z_even -&amp;gt; Z&lt;/span&gt; by &lt;span class=&quot;inlinecode&quot;&gt;f&lt;sup class='bbc'&gt;-1&lt;/sup&gt;(y) = y/2&lt;/span&gt;, it still produces a unique integer for every even integer. Thus it can be concluded that there are as many even integers as integers. &lt;br /&gt;
&lt;br /&gt;
When dealing with Linear Transformations, infinite sets come into play, as Vector Spaces are often times infinite in cardinality, just like the integers. So it becomes important to see bijections in this manner described above. This will be discussed more in the next tutorial, however.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, let&amp;#39;s introduce the concept of &lt;strong class='bbc'&gt;invertibility&lt;/strong&gt;. A function is invertible only if it is a bijection. Let&amp;#39;s examine why this is. Consider if a function is strictly one-to-one; that is, one-to-one, but not onto. This leaves the possibility for unmapped elements in the codomain. The inverse function must map all the elements of the original codomain to elements of the original domain, by definition of a function. &lt;br /&gt;
&lt;br /&gt;
Similarly, if a function is strictly onto, then two elements in the domain can map to the same element in the codomain. So the possibility exists for &lt;span class=&quot;inlinecode&quot;&gt;f(x) = f(y)&lt;/span&gt; even if &lt;span class=&quot;inlinecode&quot;&gt;x &amp;#33;= y&lt;/span&gt;. Thus, the inverse function could map an element in the original function&amp;#39;s codomain to more than one element in the original function&amp;#39;s domain, which violates the definition of a function.&lt;br /&gt;
&lt;br /&gt;
From this analysis, in order for a function to be invertible, each element in the domain must map uniquely to an element in the codomain; and each element in the codomain must be mapped. Thus, the function must be bijective.&lt;br /&gt;
&lt;br /&gt;
So &lt;span class=&quot;inlinecode&quot;&gt;f(x) = x&lt;sup class='bbc'&gt;3&lt;/sup&gt;&lt;/span&gt; is invertible as it is bijective, but &lt;span class=&quot;inlinecode&quot;&gt;f(x) = x&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/span&gt; is not invertible, as the square root function is only defined on the domain of non-negative real numbers, thus it is not onto.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Conclusion&lt;/strong&gt;&lt;br /&gt;
I hope this tutorial has provided some structure regarding functions. These concepts will be explored throughout future tutorials on Linear Algebra, including with respect to tutorials on Linear Transformations and Eigentheory. It is very important to understand these concepts before continuing onto subsequent tutorials.</description>
			<category>Software Development Tutorials</category>
			<pubDate>Fri, 07 Jun 2013 01:23:53 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322333-three-essential-tips-for-async/</link>
            <title>Three Essential Tips For Async</title>
            <description>Video Tutorial Series by Lucian Wischik (VB.net/C# Design Team member).&lt;br /&gt;
&lt;br /&gt;
&lt;a href='http://channel9.msdn.com/Series/Three-Essential-Tips-for-Async' class='bbc_url' title='External link' rel='external'&gt;Three Essential Tips for Async&lt;/a&gt;</description>
			<category>VB.NET News And Articles</category>
			<pubDate>Mon, 03 Jun 2013 15:17:49 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322274-lambdas-are-available-java-8-snapshot/</link>
            <title>Lambdas Are Available- Java 8 Snapshot</title>
            <description>Has anyone downloaded and played around with &lt;a href='https://jdk8.java.net/lambda/' class='bbc_url' title='External link' rel='external'&gt;Project Lambda&lt;/a&gt; yet? It looks like it provides lambda support with JDK 7, in an attempt to familiarize developers for JDK 8. The &lt;a href='http://goo.gl/ZjQjm' class='bbc_url' title='External link' rel='external'&gt;Tutoracles now feature lambas&lt;/a&gt; as well. For those who develop with languages that already include lambdas, like C# or Functional languages, how do Java lambdas stack up (pun intended)? Are they on par with what you would expect? Other thoughts?&lt;br /&gt;
&lt;br /&gt;
&lt;p class='citation'&gt;Quote&lt;/p&gt;&lt;div class=&quot;blockquote&quot;&gt;&lt;div class='quote'&gt;This page provides an Early Access of OpenJDK with Lambda (JSR 335) support. The Lambda project aims to support programming in a multicore environment by adding closures and related features to the Java language&lt;br /&gt;
&lt;br /&gt;
For documentations and other details, please see the Lambda project page.&lt;br /&gt;
&lt;br /&gt;
Please note:&lt;br /&gt;
The Lambda project has used source files that are not yet available in JDK8; therefore, these early access builds are created using the latest OpenJDK 7 source repository. This project will merge into OpenJDK 8 when the source files are available.&lt;/div&gt;&lt;/div&gt;</description>
			<category>Java Advanced Discussion</category>
			<pubDate>Sun, 02 Jun 2013 17:24:57 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322237-reputation-awards-may/</link>
            <title>Reputation Awards- May</title>
            <description>Congratulations to the winners of the Reputation Awards for the month of May&amp;#33; Thanks for all your hard work in the forums, and keep up the great work&amp;#33; Let&amp;#39;s give them a round of applause&amp;#33; &lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Software Development&lt;/strong&gt;&lt;br /&gt;
&lt;a href='http://www.dreamincode.net/forums/featured.php?s=dfe50763ddda0422ec10c29dd8d986e7&amp;amp;showuser=52176' class='bbc_member __user __id52176' title='Member profile'&gt;&lt;span style='color:#00CCCC;font-weight:bold;'&gt;baavgai&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Java&lt;/strong&gt;&lt;br /&gt;
&lt;a href='http://www.dreamincode.net/forums/featured.php?s=dfe50763ddda0422ec10c29dd8d986e7&amp;amp;showuser=73490' class='bbc_member __user __id73490' title='Member profile'&gt;&lt;span style='color:#00CCCC;font-weight:bold;'&gt;pbl&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;VB6&lt;/strong&gt;&lt;br /&gt;
&lt;a href='http://www.dreamincode.net/forums/featured.php?s=dfe50763ddda0422ec10c29dd8d986e7&amp;amp;showuser=223196' class='bbc_member __user __id223196' title='Member profile'&gt;&lt;span style='color:#993399;font-weight:bold;'&gt;BobRodes&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href='http://www.dreamincode.net/forums/featured.php?s=dfe50763ddda0422ec10c29dd8d986e7&amp;amp;showuser=611423' class='bbc_member __user __id611423' title='Member profile'&gt;&lt;span style='color:#00CCCC;font-weight:bold;'&gt;andrewsw&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Game Development&lt;/strong&gt;&lt;br /&gt;
&lt;a href='http://www.dreamincode.net/forums/featured.php?s=dfe50763ddda0422ec10c29dd8d986e7&amp;amp;showuser=443549' class='bbc_member __user __id443549' title='Member profile'&gt;&lt;span style='color:#00CCCC;font-weight:bold;'&gt;ButchDean&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Assembly&lt;/strong&gt;:&lt;br /&gt;
&lt;a href='http://www.dreamincode.net/forums/featured.php?s=dfe50763ddda0422ec10c29dd8d986e7&amp;amp;showuser=495049' class='bbc_member __user __id495049' title='Member profile'&gt;&lt;span style='color:blue; font-style: italic; font-weight: bold'&gt;GunnerInc&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Other Languages&lt;/strong&gt;:&lt;br /&gt;
&lt;a href='http://www.dreamincode.net/forums/featured.php?s=dfe50763ddda0422ec10c29dd8d986e7&amp;amp;showuser=611423' class='bbc_member __user __id611423' title='Member profile'&gt;&lt;span style='color:#00CCCC;font-weight:bold;'&gt;andrewsw&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Graphic Design&lt;/strong&gt;:&lt;br /&gt;
&lt;a href='http://www.dreamincode.net/forums/featured.php?s=dfe50763ddda0422ec10c29dd8d986e7&amp;amp;showuser=91103' class='bbc_member __user __id91103' title='Member profile'&gt;&lt;span style='color:blue; font-style: italic; font-weight: bold'&gt;modi123_1&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;J&amp;#097;v&amp;#097;script&lt;/strong&gt;:&lt;br /&gt;
&lt;a href='http://www.dreamincode.net/forums/featured.php?s=dfe50763ddda0422ec10c29dd8d986e7&amp;amp;showuser=611423' class='bbc_member __user __id611423' title='Member profile'&gt;&lt;span style='color:#00CCCC;font-weight:bold;'&gt;andrewsw&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href='http://www.dreamincode.net/forums/featured.php?s=dfe50763ddda0422ec10c29dd8d986e7&amp;amp;showuser=390971' class='bbc_member __user __id390971' title='Member profile'&gt;&lt;span style='color:#00CCCC;font-weight:bold;'&gt;Dormilich&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;HTML/CSS&lt;/strong&gt;:&lt;br /&gt;
&lt;a href='http://www.dreamincode.net/forums/featured.php?s=dfe50763ddda0422ec10c29dd8d986e7&amp;amp;showuser=611423' class='bbc_member __user __id611423' title='Member profile'&gt;&lt;span style='color:#00CCCC;font-weight:bold;'&gt;andrewsw&lt;/span&gt;&lt;/a&gt;</description>
			<category>Dream.in.code News</category>
			<pubDate>Sat, 01 Jun 2013 23:33:45 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322233-link-computer-scientists-oppose-oracles-bid-to-copyright-java-apis/</link>
            <title>[Link] Computer Scientists Oppose Oracle&#39;s Bid To Copyright Java A</title>
            <description>&lt;p class='citation'&gt;Quote&lt;/p&gt;&lt;div class=&quot;blockquote&quot;&gt;&lt;div class='quote'&gt;Nearly three dozen computer scientists have signed off on a court brief opposing Oracle’s effort to copyright its Java APIs, a move they say would hold back the computer industry and deny affordable technology to end users.&lt;br /&gt;
&lt;br /&gt;
The group, which includes prominent names such as MS-DOS author Tim Paterson and ARPANET developer Larry Roberts, signed the amicus brief in support of Google in its copyright lawsuit with Oracle.&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href='http://www.pcworld.com/article/2040360/computer-scientists-oppose-oracles-bid-to-copyright-java-apis.html' class='bbc_url' title='External link' rel='external'&gt;http://www.pcworld.c...-java-apis.html&lt;/a&gt;</description>
			<category>Java News and Articles</category>
			<pubDate>Sat, 01 Jun 2013 23:15:22 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322232-link-java-security-improvements-not-a-panacea-for-oracle/</link>
            <title>[Link] Java Security Improvements Not A Panacea For Oracle</title>
            <description>&lt;p class='citation'&gt;Quote&lt;/p&gt;&lt;div class=&quot;blockquote&quot;&gt;&lt;div class='quote'&gt;Oracle&amp;#39;s plans to bolster Java security were welcomed by security experts who nevertheless wanted to see more done to lockdown one of hackers&amp;#39; favorite targets.&lt;br /&gt;
&lt;br /&gt;
The Java steward released on Thursday its priorities for the application platform. The changes on tap included automated checking of the validity of signed certificates, stopping unsigned applets from being executed by default and adding centralized management options. The latter included whitelisting of applets in enterprise environments.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;No one step Oracle is taking stands out as a silver bullet that will cure Java security issues,&amp;quot; said Paul Henry, a security and forensic analyst with Lumension. &amp;quot;That being said, each with one exception is a step in the right direction.&amp;quot;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href='http://www.pcworld.com/article/2040523/java-security-improvements-not-a-panacea-for-oracle.html' class='bbc_url' title='External link' rel='external'&gt;http://www.pcworld.c...for-oracle.html&lt;/a&gt;</description>
			<category>Java News and Articles</category>
			<pubDate>Sat, 01 Jun 2013 23:14:41 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322220-graph-theory-challenge-menage-a-triangle/</link>
            <title>Graph Theory Challenge- Menage A Triangle</title>
            <description>&lt;strong class='bbc'&gt;Graph Theory Challenge- Menage a Triangle&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
This challenge has a few parts to it, all revolving around triangles in a graph. A triangle is a Circuit of three vertices (C&lt;sub class='bbc'&gt;3&lt;/sub&gt;). For the sake of these problems, it can be assumed that the graphs are simple and undirected. &lt;br /&gt;
&lt;br /&gt;
I will post my solutions after everyone has a chance to have a crack at it. Remember to use spoiler tags for your answers&amp;#33;&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Part 1&lt;/strong&gt;&lt;br /&gt;
Given an arbitrary graph G(V, E), determine how many triangles are in this graph. You may represent this graph in whatever manner you choose. Solutions should have a runtime complexity bounds of O(n&lt;sup class='bbc'&gt;3&lt;/sup&gt;). Matrix multiplication and matrix determinants can be taken at O(n&lt;sup class='bbc'&gt;2.4&lt;/sup&gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Part 2&lt;/strong&gt;&lt;br /&gt;
Assuming a triangle exists in G(V, E), design an algorithm to find a single, arbitrary triangle in the given graph. Return the vertex set for the subgraph. Solutions should be O(n&lt;sup class='bbc'&gt;2&lt;/sup&gt;) or better.&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Part 3&lt;/strong&gt;&lt;br /&gt;
Determine the upper bounds in terms of Big-O on the number of triangles that can appear in a graph.&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Part 4&lt;/strong&gt;&lt;br /&gt;
&lt;a href='http://en.wikipedia.org/wiki/Andr%C3%A1s_Hajnal' class='bbc_url' title='External link' rel='external'&gt;Andras Hajnal&lt;/a&gt; proposed a game called the triangle-free game. Given a graph &lt;span class=&quot;inlinecode&quot;&gt;K&lt;sub class='bbc'&gt;n&lt;/sub&gt;&lt;/span&gt; (a complete graph on &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; vertices), players alternatively chose edges. The loser is the one who chose an edge that completed a triangle. Consider an additional constraint that states that after Player A&amp;#39;s initial move, all edge choices must be made to maintain connectivity. Let player A be the player that goes first, and player B the player that goes second. When would one want to be Player A? Alternatively, when would one want to be Player B?</description>
			<category>Computer Science</category>
			<pubDate>Sat, 01 Jun 2013 18:03:03 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322195-link-open-source-development-surges-for-android-and-surprisingly-ios/</link>
            <title>[Link] Open Source Development Surges For Android And Surprisingly IOS</title>
            <description>&lt;p class='citation'&gt;Quote&lt;/p&gt;&lt;div class=&quot;blockquote&quot;&gt;&lt;div class='quote'&gt;Open source developers launched 15,000 Android mobile projects in 2012, representing a 96 percent increase over 2011. By contrast, iOS developers launched nearly 2,500 open source projects for Apple&amp;#39;s mobile platform, a 32 percent increase year over year, which isn&amp;#39;t half bad when you consider that the Apple App Store isn&amp;#39;t particularly friendly for open source (Apple is trying to shift that perception).&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Out of curiosity, how many of you all work on iOS development? What about iOS or Android open source projects? What are everyone&amp;#39;s thoughts on this article?&lt;br /&gt;
&lt;br /&gt;
&lt;a href='http://www.javaworld.com/javaworld/jw-05-2013/130523-open-source-development-surges-for-android-and-ios.html' class='bbc_url' title='External link' rel='external'&gt;http://www.javaworld...id-and-ios.html&lt;/a&gt;</description>
			<category>Industry News</category>
			<pubDate>Sat, 01 Jun 2013 03:53:55 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322186-linear-algebra-primer-part-3-basis-span-and-dimension/</link>
            <title>Linear Algebra Primer: Part 3- Basis, Span, And Dimension</title>
            <description>&lt;strong class='bbc'&gt;Linear Algebra Primer: Part 3- Span, Basis, and Dimension&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial will focus on the concepts of span, basis, and dimension. Graph theory analogues will also be discussed in the context of basis.&lt;br /&gt;
&lt;br /&gt;
Attached is a LaTeX typeset version for those who would prefer to view this tutorial in that format&lt;br /&gt;
[attachment=33177:Linear_Algebra_Part3_Tutorial.pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Span&lt;/strong&gt;&lt;br /&gt;
In my &lt;a href='http://www.dreamincode.net/forums/topic/321825-linear-algebra-primer-part-2-linear-independence-and-matroids/' class='bbc_url' title='External link' rel='external'&gt;last tutorial&lt;/a&gt;, the concept of span was briefly introduced. Abstractly, given a set of vectors S, span(S) is the set of all vectors formed from linear combinations of the vectors in S. There are two predominant questions related to the span of a vector set S: &lt;ul class='bbc'&gt;&lt;li&gt; What is the span of S? &lt;br /&gt;&lt;/li&gt;&lt;li&gt; Does S span the vector space V?&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
The span of S relies on the number of linearly independent vectors in S. So if &lt;span class=&quot;inlinecode&quot;&gt;S = {(1, 0), (0, 1)}&lt;/span&gt;, then &lt;span class=&quot;inlinecode&quot;&gt;span(S) = &lt;strong class='bbc'&gt;R&lt;/strong&gt;&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/span&gt;. Clearly, the vectors are linearly independent, and they are both in the vector space &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;. &lt;br /&gt;
&lt;br /&gt;
Similarly, if &lt;span class=&quot;inlinecode&quot;&gt;S = {(1, 0, 0}, (0, 0, 1)}&lt;/span&gt;, then &lt;span class=&quot;inlinecode&quot;&gt;span(S)&lt;/span&gt; is the x-z plane in &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;3&lt;/sup&gt;&lt;/strong&gt;. The vectors in &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; are the x and z axes.&lt;br /&gt;
&lt;br /&gt;
What about &lt;span class=&quot;inlinecode&quot;&gt;span(&lt;strong class='bbc'&gt;P&lt;sub class='bbc'&gt;2&lt;/sub&gt;&amp;reg;&lt;/strong&gt;)&lt;/span&gt;, which is the span of the quadratics? Since &lt;strong class='bbc'&gt;P&lt;sub class='bbc'&gt;2&lt;/sub&gt;&amp;reg;&lt;/strong&gt; is the vector space, &lt;span class=&quot;inlinecode&quot;&gt;span(&lt;strong class='bbc'&gt;P&lt;sub class='bbc'&gt;2&lt;/sub&gt;&amp;reg;&lt;/strong&gt;) = &lt;strong class='bbc'&gt;P&lt;sub class='bbc'&gt;2&lt;/sub&gt;&amp;reg;&lt;/strong&gt;&lt;/span&gt;. Since linear combinations of vectors in the Vector Space belong to the Vector Space, &lt;span class=&quot;inlinecode&quot;&gt;span(V) = V&lt;/span&gt; for any Vector Space V.&lt;br /&gt;
&lt;br /&gt;
Span is determined in a similar way as Linear Independence. However, one of the conditions for the Linear Independence of a set of vectors requires that there exist at most &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; vectors in the set if the dimension of the Vector Space is &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt;. In order for a set of vectors to span the Vector Space, the set must contain at least &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; linearly independent vectors.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s unpack this intuition a little bit. Think of linearly independent vectors as coordinate axes. In &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;, there are two coordinate axes- the x and y-axes. Thus, two independent vectors span the space. Any other vectors in addition to those coordinate axes won&amp;#39;t change the fact that the axes span the space. Similarly, if just given a single vector in &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;, a dependent vector won&amp;#39;t change the fact that the set doesn&amp;#39;t span. So if only the x-axis is given, there is no way to independently obtain the y-coordinates. Therefore, the x-axis cannot span the space. A more geometric argument is that &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt; is a plane, and each axis is a line. Thus, a line is a subspace of the plane, but does not span the plane.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Basis&lt;/strong&gt;&lt;br /&gt;
A basis is the minimal viable set of vectors required to span a Vector Space. It is defined as maximally linearly independent, but still spanning the space. From the last tutorial, if the dimension of the Vector Space is &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt;, then a vector set can have no more than &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; vectors and still be linearly independent. Similarly, to span the Vector Space, that set of vectors must have at least &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; vectors. Thus, it makes sense that a basis has exactly &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; vectors. Looking at this from a Matroid perspective, it makes sense that all bases have the same cardinality. The third axiom of Matroids states that all maximally independent subsets of the ground set have the same cardinality. Thus, bases are all maximally independent subsets of a Vector Space.&lt;br /&gt;
&lt;br /&gt;
Bases can analogously be thought of as spanning trees as well. A spanning tree on a graph is an acyclic (independent) subgraph that contains all the vertices in the graph and is connected. Not all spanning trees are isomorphic. In fact, there are usually multiple spanning trees for a given graph. Let&amp;#39;s look at some examples. Consider the graphs below, with &lt;span class=&quot;inlinecode&quot;&gt;G&lt;/span&gt; as the original graph. The forest &lt;span class=&quot;inlinecode&quot;&gt;F&lt;/span&gt;, which is a set of trees, is clearly independent, as there are no cycles. However, since the trees in &lt;span class=&quot;inlinecode&quot;&gt;F&lt;/span&gt; are not connected, none of them can be thought of as a basis or a spanning tree on the graph. Both &lt;span class=&quot;inlinecode&quot;&gt;T&lt;sub class='bbc'&gt;1&lt;/sub&gt;&lt;/span&gt; and &lt;span class=&quot;inlinecode&quot;&gt;T&lt;sub class='bbc'&gt;2&lt;/sub&gt;&lt;/span&gt; are spanning trees. However, they are different. Notice how there is an edge used in &lt;span class=&quot;inlinecode&quot;&gt;T&lt;sub class='bbc'&gt;1&lt;/sub&gt;&lt;/span&gt; that is not present in &lt;span class=&quot;inlinecode&quot;&gt;T&lt;sub class='bbc'&gt;2&lt;/sub&gt;&lt;/span&gt;; and similarly, there is an edge used &lt;span class=&quot;inlinecode&quot;&gt;T&lt;sub class='bbc'&gt;2&lt;/sub&gt;&lt;/span&gt; that is not used in &lt;span class=&quot;inlinecode&quot;&gt;T&lt;sub class='bbc'&gt;1&lt;/sub&gt;&lt;/span&gt;. To get from &lt;span class=&quot;inlinecode&quot;&gt;T&lt;sub class='bbc'&gt;1&lt;/sub&gt;&lt;/span&gt; to &lt;span class=&quot;inlinecode&quot;&gt;T&lt;sub class='bbc'&gt;2&lt;/sub&gt;&lt;/span&gt;, these edges are swapped. This is the premise for the basis substitution property.&lt;br /&gt;
[attachment=33178:Basis_Graphs.png]&lt;br /&gt;
&lt;br /&gt;
Before unpacking the substitution property, let&amp;#39;s determine the conditions that need to hold to determine if a vector set is a basis for the Vector Space &lt;span class=&quot;inlinecode&quot;&gt;V&lt;/span&gt;. &lt;ul class='bbc'&gt;&lt;li&gt; Cardinality-Dimension Test: If the dimension of &lt;span class=&quot;inlinecode&quot;&gt;V&lt;/span&gt; is &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt;, then the set must have exactly &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; vectors. If it does not have &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; vectors, then it is not a basis.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Linear Independence: The multiples test is a quick way to determine if the vector set is linearly independent or dependent. If it passes the multiples test, then the determinant test should be used. Remember from the last tutorial that it is necessary to construct the matrix where vectors in &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; are the column vectors. From there, the vector set is linearly independent if and only if the determinant of the matrix is non-zero.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
Now let&amp;#39;s discuss the substitution principle for bases a little more. Essentially, as long as the vector set retains the same number of linearly independent elements, vectors can be substituted, and the vector set will remain a basis. Consider the standard basis for &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;: &lt;span class=&quot;inlinecode&quot;&gt;S = {(1, 0), (0, 1)}&lt;/span&gt;. It&amp;#39;s easy to see that this is linearly independent, and the vectors represent the standard x and y-axes. Now let&amp;#39;s substitute &lt;span class=&quot;inlinecode&quot;&gt;(0, 1)&lt;/span&gt; for &lt;span class=&quot;inlinecode&quot;&gt;(3, 7)&lt;/span&gt;. Thus, &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; is still linearly independent and has two vectors; thus, it is still a basis for &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;. &lt;br /&gt;
&lt;br /&gt;
Consider again &lt;span class=&quot;inlinecode&quot;&gt;S = {(1, 0), (0, 1)}&lt;/span&gt;. Swapping &lt;span class=&quot;inlinecode&quot;&gt;(1, 0)&lt;/span&gt; for &lt;span class=&quot;inlinecode&quot;&gt;(0, 5)&lt;/span&gt; is not an acceptable choice such that &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; remains a basis, as &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; is clearly linearly dependent by the multiples test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Dimension&lt;/strong&gt;&lt;br /&gt;
So far, dimension has been referenced a lot, but not clearly defined. The dimension of a Vector Space, denoted &lt;span class=&quot;inlinecode&quot;&gt;dim(V)&lt;/span&gt; describes the number of basis vectors for &lt;span class=&quot;inlinecode&quot;&gt;V&lt;/span&gt;. For the most part, dimension is pretty easy to see. The &lt;span class=&quot;inlinecode&quot;&gt;dim(R&lt;sup class='bbc'&gt;2&lt;/sup&gt;) = 2&lt;/span&gt;, and &lt;span class=&quot;inlinecode&quot;&gt;dim(P&lt;sub class='bbc'&gt;n&lt;/sub&gt;(F)) = n + 1&lt;/span&gt;, as polynomials of degree n have n+1 terms. Similarly, an &lt;span class=&quot;inlinecode&quot;&gt;m x n&lt;/span&gt; Matrix has dimension &lt;span class=&quot;inlinecode&quot;&gt;mn&lt;/span&gt;. Think about it this way- the standard basis has a single &lt;span class=&quot;inlinecode&quot;&gt;1&lt;/span&gt; and the rest of the elements in each vector are &lt;span class=&quot;inlinecode&quot;&gt;0&amp;#39;s&lt;/span&gt;. So there needs to be an element where the &lt;span class=&quot;inlinecode&quot;&gt;1&lt;/span&gt; is in each position. Thus, it is clear to see why &lt;span class=&quot;inlinecode&quot;&gt;{(1, 0), (0, 1)}&lt;/span&gt; is the standard basis for &lt;strong class='bbc'&gt;R&lt;sup class='bbc'&gt;2&lt;/sup&gt;&lt;/strong&gt;, and it is now easier to see why Matrices have dimension &lt;span class=&quot;inlinecode&quot;&gt;mn&lt;/span&gt;.</description>
			<category>Software Development Tutorials</category>
			<pubDate>Sat, 01 Jun 2013 00:05:09 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/322171-personal-websites/</link>
            <title>Personal Websites</title>
            <description>Do you guys have any personal websites? Like websites for you - be it your irl identity or online one. I recently bit the bullet and made one just so I could get a real email on my resume: &lt;a href='http://seangrant.me' class='bbc_url' title='External link' rel='external'&gt;seangrant.me&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
But yeah I&amp;#39;d like to see what you guys have come up with &lt;img src='http://cdn.dreamincode.net/forums/public/style_emoticons/&lt;#EMO_DIR#&gt;/smile.gif' class='bbc_emoticon' alt=':)' /&gt;</description>
			<category>Corner Cubicle</category>
			<pubDate>Fri, 31 May 2013 20:50:49 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/321952-link-why-you-dont-use-md5-for-passwords/</link>
            <title>[Link] Why You Don&#39;t Use MD5 For Passwords</title>
            <description>An insightful &lt;a href='http://arstechnica.com/security/2013/05/how-crackers-make-minced-meat-out-of-your-passwords/' class='bbc_url' title='External link' rel='external'&gt;Ars Technica article&lt;/a&gt; on how easy it is to crack MD5 passwords, even those you might think are fairly secure.&lt;br /&gt;
&lt;br /&gt;
&lt;p class='citation'&gt;Quote&lt;/p&gt;&lt;div class=&quot;blockquote&quot;&gt;&lt;div class='quote'&gt;The list contained 16,449 passwords converted into hashes using the MD5 cryptographic hash function.&lt;br /&gt;
...&lt;br /&gt;
The most thorough of the three cracks was carried out by Jeremi Gosney, a password expert with Stricture Consulting Group. Using a commodity computer with a single AMD Radeon 7970 graphics card, it took him 20 hours to crack 14,734 of the hashes, a 90-percent success rate.&lt;br /&gt;
...&lt;br /&gt;
The increasing power of hardware and specialized software makes it trivial for crackers to combine these ingredients in literally billions of slightly different permutations. Unless the user takes great care, passwords that are easy to remember are sitting ducks in the hands of crackers.&lt;/div&gt;&lt;/div&gt;</description>
			<category>Software Development</category>
			<pubDate>Tue, 28 May 2013 09:53:22 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/321933-creating-a-calculator-using-jframe/</link>
            <title>Creating A Calculator Using JFrame</title>
            <description>In this tutorial you will learn the basics to creating a calculator with a graphical user interface.  I use NetBeans for this, I highly suggest you use NetBeans or a similar IDE(Integrated Development Enviornment).  You will also need Java 7 for the Nimbus look and feel.  In this tutorial you will learn about using the ActionListener and the building of a GUI.&lt;br /&gt;
&lt;br /&gt;
To begin we will need to add a few imports.&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;import java.awt.*;&lt;/span&gt; - essential for visual components.&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;import javax.swing.*;&lt;/span&gt; - again, it&amp;#39;s essential for the components and to set our visual feel.&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;import java.awt.event.*;&lt;/span&gt; - essential for handling events such as our ActionListener.&lt;br /&gt;
&lt;br /&gt;
I will be naming my class &lt;em class='bbc'&gt;Calculator&lt;/em&gt;. So you&amp;#39;ll start this class off like you would any class, &lt;span class=&quot;inlinecode&quot;&gt;public class Calculator {&lt;/span&gt;.  Only now we need to make use of JFrame and ActionListener.  You want to extend JFrame and implement ActionListener like so,&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;public class Calculator extends JFrame implements ActionListener { }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Since every program needs a main method, we can add it in right now.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
public static void main(String&amp;#91;&amp;#93; arguments) {
    Calculator c = new Calculator();
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s begin on our declarations now.&lt;br /&gt;
&lt;br /&gt;
For our frame we will have five rows of components, so I make 5 panels, one for each row.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;JPanel[] row = new JPanel[5];&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Decide how many buttons you will have on your calculator.  I use 19.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;JButton[] button = new JButton[19];&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
With these buttons we have only declared them, we are going to need to Initialize them shortly.  Each button will need a string, but instead of typing out 19 lines to initialize each one we are going to create a loop for that.  So we are going to put the string values for each button in an array to use for our loop later.  Note, be careful on the order, you want it setup for button[0] to equal buttonString[0].&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
    String&amp;#91;&amp;#93; buttonString = {&amp;quot;7&amp;quot;, &amp;quot;8&amp;quot;, &amp;quot;9&amp;quot;, &amp;quot;+&amp;quot;,
                             &amp;quot;4&amp;quot;, &amp;quot;5&amp;quot;, &amp;quot;6&amp;quot;, &amp;quot;-&amp;quot;,
                             &amp;quot;1&amp;quot;, &amp;quot;2&amp;quot;, &amp;quot;3&amp;quot;, &amp;quot;*&amp;quot;,
                             &amp;quot;.&amp;quot;, &amp;quot;/&amp;quot;, &amp;quot;C&amp;quot;, &amp;quot;&amp;#8730;&amp;quot;,
                             &amp;quot;+/-&amp;quot;, &amp;quot;=&amp;quot;, &amp;quot;0&amp;quot;};
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Alright, now let&amp;#39;s create arrays for the dimension widths and heights of the buttons we will create.&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;int[] dimW = {300, 45, 100, 90};&lt;/span&gt; - our widths will be 300, 45, 100, and 90 for the different types of components.&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;int[] dimH = {35, 40};&lt;/span&gt; - our heights will be 35 for the display and 40 for the buttons.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s declare and initialize our dimensions here.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;Dimension displayDimension = new Dimension(dimW[0], dimH[0]);&lt;/span&gt; - Uses the first integer in the width, and the first integer in height.&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;Dimension regularDimension = new Dimension(dimW[1], dimH[1]);&lt;/span&gt; - Uses the second integer in the width, and the second integer in height.&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;Dimension rColumnDimension = new Dimension(dimW[2], dimH[1]);&lt;/span&gt; - Uses the third integer in the width, and the second integer in height.&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;Dimension zeroButDimension = new Dimension(dimW[3], dimH[1]);&lt;/span&gt; - Uses the fourth integer in width, and the second integer in height.&lt;br /&gt;
&lt;br /&gt;
Now we need to declare some booleans for our functions - adding, subtracting, multiplying, and dividing. Let&amp;#39;s use an array for that.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;boolean[] function = new boolean[4];&lt;/span&gt; - not initialized yet&lt;br /&gt;
&lt;br /&gt;
We&amp;#39;ll need some temporary doubles later for our calculations so,&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;double[] temporary = {0, 0};&lt;/span&gt; - these are now initialized.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s create a display using JTextArea.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;JTextArea display = new JTextArea(1,20);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
and the last of our declarations, just for a more appealing effect, we will use a different font, style, and pt.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;Font font = new Font(&amp;quot;Times new Roman&amp;quot;, Font.BOLD, 14);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alright, let&amp;#39;s move on to making the constructor&amp;#33;&lt;br /&gt;
&lt;br /&gt;
This is how we begin with it,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
Calculator() {	//Same as class name

}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Inside our constructor we start off with &lt;span class=&quot;inlinecode&quot;&gt;super(&amp;quot;Title&amp;quot;);&lt;/span&gt; - this is required, you will recieve errors if you don&amp;#39;t begin with this.  Replace &amp;quot;Title&amp;quot; with the title of your program.&lt;br /&gt;
&lt;br /&gt;
Now call the method &lt;span class=&quot;inlinecode&quot;&gt;setDesign();&lt;/span&gt; - you will recieve an error for this as we have not yet created that method.&lt;br /&gt;
&lt;br /&gt;
To set the size of the frame we will use &lt;span class=&quot;inlinecode&quot;&gt;setSize(w, h);&lt;/span&gt; replace the width with &lt;strong class='bbc'&gt;380&lt;/strong&gt; and the height with &lt;strong class='bbc'&gt;250&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
We will make it so the frame cannot be resized, which can sometimes cause the layout to get messed up.&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;setResizable(false);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
add in &lt;span class=&quot;inlinecode&quot;&gt;setDefaultCloseOperation(EXIT_ON_CLOSE);&lt;/span&gt; to exit the frame when closed.&lt;br /&gt;
&lt;br /&gt;
Okay, now we think for a second, how to layout the frame.  I want to use 5 rows, and have up to 5 components for each row. So I&amp;#39;m going to use the GridLayout manager for this. &lt;span class=&quot;inlinecode&quot;&gt;GridLayout grid = new GridLayout(5,5);&lt;/span&gt; with the first 5 in number of rows, and the second 5 for up to how many components we will allow in the row. to set the layout we will use &lt;em class='bbc'&gt;setLayout&lt;/em&gt;, &lt;span class=&quot;inlinecode&quot;&gt;setLayout(grid);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Moving on(we are still in the constructor), let&amp;#39;s initialize our booleans.  Instead of using 4 lines of code to do this, we can use a for loop.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
for(int i = 0; i &amp;lt; 4; i++)
    function&amp;#91;i&amp;#93; = false;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
So let&amp;#39;s examine how the loop works.  We are creating an integer, i. so while &lt;em class='bbc'&gt;i&lt;/em&gt; is less than 4, we have it set function&lt;em class='bbc'&gt; to false, with it incrementing one each time. Since we want function[0], function[1], function[2], and function[3] to be set equal to false, nothing higher and nothing lower.  Now make sure you understand the concept of a loop, because we will be using a lot of them.&lt;br /&gt;
&lt;br /&gt;
Okay, so if we were to use the FlowLayout manager, the components are dropped in an area the same way words are organized on a page in English. From &lt;em class='bbc'&gt;left&lt;/em&gt; to &lt;em class='bbc'&gt;right&lt;/em&gt;, and from &lt;em class='bbc'&gt;top&lt;/em&gt; to &lt;em class='bbc'&gt;bottom&lt;/em&gt;.&lt;br /&gt;
&lt;br /&gt;
So I think we&amp;#39;ll use FlowLayout for each row now.  This will be how we set up row 1(which we&amp;#39;ll call as row[0] later),&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;FlowLayout f1 = new FlowLayout(FlowLayout.CENTER);&lt;/span&gt; - We are only going to use this for row1.&lt;br /&gt;
&lt;br /&gt;
For the remainder of the rows we only need to set up one new FlowLayout.&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;FlowLayout f2 = new FlowLayout(FlowLayout.CENTER,1,1);&lt;/span&gt; - the 1&amp;#39;s are integers for horizontal gap and vertical gap.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s now initialize our JPanel row&amp;#39;s so we can use them. we will create a loop for this.&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
for(int i = 0; i &amp;lt; 5; i++)
    row&amp;#91;i&amp;#93; = new JPanel();
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Now we can use our rows&amp;#33;&lt;br /&gt;
&lt;br /&gt;
So let&amp;#39;s set the layouts we made to the rows. to do this it will be component.setLayout(layout). what we will do is,&lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;row[0].setLayout(f1);&lt;/span&gt; - which will make our first row the first flowlayout.&lt;br /&gt;
&lt;br /&gt;
Now since we are using the second flowlayout for the remainder of the rows we can use a loop.&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
for(int i = 1; i &amp;lt; 5; i++)
    row&amp;#91;i&amp;#93;.setLayout(f2);
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Our rows now have the layout we need them to.&lt;br /&gt;
&lt;br /&gt;
Since there&amp;#39;s a few of the same things we have to do for every button, let&amp;#39;s create another loop.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
for(int i = 0; i &amp;lt; 19; i++) {
    button&amp;#91;i&amp;#93; = new JButton();
    button&amp;#91;i&amp;#93;.setText(buttonString&amp;#91;i&amp;#93;);
    button&amp;#91;i&amp;#93;.setFont(font);
    button&amp;#91;i&amp;#93;.addActionListener(this);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Okay now let&amp;#39;s take a look at what this code does.  We are setting our text in the buttons with the same text from our buttonString. so button[0] will have the text from buttonString[0], button[1] will have the text from buttonString[1] and so on.  Here we are setting the font we declared to every button. the &lt;em class='bbc'&gt;.addActionListener(this);&lt;/em&gt; will be important for later when we need to make the buttons actually work.&lt;br /&gt;
&lt;br /&gt;
Well that&amp;#39;s for the buttons, but now what about the display? We have a few things to do with the display too.  We have no need for a loop since we are only dealing with one component now.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
display.setFont(font);
display.setEditable(false);
display.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
So here, we are setting the font, making it so the input is not allowed by keyboard, and setting it so the input appears from right to left on the display.&lt;br /&gt;
&lt;br /&gt;
Now we can work on setting sizes for all of our components.  If you remember correctly we created a dimension for the display, the regular buttons, the buttons on the right column, and the zero button. To set the size we will use [i]component.setPreferredSize&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
For our display - &lt;span class=&quot;inlinecode&quot;&gt;display.setPreferredSize(displayDimension);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
For the regular buttons and the right column buttons we will use loops.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
for(int i = 0; i &amp;lt; 14; i++)
    button&amp;#91;i&amp;#93;.setPreferredSize(regularDimension);
for(int i = 14; i &amp;lt; 18; i++)
    button&amp;#91;i&amp;#93;.setPreferredSize(rColumnDimension);
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
and for zero, we just need to use - &lt;span class=&quot;inlinecode&quot;&gt;button[18].setPreferredSize(zeroButDimension);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here is where we add components to the panel, and the panels to the frame.&lt;br /&gt;
&lt;br /&gt;
To add the component to the panel use panel.add(component);&lt;br /&gt;
I&amp;#39;ll show you what we need, &lt;br /&gt;
&lt;span class=&quot;inlinecode&quot;&gt;row[0].add(display);&lt;/span&gt; this adds our display to row 1.&lt;br /&gt;
&lt;br /&gt;
and adding the panel, &lt;span class=&quot;inlinecode&quot;&gt;add(row[0]);&lt;/span&gt; which adds row1.&lt;br /&gt;
&lt;br /&gt;
The other rows will be different because we will be using loops, Follow along for row2.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
        for(int i = 0; i &amp;lt; 4; i++)
            row&amp;#91;1&amp;#93;.add(button&amp;#91;i&amp;#93;);
        row&amp;#91;1&amp;#93;.add(button&amp;#91;14&amp;#93;);
        add(row&amp;#91;1&amp;#93;);
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
We loop through the first 4 buttons and add them, then we add in button 15.  Here are the remaining rows:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
        for(int i = 4; i &amp;lt; 8; i++)
            row&amp;#91;2&amp;#93;.add(button&amp;#91;i&amp;#93;);
        row&amp;#91;2&amp;#93;.add(button&amp;#91;15&amp;#93;);
        add(row&amp;#91;2&amp;#93;);
        
        for(int i = 8; i &amp;lt; 12; i++)
            row&amp;#91;3&amp;#93;.add(button&amp;#91;i&amp;#93;);
        row&amp;#91;3&amp;#93;.add(button&amp;#91;16&amp;#93;);
        add(row&amp;#91;3&amp;#93;);
        
        row&amp;#91;4&amp;#93;.add(button&amp;#91;18&amp;#93;);
        for(int i = 12; i &amp;lt; 14; i++)
            row&amp;#91;4&amp;#93;.add(button&amp;#91;i&amp;#93;);
        row&amp;#91;4&amp;#93;.add(button&amp;#91;17&amp;#93;);
        add(row&amp;#91;4&amp;#93;);
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Now all we need to do with our constructor is add on &lt;span class=&quot;inlinecode&quot;&gt;setVisible(true);&lt;/span&gt; to it and we&amp;#39;re done&lt;br /&gt;
&lt;br /&gt;
Okay, so right now you are recieving 2 errors and you cannot compile yet, so let&amp;#39;s fix those errors so you can see how your calculator looks.  Outside of our constructor we can create a method called setDesign().&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
    public final void setDesign() {
        try {
            UIManager.setLookAndFeel(
                    &amp;quot;com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel&amp;quot;);
        } catch(Exception e) {   
        }
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
This is the setDesign method, for more info on the look and feel look into Java LookAndFeel. - Because using the NimbusLookAndFeel we require Java 7.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s fix this last error so we can see how it looks&amp;#33;&lt;br /&gt;
&lt;br /&gt;
below your setDesign method you can create a new one called actionPerformed, this is required when using the ActionListener.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
public void actionPerformed(ActionEvent ae) {

}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
You can leave it blank now, we will be adding into it later.&lt;br /&gt;
&lt;br /&gt;
Now if you run the program you should be able to see what our calculator will look like.  The buttons do not work yet, we will get to that last.&lt;br /&gt;
&lt;br /&gt;
We have some methods to create now. One method for our clear button, one method for our plus minus button, one method for square root, and one method for getting our results from the functions. I will be posting the full methods and explaining them in comments.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s start with clear().&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
    public void clear() {
        try {
            display.setText(&amp;quot;&amp;quot;); // Sets the display blank
            for(int i = 0; i &amp;lt; 4; i++)
                function&amp;#91;i&amp;#93; = false; // Sets the functions back to false
            for(int i = 0; i &amp;lt; 2; i++)
                temporary&amp;#91;i&amp;#93; = 0; // Sets our temporary variables back to 0
        } catch(NullPointerException e) {  
        }
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Now our square root method.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
    public void getSqrt() {
        try {
            double value = Math.sqrt(Double.parseDouble(display.getText())); // Create a variable for value, and use Math&amp;#39;s square root to find value
            display.setText(Double.toString(value)); // Sets display to new value
        } catch(NumberFormatException e) {
        }
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Now our positive negative method.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
    public void getPosNeg() {
        try {
            double value = Double.parseDouble(display.getText()); // again we create a variable for our current value
            if(value &amp;#33;= 0) { // if the value isn&amp;#39;t 0
                value = value * (-1); // we multiply it by -1 to get it&amp;#39;s opposite value
                display.setText(Double.toString(value)); // set the text to the new value.
            }
            else {
            }
        } catch(NumberFormatException e) {
        }
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
and now our result method which is a little more complex.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
    public void getResult() {
        double result = 0;  // variable for result
        temporary&amp;#91;1&amp;#93; = Double.parseDouble(display.getText()); //our second temporary number from display
        String temp0 = Double.toString(temporary&amp;#91;0&amp;#93;); //necessary string for text of first temp
        String temp1 = Double.toString(temporary&amp;#91;1&amp;#93;); //necessary string for text of second temp
        try {
            if(temp0.contains(&amp;quot;-&amp;quot;)) { //if first string contains -
                String&amp;#91;&amp;#93; temp00 = temp0.split(&amp;quot;-&amp;quot;, 2); //split into two strings at -
                temporary&amp;#91;0&amp;#93; = (Double.parseDouble(temp00&amp;#91;1&amp;#93;) * -1); //puts string back in double with the real value.
            }
            if(temp1.contains(&amp;quot;-&amp;quot;)) { // same as above with second temporary
                String&amp;#91;&amp;#93; temp11 = temp1.split(&amp;quot;-&amp;quot;, 2);
                temporary&amp;#91;1&amp;#93; = (Double.parseDouble(temp11&amp;#91;1&amp;#93;) * -1);
            }
        } catch(ArrayIndexOutOfBoundsException e) {
        }
        try {
            if(function&amp;#91;2&amp;#93; == true)  //we start off with multiplication obviously
                result = temporary&amp;#91;0&amp;#93; * temporary&amp;#91;1&amp;#93;; //sets result to multiplication of function
            else if(function&amp;#91;3&amp;#93; == true)  //now division
                result = temporary&amp;#91;0&amp;#93; / temporary&amp;#91;1&amp;#93;;
            else if(function&amp;#91;0&amp;#93; == true) //now addition
                result = temporary&amp;#91;0&amp;#93; + temporary&amp;#91;1&amp;#93;;
            else if(function&amp;#91;1&amp;#93; == true) //now subtraction
                result = temporary&amp;#91;0&amp;#93; - temporary&amp;#91;1&amp;#93;;
            display.setText(Double.toString(result)); //display now has result
            for(int i = 0; i &amp;lt; 4; i++)
                function&amp;#91;i&amp;#93; = false; //set all the functions back to false
        } catch(NumberFormatException e) {
        }
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Now that we have all the methods we need, all we have to do is make our buttons work. This is the working method for actionPerformed, try not to copy and paste, try to type it out on your own. it&amp;#39;s all explained in the paragraph below.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
    public void actionPerformed(ActionEvent ae) {
        if(ae.getSource() == button&amp;#91;0&amp;#93;)
            display.append(&amp;quot;7&amp;quot;);
        if(ae.getSource() == button&amp;#91;1&amp;#93;)
            display.append(&amp;quot;8&amp;quot;);
        if(ae.getSource() == button&amp;#91;2&amp;#93;)
            display.append(&amp;quot;9&amp;quot;);
        if(ae.getSource() == button&amp;#91;3&amp;#93;) {
            //add function&amp;#91;0&amp;#93;
            temporary&amp;#91;0&amp;#93; = Double.parseDouble(display.getText());
            function&amp;#91;0&amp;#93; = true;
            display.setText(&amp;quot;&amp;quot;);
        }
        if(ae.getSource() == button&amp;#91;4&amp;#93;)
            display.append(&amp;quot;4&amp;quot;);
        if(ae.getSource() == button&amp;#91;5&amp;#93;)
            display.append(&amp;quot;5&amp;quot;);
        if(ae.getSource() == button&amp;#91;6&amp;#93;)
            display.append(&amp;quot;6&amp;quot;);
        if(ae.getSource() == button&amp;#91;7&amp;#93;) {
            //subtract function&amp;#91;1&amp;#93;
            temporary&amp;#91;0&amp;#93; = Double.parseDouble(display.getText());
            function&amp;#91;1&amp;#93; = true;
            display.setText(&amp;quot;&amp;quot;);
        }
        if(ae.getSource() == button&amp;#91;8&amp;#93;)
            display.append(&amp;quot;1&amp;quot;);
        if(ae.getSource() == button&amp;#91;9&amp;#93;)
            display.append(&amp;quot;2&amp;quot;);
        if(ae.getSource() == button&amp;#91;10&amp;#93;)
            display.append(&amp;quot;3&amp;quot;);
        if(ae.getSource() == button&amp;#91;11&amp;#93;) {
            //multiply function&amp;#91;2&amp;#93;
            temporary&amp;#91;0&amp;#93; = Double.parseDouble(display.getText());
            function&amp;#91;2&amp;#93; = true;
            display.setText(&amp;quot;&amp;quot;);
        }
        if(ae.getSource() == button&amp;#91;12&amp;#93;)
            display.append(&amp;quot;.&amp;quot;);
        if(ae.getSource() == button&amp;#91;13&amp;#93;) {
            //divide function&amp;#91;3&amp;#93;
            temporary&amp;#91;0&amp;#93; = Double.parseDouble(display.getText());
            function&amp;#91;3&amp;#93; = true;
            display.setText(&amp;quot;&amp;quot;);
        }
        if(ae.getSource() == button&amp;#91;14&amp;#93;)
            clear();
        if(ae.getSource() == button&amp;#91;15&amp;#93;)
            getSqrt();
        if(ae.getSource() == button&amp;#91;16&amp;#93;)
            getPosNeg();
        if(ae.getSource() == button&amp;#91;17&amp;#93;)
            getResult();
        if(ae.getSource() == button&amp;#91;18&amp;#93;)
            display.append(&amp;quot;0&amp;quot;);
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
To find the source of the button that was pressed we use &lt;span class=&quot;inlinecode&quot;&gt;ActionEvent.getSource() == button&lt;/span&gt; because we called ActionEvent ae we can just use &lt;span class=&quot;inlinecode&quot;&gt;ae.getSource()&lt;/span&gt; instead.  So our button[0] is 7. with JTextArea we use append(string) to add text in. So if our button source is button[0] (which is our 7 button) &lt;span class=&quot;inlinecode&quot;&gt;display.append(&amp;quot;7&amp;quot;);&lt;/span&gt;  This gets done with all the buttons that produce text in the display. &lt;br /&gt;
&lt;br /&gt;
Now moving on to our function buttons (multiply, divide, add, subtract). for the source of that button being pressed we need to set our first temporary number from the string on the display. i.e. &lt;span class=&quot;inlinecode&quot;&gt;temporary[0] = Double.parseDouble(display.getText());&lt;/span&gt;  now for the function we are doing we need to set that function to true. since button[3] is our add function we set function[0] equal to true, as function[0] is our adding.  now we have to reset the text in the display to get our value for our second temporary before equals is hit, with a simple &lt;span class=&quot;inlinecode&quot;&gt;display.setText(&amp;quot;&amp;quot;);&lt;/span&gt;  So now do this with the other buttons that have functions, remembering that (function[0] is adding, function[1] is subtracting, function[2] is multiplying, and function[3] is dividing).&lt;br /&gt;
&lt;br /&gt;
Now simply enough we just need to use those methods we created for those buttons.&lt;br /&gt;
The clear button will have &lt;span class=&quot;inlinecode&quot;&gt;clear();&lt;/span&gt; called, the plus minus button will have &lt;span class=&quot;inlinecode&quot;&gt;getPosNeg();&lt;/span&gt; called, the square root button will have &lt;span class=&quot;inlinecode&quot;&gt;getSqrt();&lt;/span&gt; called, and the equals button will have &lt;span class=&quot;inlinecode&quot;&gt;getResult();&lt;/span&gt; called.&lt;br /&gt;
&lt;br /&gt;
Your final source code should look similar to this:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Calculator extends JFrame implements ActionListener {
    
    JPanel&amp;#91;&amp;#93; row = new JPanel&amp;#91;5&amp;#93;;
    JButton&amp;#91;&amp;#93; button = new JButton&amp;#91;19&amp;#93;;
    String&amp;#91;&amp;#93; buttonString = {&amp;quot;7&amp;quot;, &amp;quot;8&amp;quot;, &amp;quot;9&amp;quot;, &amp;quot;+&amp;quot;,
                             &amp;quot;4&amp;quot;, &amp;quot;5&amp;quot;, &amp;quot;6&amp;quot;, &amp;quot;-&amp;quot;,
                             &amp;quot;1&amp;quot;, &amp;quot;2&amp;quot;, &amp;quot;3&amp;quot;, &amp;quot;*&amp;quot;,
                             &amp;quot;.&amp;quot;, &amp;quot;/&amp;quot;, &amp;quot;C&amp;quot;, &amp;quot;&amp;#8730;&amp;quot;,
                             &amp;quot;+/-&amp;quot;, &amp;quot;=&amp;quot;, &amp;quot;0&amp;quot;};
    int&amp;#91;&amp;#93; dimW = {300,45,100,90};
    int&amp;#91;&amp;#93; dimH = {35, 40};
    Dimension displayDimension = new Dimension(dimW&amp;#91;0&amp;#93;, dimH&amp;#91;0&amp;#93;);
    Dimension regularDimension = new Dimension(dimW&amp;#91;1&amp;#93;, dimH&amp;#91;1&amp;#93;);
    Dimension rColumnDimension = new Dimension(dimW&amp;#91;2&amp;#93;, dimH&amp;#91;1&amp;#93;);
    Dimension zeroButDimension = new Dimension(dimW&amp;#91;3&amp;#93;, dimH&amp;#91;1&amp;#93;);
    boolean&amp;#91;&amp;#93; function = new boolean&amp;#91;4&amp;#93;;
    double&amp;#91;&amp;#93; temporary = {0, 0};
    JTextArea display = new JTextArea(1,20);
    Font font = new Font(&amp;quot;Times new Roman&amp;quot;, Font.BOLD, 14);
    
    Calculator() {
        super(&amp;quot;Calculator&amp;quot;);
        setDesign();
        setSize(380, 250);
        setResizable(false);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        GridLayout grid = new GridLayout(5,5);
        setLayout(grid);
        
        for(int i = 0; i &amp;lt; 4; i++)
            function&amp;#91;i&amp;#93; = false;
        
        FlowLayout f1 = new FlowLayout(FlowLayout.CENTER);
        FlowLayout f2 = new FlowLayout(FlowLayout.CENTER,1,1);
        for(int i = 0; i &amp;lt; 5; i++)
            row&amp;#91;i&amp;#93; = new JPanel();
        row&amp;#91;0&amp;#93;.setLayout(f1);
        for(int i = 1; i &amp;lt; 5; i++)
            row&amp;#91;i&amp;#93;.setLayout(f2);
        
        for(int i = 0; i &amp;lt; 19; i++) {
            button&amp;#91;i&amp;#93; = new JButton();
            button&amp;#91;i&amp;#93;.setText(buttonString&amp;#91;i&amp;#93;);
            button&amp;#91;i&amp;#93;.setFont(font);
            button&amp;#91;i&amp;#93;.addActionListener(this);
        }
        
        display.setFont(font);
        display.setEditable(false);
        display.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        display.setPreferredSize(displayDimension);
        for(int i = 0; i &amp;lt; 14; i++)
            button&amp;#91;i&amp;#93;.setPreferredSize(regularDimension);
        for(int i = 14; i &amp;lt; 18; i++)
            button&amp;#91;i&amp;#93;.setPreferredSize(rColumnDimension);
        button&amp;#91;18&amp;#93;.setPreferredSize(zeroButDimension);
        
        row&amp;#91;0&amp;#93;.add(display);
        add(row&amp;#91;0&amp;#93;);
        
        for(int i = 0; i &amp;lt; 4; i++)
            row&amp;#91;1&amp;#93;.add(button&amp;#91;i&amp;#93;);
        row&amp;#91;1&amp;#93;.add(button&amp;#91;14&amp;#93;);
        add(row&amp;#91;1&amp;#93;);
        
        for(int i = 4; i &amp;lt; 8; i++)
            row&amp;#91;2&amp;#93;.add(button&amp;#91;i&amp;#93;);
        row&amp;#91;2&amp;#93;.add(button&amp;#91;15&amp;#93;);
        add(row&amp;#91;2&amp;#93;);
        
        for(int i = 8; i &amp;lt; 12; i++)
            row&amp;#91;3&amp;#93;.add(button&amp;#91;i&amp;#93;);
        row&amp;#91;3&amp;#93;.add(button&amp;#91;16&amp;#93;);
        add(row&amp;#91;3&amp;#93;);
        
        row&amp;#91;4&amp;#93;.add(button&amp;#91;18&amp;#93;);
        for(int i = 12; i &amp;lt; 14; i++)
            row&amp;#91;4&amp;#93;.add(button&amp;#91;i&amp;#93;);
        row&amp;#91;4&amp;#93;.add(button&amp;#91;17&amp;#93;);
        add(row&amp;#91;4&amp;#93;);
        
        setVisible(true);
    }
    
    public void clear() {
        try {
            display.setText(&amp;quot;&amp;quot;);
            for(int i = 0; i &amp;lt; 4; i++)
                function&amp;#91;i&amp;#93; = false;
            for(int i = 0; i &amp;lt; 2; i++)
                temporary&amp;#91;i&amp;#93; = 0;
        } catch(NullPointerException e) {  
        }
    }
    
    public void getSqrt() {
        try {
            double value = Math.sqrt(Double.parseDouble(display.getText()));
            display.setText(Double.toString(value));
        } catch(NumberFormatException e) {
        }
    }
    
    public void getPosNeg() {
        try {
            double value = Double.parseDouble(display.getText());
            if(value &amp;#33;= 0) {
                value = value * (-1);
                display.setText(Double.toString(value));
            }
            else {
            }
        } catch(NumberFormatException e) {
        }
    }
    
    public void getResult() {
        double result = 0;
        temporary&amp;#91;1&amp;#93; = Double.parseDouble(display.getText());
        String temp0 = Double.toString(temporary&amp;#91;0&amp;#93;);
        String temp1 = Double.toString(temporary&amp;#91;1&amp;#93;);
        try {
            if(temp0.contains(&amp;quot;-&amp;quot;)) {
                String&amp;#91;&amp;#93; temp00 = temp0.split(&amp;quot;-&amp;quot;, 2);
                temporary&amp;#91;0&amp;#93; = (Double.parseDouble(temp00&amp;#91;1&amp;#93;) * -1);
            }
            if(temp1.contains(&amp;quot;-&amp;quot;)) {
                String&amp;#91;&amp;#93; temp11 = temp1.split(&amp;quot;-&amp;quot;, 2);
                temporary&amp;#91;1&amp;#93; = (Double.parseDouble(temp11&amp;#91;1&amp;#93;) * -1);
            }
        } catch(ArrayIndexOutOfBoundsException e) {
        }
        try {
            if(function&amp;#91;2&amp;#93; == true)
                result = temporary&amp;#91;0&amp;#93; * temporary&amp;#91;1&amp;#93;;
            else if(function&amp;#91;3&amp;#93; == true)
                result = temporary&amp;#91;0&amp;#93; / temporary&amp;#91;1&amp;#93;;
            else if(function&amp;#91;0&amp;#93; == true)
                result = temporary&amp;#91;0&amp;#93; + temporary&amp;#91;1&amp;#93;;
            else if(function&amp;#91;1&amp;#93; == true)
                result = temporary&amp;#91;0&amp;#93; - temporary&amp;#91;1&amp;#93;;
            display.setText(Double.toString(result));
            for(int i = 0; i &amp;lt; 4; i++)
                function&amp;#91;i&amp;#93; = false;
        } catch(NumberFormatException e) {
        }
    }
    
    public final void setDesign() {
        try {
            UIManager.setLookAndFeel(
                    &amp;quot;com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel&amp;quot;);
        } catch(Exception e) {   
        }
    }
    
    @Override
    public void actionPerformed(ActionEvent ae) {
        if(ae.getSource() == button&amp;#91;0&amp;#93;)
            display.append(&amp;quot;7&amp;quot;);
        if(ae.getSource() == button&amp;#91;1&amp;#93;)
            display.append(&amp;quot;8&amp;quot;);
        if(ae.getSource() == button&amp;#91;2&amp;#93;)
            display.append(&amp;quot;9&amp;quot;);
        if(ae.getSource() == button&amp;#91;3&amp;#93;) {
            //add function&amp;#91;0&amp;#93;
            temporary&amp;#91;0&amp;#93; = Double.parseDouble(display.getText());
            function&amp;#91;0&amp;#93; = true;
            display.setText(&amp;quot;&amp;quot;);
        }
        if(ae.getSource() == button&amp;#91;4&amp;#93;)
            display.append(&amp;quot;4&amp;quot;);
        if(ae.getSource() == button&amp;#91;5&amp;#93;)
            display.append(&amp;quot;5&amp;quot;);
        if(ae.getSource() == button&amp;#91;6&amp;#93;)
            display.append(&amp;quot;6&amp;quot;);
        if(ae.getSource() == button&amp;#91;7&amp;#93;) {
            //subtract function&amp;#91;1&amp;#93;
            temporary&amp;#91;0&amp;#93; = Double.parseDouble(display.getText());
            function&amp;#91;1&amp;#93; = true;
            display.setText(&amp;quot;&amp;quot;);
        }
        if(ae.getSource() == button&amp;#91;8&amp;#93;)
            display.append(&amp;quot;1&amp;quot;);
        if(ae.getSource() == button&amp;#91;9&amp;#93;)
            display.append(&amp;quot;2&amp;quot;);
        if(ae.getSource() == button&amp;#91;10&amp;#93;)
            display.append(&amp;quot;3&amp;quot;);
        if(ae.getSource() == button&amp;#91;11&amp;#93;) {
            //multiply function&amp;#91;2&amp;#93;
            temporary&amp;#91;0&amp;#93; = Double.parseDouble(display.getText());
            function&amp;#91;2&amp;#93; = true;
            display.setText(&amp;quot;&amp;quot;);
        }
        if(ae.getSource() == button&amp;#91;12&amp;#93;)
            display.append(&amp;quot;.&amp;quot;);
        if(ae.getSource() == button&amp;#91;13&amp;#93;) {
            //divide function&amp;#91;3&amp;#93;
            temporary&amp;#91;0&amp;#93; = Double.parseDouble(display.getText());
            function&amp;#91;3&amp;#93; = true;
            display.setText(&amp;quot;&amp;quot;);
        }
        if(ae.getSource() == button&amp;#91;14&amp;#93;)
            clear();
        if(ae.getSource() == button&amp;#91;15&amp;#93;)
            getSqrt();
        if(ae.getSource() == button&amp;#91;16&amp;#93;)
            getPosNeg();
        if(ae.getSource() == button&amp;#91;17&amp;#93;)
            getResult();
        if(ae.getSource() == button&amp;#91;18&amp;#93;)
            display.append(&amp;quot;0&amp;quot;);
    }
    
    public static void main(String&amp;#91;&amp;#93; arguments) {
        Calculator c = new Calculator();
    }
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a fully working calculator, that should look like this&lt;br /&gt;
&lt;br /&gt;
&lt;img src='http://i.imgur.com/FoRYugi.png' alt='Posted Image' class='bbc_img' /&gt;&lt;br /&gt;
&lt;br /&gt;
If you have any questions, suggestions, or errors, please post away&amp;#33; Enjoy &lt;img src='http://cdn.dreamincode.net/forums/public/style_emoticons/&lt;#EMO_DIR#&gt;/smile.gif' class='bbc_emoticon' alt=':)' /&gt;/&amp;gt;</description>
			<category>Java Tutorials</category>
			<pubDate>Mon, 27 May 2013 23:49:03 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/index.php?automodule=blog&amp;blogid=217&amp;showentry=4474</link>
            <title>A Simple Memoization Function Class.</title>
            <description>&lt;span class='bbc_underline'&gt;&lt;strong class='bbc'&gt;A Simple Memoization Function Class.&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Memoization is simply remembering the previous worked out answers for the value inputted for the function.&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
Public Class Memo(Of T0 , T1 )
  Private TheFunction As Func(Of Memo(of T0,T1),T0,T1)
  Private MemoizationValues As New Dictionary(Of T0,T1)
  Public Sub New ( TheFunction As Func(of Memo(Of T0 , T1), T0, T1 ) )
    Me.TheFunction = TheFunction
  End Sub
  Public Default  Property Fun(x As T0) As T1
    Set(Value As T1)
      If Not MemoizationValues.ContainsKey(x) Then MemoizationValues(x) = Value 
    End Set
    Get
      If MemoizationValues.ContainsKey(x) Then Return MemoizationValues(x)
      Dim Value = TheFunction(Me,x)
      MemoizationValues(x)=Value
      Return Value
    End Get
  End Property
End Class
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now let define a few functions.&lt;br /&gt;
&lt;br /&gt;
&lt;span class='bbc_underline'&gt;&lt;strong class='bbc'&gt;Fibonacci&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
Dim fib As New Memo(Of BigInteger, BigInteger)(Function(f,x) f(x-2) + f(x-1))
fib(0) = 0
fib(1) = 1

Console.WriteLine(&amp;quot;Fib(10) = &amp;quot;, Fib(10))
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class='bbc_underline'&gt;&lt;strong class='bbc'&gt;Factorial&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
Dib Fact As New Memo(Of BigInteger, BigInteger(Function(f,x) x * f(x-1))
f(0) = 1

Console.WriteLine(&amp;quot;Fact(10) = &amp;quot;, Fact(10) )
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Both are rather close to how you would write the mathematically.</description>
			<category>The Madman Scribblings</category>
			<pubDate>Sun, 26 May 2013 19:14:00 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/321825-linear-algebra-primer-part-2-linear-independence-and-matroids/</link>
            <title>Linear Algebra Primer: Part 2- Linear Independence And Matroids</title>
            <description>&lt;strong class='bbc'&gt;Linear Algebra Primer: Part 2- Linear Independence and Matroids&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial will introduce the concept Linear Independence. It will also briefly introduce Matroid Theory, which branches into the realms of graph theory and abstract algebra as well.&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Independence&lt;/strong&gt;&lt;br /&gt;
In Graph Theory, Abstract Algebra, and Linear Algebra, there is a concept known as &lt;span class=&quot;inlinecode&quot;&gt;(in)dependence&lt;/span&gt;. The idea behind independence is if a structure is acyclic. In Graph Theory, that is pretty easy to see. Any forest or tree is independent, as they are acyclic. Another way to look at independence from a Graph Theory perspective is that there exists a unique path between two vertices. If there is a cycle, there are at least two paths between two vertices. Consider the trivial cycle &lt;span class=&quot;inlinecode&quot;&gt;C&lt;sub class='bbc'&gt;3&lt;/sub&gt;&lt;/span&gt; with vertices labeled A, B, and C. From vertex A-C, there are two paths: A-C and A-B-C. There are two paths from A-B and B-C as well. Consider the examples below of independent and dependent graphs. It is clear that the first graph is independent, as it has no cycles. The second graph is dependent, as it contains a cycle as a subgraph. The last graph is a circuit itself, so it is clearly dependent.&lt;br /&gt;
&lt;br /&gt;
[attachment=33127:Independent_Graphs.jpg]&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s now discuss Linear Independence, which is what pertains to Linear Algebra. A set of vectors (set S) is defined to be linearly independent when no vector in the set can be formed from a linear combination of the other vectors. Another way to describe linear independence is in terms of span. So if S is linearly independent, then all the vectors in span(S) (the span of S is the set of all vectors formed from linear combinations of the vectors in S) are formed from a unique linear combination of the vectors in S. A set of vectors that is not linearly independent is called linearly dependent.&lt;br /&gt;
&lt;br /&gt;
This concept of linear independence is a little abstract, so let&amp;#39;s decompose it. Consider the following vector sets: &lt;ul class='bbc'&gt;&lt;li&gt; &lt;span class=&quot;inlinecode&quot;&gt;S = {(1, 2, 3), (4, 5, 6)}&lt;/span&gt;: Here, &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; is linearly independent. There is no way to form &lt;span class=&quot;inlinecode&quot;&gt;(4, 5, 6)&lt;/span&gt; from multiples of &lt;span class=&quot;inlinecode&quot;&gt;(1, 2, 3)&lt;/span&gt;. &lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;span class=&quot;inlinecode&quot;&gt;S = {(1, 2, 3), (2, 4, 6), (3, 4, 5)}&lt;/span&gt;: Here &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; is linearly dependent. It is clear that &lt;span class=&quot;inlinecode&quot;&gt;(2, 4, 6) = 2(1, 2, 3) + 0(3, 4, 5)&lt;/span&gt;, so a vector in &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; is formed from a linear combination of the other two vectors.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s back up and revisit the graph theory intuition. A structure is graphically independent if there exists a unique path for all pairs of vertices. Regarding linear independence, if there is a unique linear combination for each vector in span(S), that could be thought of as a unique path. Similarly, if S is linearly dependent, then the linear combination to form an arbitrary vector &lt;span class=&quot;inlinecode&quot;&gt;v&lt;/span&gt; in S could be substituted in for &lt;span class=&quot;inlinecode&quot;&gt;v&lt;/span&gt; to create two linear combinations. Thus, there are two paths to the same end result.&lt;br /&gt;
&lt;br /&gt;
It is easy for small sets to determine independence. It gets trickier to eyeball and construct linear combinations for larger vector sets, especially when the Vector Space is bigger than a 2-3 dimensions. Let&amp;#39;s talk about some heuristics to use: &lt;ul class='bbc'&gt;&lt;li&gt; The Multiples Test: If there are two vectors in the set, &lt;strong class='bbc'&gt;a&lt;/strong&gt; and &lt;strong class='bbc'&gt;b&lt;/strong&gt;, such that k&lt;strong class='bbc'&gt;a&lt;/strong&gt; = &lt;strong class='bbc'&gt;b&lt;/strong&gt;, for some constant &lt;span class=&quot;inlinecode&quot;&gt;k&lt;/span&gt;, then the set of vectors is linearly dependent.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Determinant Test: If the Vector Space is of dimension &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; and &lt;span class=&quot;inlinecode&quot;&gt;|S| = n&lt;/span&gt;, then the determinant test can be used. Consider a matrix &lt;span class=&quot;inlinecode&quot;&gt;M&lt;/span&gt; whose column vectors are the vectors in &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt;. The set &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; is linearly independent if and only if &lt;span class=&quot;inlinecode&quot;&gt;det(M) &amp;#33;= 0&lt;/span&gt;. &lt;br /&gt;&lt;/li&gt;&lt;li&gt; Dimension Test: If the Vector Space is of dimension &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; and &lt;span class=&quot;inlinecode&quot;&gt;|S| &amp;gt; n&lt;/span&gt;, then &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; is linearly dependent. Let&amp;#39;s explore the intuition behind this a little more. If there are &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; dimensions, then there are &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; independent coordinate axes. So a subset of independent axes (or vectors) is independent. However, any extra axes produce a dependence. It isn&amp;#39;t necessary to have two y-axes when only one will do.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Linear Combinations Test: When all else fails, this is a good test to fall back on. Row reduction can help expedite the process. Consider a matrix &lt;span class=&quot;inlinecode&quot;&gt;M&lt;/span&gt; whose column vectors are the vectors in &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt;. If &lt;span class=&quot;inlinecode&quot;&gt;|S| = n&lt;/span&gt; and there are &lt;span class=&quot;inlinecode&quot;&gt;n&lt;/span&gt; distinct vectors that will satisfy the equation &lt;span class=&quot;inlinecode&quot;&gt;M&lt;/span&gt;&lt;strong class='bbc'&gt;x&lt;/strong&gt; = &lt;strong class='bbc'&gt;0&lt;/strong&gt;, where &lt;strong class='bbc'&gt;x&lt;/strong&gt; and &lt;strong class='bbc'&gt;0&lt;/strong&gt; are vectors, then &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; is linearly independent. Otherwise, &lt;span class=&quot;inlinecode&quot;&gt;S&lt;/span&gt; is linearly dependent.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Introduction to Matroid Theory&lt;/strong&gt;&lt;br /&gt;
Matroids are structures that encapsulate this concept of independence found in graph theory, abstract algebra, and linear algebra. A Matroid is constructed from a ground set G. From this ground set, a second set I is constructed that contains all the independent subsets of the ground set. Thus, if the ground set is independent, then the I = P(G), where P(G) is the power set of G.&lt;br /&gt;
&lt;br /&gt;
Matroids allow for isomorphisms between Linear Algebra and Graph Theory. When dealing with Graphs, Matroids are constructed from the edge sets. Thus, the intuition developed above regarding graph theory and independence is more than just intuition. Matroids are a tool to answer graph questions using linear algebra, and linear algebra questions using graph theory. Some of these applications include path finding, matchings, scheduling, spanning trees, and planarity.&lt;br /&gt;
&lt;br /&gt;
Matroids have three fundamental properties or axioms. This first property states that no subset of a circuit is a circuit. Think about it this way. If a set of vectors is linearly independent, that means that no vector in the set can be formed from a linear combination of the other vectors. So removing a vector from the set won&amp;#39;t change this fact. From a graph theory perspective, a circuit is formed by adding edges, not removing them. Thus, this first property makes sense.&lt;br /&gt;
&lt;br /&gt;
The second property states that the null set is independent, which follows from the first property. The null set has no elements; thus, no circuits.&lt;br /&gt;
&lt;br /&gt;
The final property states that all maximally independent subsets of the ground set all have the same cardinality. Consider the graph &lt;span class=&quot;inlinecode&quot;&gt;C&lt;sub class='bbc'&gt;n&lt;/sub&gt;&lt;/span&gt;. Clearly, removing one edge from the graph leaves a spanning tree, which is independent. Any arbitrary edge can be removed for the same result- a maximally independent subgraph. The same argument can be made for a set of Vectors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Conclusion&lt;/strong&gt;&lt;br /&gt;
I hope that this tutorial has been helpful in introducing the concept of Linear Independence. The introduction of Matroids is but the beginning of where Linear Algebra overlaps with Graph Theory. There will be future tutorials on Algebraic Graph Theory, which utilizes Linear Algebra to analyze graphs.</description>
			<category>Software Development Tutorials</category>
			<pubDate>Sun, 26 May 2013 01:51:03 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/index.php?automodule=blog&amp;blogid=1267&amp;showentry=4471</link>
            <title>DevOps For Dummies - VPS Configuration From Scratch - Rails, Nginx, PostgreSQL.</title>
            <description>Hi guys, just finished writing an article showing you how to set up an Ubuntu VPS from scratch for Ruby on Rails development.&lt;br /&gt;
&lt;br /&gt;
Check it out here:&lt;br /&gt;
&lt;br /&gt;
&lt;a href='http://tech.pro/tutorial/1335/devops-for-dummies-vps-configuration-from-scratch-rails-nginx-postgresql' class='bbc_url' title='External link' rel='external'&gt;http://tech.pro/tuto...ginx-postgresql&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Hopefully it saves some of you some migraines when you&amp;#39;re starting out.</description>
			<category>Sergio Tapia - Lost in the GC.</category>
			<pubDate>Wed, 22 May 2013 21:36:00 +0000</pubDate>
         </item>
         <item>
            <link>http://www.dreamincode.net/forums/topic/321402-introduction-to-computational-complexity/</link>
            <title>Introduction To Computational Complexity</title>
            <description>&lt;strong class='bbc'&gt;Introduction to Computational Complexity&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial will cover basic algorithm analysis, specifically the time complexity of algorithms. The tools used include Big-O, Big-Omega, and Big-Theta. This tutorial will also discuss some of the mathematical properties of Big-O, Big-Omega, and Big-Theta. I have attached a PDF version of the tutorial, which is typeset using LaTeX, for those of you who would prefer to view it in that format.&lt;br /&gt;
[attachment=33064:Complexity_Tutorial.pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Big-O and Big-Omega&lt;/strong&gt;&lt;br /&gt;
First, let&amp;#39;s define Big-O and Big-Theta. A function f(n) is O(g(n)) if and only if there exist constants C and k in the set of positive integers such that |f(x)| &amp;lt;= C * |g(x)|, for all x &amp;gt;= k. In other words, Big-O is an upper bound. Some examples include: &lt;br /&gt;
-f(n) = 3n is O(n)&lt;br /&gt;
-f(n) = 2&lt;sup class='bbc'&gt;n&lt;/sup&gt; + n&lt;sup class='bbc'&gt;2&lt;/sup&gt; is O(2&lt;sup class='bbc'&gt;n&lt;/sup&gt;), as 2&lt;sup class='bbc'&gt;n&lt;/sup&gt; is the dominant term. Looking at this more mathematically, 2&lt;sup class='bbc'&gt;n&lt;/sup&gt; + n&lt;sup class='bbc'&gt;2&lt;/sup&gt; &amp;lt;= 2 * 2&lt;sup class='bbc'&gt;n&lt;/sup&gt;. So let C = 2 and k = 4 to satisfy the definition of Big-O.&lt;br /&gt;
&lt;br /&gt;
Similarly, a function f(n) is Omega(g(n)) if and only if there exist constants C and k in the set of positive integers such that |f(x)| &amp;gt;= C * |g(x)|, for all x &amp;gt;= k. In other words, Big-Omega is a lower bound.Some examples include:&lt;br /&gt;
-f(n) = 3n is Omega(log(n))&lt;br /&gt;
-f(n) = 2&lt;sup class='bbc'&gt;n&lt;/sup&gt; + n&lt;sup class='bbc'&gt;2&lt;/sup&gt; is Omega(n)&lt;br /&gt;
&lt;br /&gt;
From the definitions of Big-O and Big-Omega, it can be concluded that f(n) is O(g(n)) if and only if g(n) is Omega(f(n)). More exactingly, if f(n) is O(g(n)) and g(n) is O(f(n)), then f(n) and g(n) belong to the same complexity class. The same can be said of Big-Omega. Thus, Big-O and Big-Omega are anti-symmetric relations.&lt;br /&gt;
&lt;br /&gt;
With a little more work, it is easy to show that Big-O and Big-Omega are partial-order relations. A partial order relation is reflexive, anti-symmetric, and transitive. Consider reflexivity: f(n) is O(f(n)), and f(n) is Omega(f(n)). &lt;br /&gt;
&lt;br /&gt;
Big-O and Big-Omega are also transitive. Consider if f(n) is O(g(n)) and g(n) is O(h(n)), this shows that &lt;span class=&quot;inlinecode&quot;&gt;|f(n)| &amp;lt;= C&lt;sub class='bbc'&gt;1&lt;/sub&gt;|g(n)| &amp;lt;= C&lt;sub class='bbc'&gt;2&lt;/sub&gt;|h(n)|&lt;/span&gt;. Thus, f(n) is O(h(n)). Replacing Big-O with Big-Omega, and inverting the &amp;lt;= operator to the &amp;gt;= operator shows that Big-Omega is transitive as well.&lt;br /&gt;
&lt;br /&gt;
Now let&amp;#39;s develop a little more intuition for the information provided by Big-O and Big-Omega. Consider the following statements about an algorithm:&lt;br /&gt;
-It is O(n&lt;sup class='bbc'&gt;3&lt;/sup&gt;)&lt;br /&gt;
-It is O(n&amp;#33;)&lt;br /&gt;
-It is Omega(n&lt;sup class='bbc'&gt;2&lt;/sup&gt;)&lt;br /&gt;
-It is Omega(n)&lt;br /&gt;
&lt;br /&gt;
Here, knowing the algorithm is O(n&lt;sup class='bbc'&gt;3&lt;/sup&gt;) provides significantly more information than that the algorithm is O(n&amp;#33;). Similarly, knowing that an algorithm is Omega(n&lt;sup class='bbc'&gt;2&lt;/sup&gt;) provides more information than that the algorithm is Omega(n).&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Big-Theta&lt;/strong&gt;&lt;br /&gt;
While Big-O and Big-Theta are the upper and lower bounds, respectively, Big-Theta is the exact bound. A function f(n) is Theta(g(n)) if and only if f(n) is O(g(n)) and Omega(g(n)). While Big-O and Big-Omega are partial order relations, Big-Theta is an equivalence relation. That means that Big-Theta is reflexive, symmetric, and transitive.&lt;br /&gt;
&lt;br /&gt;
Since Big-O and Big-Omega are both reflexive and transitive, Big-Theta is reflexive and transitive as well. To prove symmetry, consider f(n) is Theta(g(n)). This implies that f(n) is O(g(n)) and f(n) is Omega(g(n)). By anti-symmetry of Big-O, it can be inferred that g(n) is Omega(f(n)). Similarly, by anti-symmetry of Big-Omega, g(n) is O(f(n)). Thus, g(n) is Theta(f(n)). So Big-Theta is symmetric; and thus, it is an equivalence relation.&lt;br /&gt;
&lt;br /&gt;
As Big-O, Big-Omega, and Big-Theta all describe the long-term asymptotic beh&amp;#097;vior of a function, the limit test is useful in determining the bounds for a function. Consider the following theorem. Let L = lim(n--&amp;#62;infinity) f(n)/g(n).&lt;br /&gt;
&lt;br /&gt;
If L = 0, the g(n) strictly dominates f(n). Thus, it can be concluded that f(n) is O(g(n)).&lt;br /&gt;
&lt;br /&gt;
If L = c, where c is finite, then f(n) and g(n) grow at the same asymptotic rate. Thus, f(n) is Theta(g(n)).&lt;br /&gt;
&lt;br /&gt;
Finally, if L = infinity, then the f(n) term dominates the g(n) term, so g(n) is a lower bound for f(n). Thus, f(n) is Omega(g(n)). &lt;br /&gt;
&lt;br /&gt;
This theorem is incredibly useful in determining the complexities of functions, especially when the dominant term isn&amp;#39;t clear. If the dominant term is clear, then this theorem implies that the function is Theta(dominant term). So if f(n) = 3n&lt;sup class='bbc'&gt;2&lt;/sup&gt; + 2n + 1, then f(n) is Theta(n&lt;sup class='bbc'&gt;2&lt;/sup&gt;).&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s look at an example. Let f(n) = n&lt;sup class='bbc'&gt;4&lt;/sup&gt; + n&lt;sup class='bbc'&gt;2&lt;/sup&gt;log(n) + 3&lt;sup class='bbc'&gt;n&lt;/sup&gt;, and g(n) = 8n&lt;sup class='bbc'&gt;6&lt;/sup&gt;. The lim(n--&amp;#62;infinity) f(n)/g(n) is infinity, so f(n) is Omega(g(n)). Looking at the complexity of f(n), it is easy to see that 3&lt;sup class='bbc'&gt;n&lt;/sup&gt; is the dominant term, so f(n) is Theta(3&lt;sup class='bbc'&gt;n&lt;/sup&gt;). The limit f(n)/3&lt;sup class='bbc'&gt;n&lt;/sup&gt; = 1, which confirms the intuition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Deriving The Runtime Function of an Algorithm&lt;/strong&gt;&lt;br /&gt;
While the previous sections covered more of the theory behind computational complexity, this section will provide some application. Analyzing an algorithm relies on a set of rules for deriving T(n), the runtime function. While these rules may vary slightly, a good rule of thumb is that input, output, use of operators (mathematical, logical, bitwise, etc.), return statements, and array references all take Theta(1) time, so just treat them as 1 unit when constructing T(n). In most cases, these are language constructs, and really don&amp;#39;t have a long-term impact on the algorithm implementation.&lt;br /&gt;
&lt;br /&gt;
When evaluating a loop or conditional block, always evaluate the worst case. In other words, assume that the loop runs the maximal number of times. On each iteration, the condition counts is evaluated. So if the loop runs n times, then the condition is evaluated n times.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s look at an example:&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
for i = 0, i &amp;lt; array.length, i = i + 1
        array&amp;#91;i&amp;#93; = 0
end for
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Let &lt;span class=&quot;inlinecode&quot;&gt;n = array.length&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s start with what we know: &lt;ul class='bbc'&gt;&lt;li&gt; &lt;span class=&quot;inlinecode&quot;&gt;i = 0&lt;/span&gt; is an assignment, so count that as a constant 1.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;span class=&quot;inlinecode&quot;&gt;i &amp;lt; array.length&lt;/span&gt; is a constant 2 (1 for array.length and 1 for the comparison), and is evaluated n times, so count it as 2n.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;span class=&quot;inlinecode&quot;&gt;i = i + 1&lt;/span&gt; is composed of a mathematical operation and an assignment, and is evaluated n times. So its runtime complexity is 2n.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Finally, &lt;span class=&quot;inlinecode&quot;&gt;array[i] = 0&lt;/span&gt; is an assignment and an array reference, so an individual operation is 2 units. It is evaluated n times, so its complexity is 2n.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
Thus, T(n) = 6n + 1. &lt;br /&gt;
&lt;br /&gt;
Thus, it is easy to see that this algorithm is Theta(n). It can be proven by taking lim(n--&amp;#62;infinity)T(n)/n = 6 + 1/infinity = 6 + 0 = 6. Thus, as the limit converges to a finite constant, T(n) is Theta(n).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s look at one more example- the binary search. The time intervals are marked with comments.&lt;br /&gt;
&lt;pre class='brush: bash ;'&gt;
function binarySearch(array arr, target)
     low = 0 //1
     high = arr.length - 1  //2

     while(low &amp;lt;= high) //1
        mid = (low + high)/2  //assignment is 1, and 2 math statements, so 3

        if(arr&amp;#91;mid&amp;#93; == target) //array&amp;#91;mid&amp;#93; is 1, comparison is 1, so 2
            return mid  //1

        else if(arr&amp;#91;mid&amp;#93; &amp;gt; target) //array&amp;#91;mid&amp;#93; is 1, comparison is 1, so 2
            low = mid + 1 //math is 1, assignment is 1, so 2
        
        else 
            hi = mid - 1 //2
    end while

    return -1 //1
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
So T(n) = 5 + cost(loop). So if the loop never executes, then the condition is still checked, hence why the constant term is 5 rather than 4.&lt;br /&gt;
&lt;br /&gt;
On one iteration of the loop, the worst case cost is 10. The first iteration of the loop evaluates the entire array. It then partitions the array in half on subsequent iterations. Thus, it takes log(n+1) iterations to find the element or determine it doesn&amp;#39;t exist in the loop. Thus, T(n) = 5 + 10log(n+1). Thus, T(n) is Theta(log(n)), as the logarithm is the dominant term.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong class='bbc'&gt;Conclusion&lt;/strong&gt;&lt;br /&gt;
Algorithm analysis gets more involved, with more advanced and complex algorithms. Often times, recurrence relations are used to determine runtime complexities. This tutorial is merely to introduce basic algorithm analysis techniques, rather than delve into more complex approaches. I hope you have found this tutorial helpful.</description>
			<category>Software Development Tutorials</category>
			<pubDate>Sun, 19 May 2013 23:40:26 +0000</pubDate>
         </item>
   </channel>
</rss>
