<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Steven Weiss on Medium]]></title>
        <description><![CDATA[Stories by Steven Weiss on Medium]]></description>
        <link>https://medium.com/@weiss.steven?source=rss-b0222708b70d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3mYzB_pSsdlofmngApLiqg.jpeg</url>
            <title>Stories by Steven Weiss on Medium</title>
            <link>https://medium.com/@weiss.steven?source=rss-b0222708b70d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 03:13:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@weiss.steven/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Today is March 23, 2020 - The Best Day to Fight Against Coronavirus in America]]></title>
            <link>https://medium.com/@weiss.steven/today-is-march-23-2020-the-best-day-to-fight-against-coronavirus-in-america-5785176f8642?source=rss-b0222708b70d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5785176f8642</guid>
            <dc:creator><![CDATA[Steven Weiss]]></dc:creator>
            <pubDate>Mon, 23 Mar 2020 20:12:02 GMT</pubDate>
            <atom:updated>2020-03-24T21:04:48.638Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are on the frontlines — thank you. May you get the equipment you need and continue to keep the resolve to move forward.</p><p>If you are an essential worker — bless you. May you get the respect you’ve always deserved when this is over.</p><p>If you are a knowledge worker — chin up. May this letter find you because it was written to you.</p><p>It’s easy to feel useless when you are non-essential. This couldn’t be further from the truth.</p><p>All these people you admire, fought a war and did it using knowledge: Grace Hopper, Buckminster Fuller, Robert Oppenheimer, Alan Turing.</p><p>Channel them and put your knowledge to good use in this battle. Because it is a battle, have no doubt about that.</p><p><strong>WHAT TO DO</strong></p><p>Of course, stay home and donate money. You have people to look after. You have capital — put it to use.</p><p>But what’s next:</p><ol><li>Call all your friends NOT in a lockdown state/province and make sure they are social distancing AND are disciplined about it</li><li>Solve a narrowly scoped problem</li><li>Continue to do research</li></ol><p>If you had to choose one thing and one thing only — <strong>do number 1.</strong></p><p>At this point, <strong>if you do number 1</strong>, and do it relentlessly, you need not read any further.</p><p><strong>HOW TO EXECUTE ON EACH TACTIC</strong></p><ol><li><strong>How to call people you know outside of a lockdown city/state/county*: (again, if you had to choose one — do this one)</strong></li></ol><p>Particular emphasis on people who live in Chicago, Dallas, Houston, Miami, Atlanta, New Orleans.</p><p>Draft a list of 5 people.</p><p>Ready yourself mentally to be patient. Use subtlety and do not tell them they are an idiot or lost or behind the times. <em>They</em> were <em>you </em>two weeks ago.</p><p>Call <strong>ONE</strong> of them.</p><p>Ask them how they are doing.</p><p>Ask them what they are doing to stay occupied while they are indoors.</p><p>Ask them what their neighbors are doing.</p><p>Ask them if they heard anything from their hospitals.</p><p>Ask them how they are communicating with their friends.</p><p>Ask them about them until it’s annoying.</p><p>Ask them if they think this is scary or if this will last a long time. See if they agree.</p><p>Ask them if they agree that the house is boring but better than the risk of getting the coronavirus.</p><p>Ask how long they think they will be indoors.</p><p>Ask them how they are getting groceries. Do they both go? In New York, they are doing a designated shopper.</p><p>Ask them if they have told other people about their GOOD behavior</p><p>Ask them if they had any advice to being safe.</p><p>Ask they if knew a good place to donate.</p><p>Wish them well.</p><p>Stay in touch till we move past this ordeal.</p><p><strong><em>DO THIS 4 more times.</em></strong></p><p><strong>Why is this the most important thing you can do?</strong></p><p>You may have noticed a very common attribute of this whole thing: We have always been behind in our actions. The virus is always ahead. It does not sleep. It does not have politics. It does not care if you are Chinese or if you are Danish. It does not care if you are from Brooklyn or Birmingham.</p><p>As of today, London is still deciding to what to do about workers. Kansas has not gone into lockdown. Domestic flights are still operating. Because being reactive is easiest to the mind.</p><p>Consider that Wuhan locked down at 400 people confirmed cases.</p><p>We are at 25,000 cases.</p><p>This is the list of states who are in lockdown as of today:</p><pre>California<br>Connecticut<br>Delaware<br>Illinois<br>Kentucky<br>New Jersey<br>New York<br>Ohio<br>Oregon<br>Pennsylvania<br>Wisconsin<br>Massachusetts<br>Michigan<br>Indiana</pre><p>That’s 14 states out of 50.</p><p>That’s 36 states, not in lockdown, at 25,000 KNOWN cases.</p><p>It’s simple : we are from the past, please call the future.</p><p><strong>2. How to solve a narrowly scoped problem</strong></p><p>It is clear, if you can help ONE person stay indoors <a href="https://twitter.com/ajitjohnson_n/status/1241897200457789441">https://twitter.com/ajitjohnson_n/status/1241897200457789441</a></p><p>So, imagine helping 10 people.</p><p><strong>Steps</strong></p><ol><li>Do some Googling. See if others are doing something similar and volunteer.</li><li>Think of your neighborhood or your friend group or your family</li><li>Call them and ask them what their problems might be</li><li>Solve them</li></ol><pre><strong>Problem:</strong> GROCERY LINE CADENCE IN BED-STUY NEIGHBORHOOD</pre><pre><strong>Solution v0: </strong>Ask people to go into grocery stores<br><strong>Solution v1: </strong>Send a package with tape, printed copy</pre><pre><strong>Resources: <br></strong>- sharpies <br>- rolls of tape from 99c store<br>- get in touch with Devin about designing a PDF<br>- write copy</pre><pre><strong>What we need YOU to do (Steps):</strong></pre><pre>1. ONLY do this on your next necessary grocery run</pre><pre>2. Add the linked photo to the WALLPAPER of your phone (so it’s ready to present) (Save/Download <a href="https://pbs.twimg.com/media/ETbxORRUcAI2z7i?format=jpg&amp;name=900x900">here</a>)</pre><pre>3. Carry masking tape and/or red sharpies</pre><pre>4. Show a cashier or security guard the photo and say, “Hi, Do you think I can see your manager, I am here to help implement this line system?</pre><pre>5. Tell the manager, they need to implement this (show photo).</pre><pre>6. Then, show them or do it for them.</pre><pre><strong>How to do create the line system:</strong></pre><pre>1. Start from the card machine at each cashier and walk 3–4 normal walking steps (6 feet / 2 meters). Do this at least 3 times per cashier </pre><pre>2. Take a photo and post to Instagram #everydaycoronaheroes with their grocery store address (this step is TBD)</pre><pre>3. Say &quot;thank you!&quot;</pre><pre>4. Post this entire instruction set on Instagram Stories</pre><p><strong>3. How to do research</strong></p><ol><li>Think of something</li><li>Do as much research as you can on it (for example, I learned as much as I could about N95 respirator masks over the weekend — what are they made of, why they work, what makes a mask “N95”, who produces them, why are they in short supply, does my mother who is a nurse think they are in short supply, what will be the gap between now and when a large manufacturer steps up, what are the good uses of my time, what are my competencies with respect to N95 masks, what are alternative solutions)</li><li>What did we end up with? We wrote a set of directions to clean and reuse the masks knowing that the huge companies would step up production. I wanted to fix a very small, but useful problem.</li><li>Be ready for the research to be useless. When it came to our N95 reuse mask, we were blessed that 3M said they were shipping 350,000 masks by Tuesday 3/24. I was pleased to hear from my mother that masks were being donated at a steady clip.</li><li>But if your research is oustanding it can be powerful:</li></ol><p>Example 1: <a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;ved=2ahUKEwiQrPywkbHoAhUuhHIEHUMcDp8QFjAAegQIBBAB&amp;url=https%3A%2F%2Fmedium.com%2F%40tomaspueyo%2Fcoronavirus-act-today-or-people-will-die-f4d3d9cd99ca&amp;usg=AOvVaw1CXWKIT9bBrnQiupGDTE2w">Coronavirus: Why You Must Act Now — Tomas Pueyo — Mediummedium.com › </a><a href="https://medium.com/u/a361390dbcf1">Tomas Pueyo</a></p><p>Example 2:<a href="https://medium.com/@Jason_Scott_Warner/why-we-are-not-doing-enough-to-stop-the-pandemic-in-simple-math-1722a5053cda">https://medium.com/@Jason_Scott_Warner/why-we-are-not-doing-enough-to-stop-the-pandemic-in-simple-math-1722a5053cda</a></p><p>These articles have been game changers.</p><p>I believe any knowledge worker should focus on <strong>problem 1</strong> — <strong>calling the future and telling them to get indoors</strong>.</p><p>If you have time, solve a local problem and do first-rate research.</p><p>Whatever you end up doing, may you have the strength to get into the arena, continue to do no harm, and stay safe.</p><p><strong>The best time to plant a tree was 20 years ago.</strong></p><p><strong>The next best time is today.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5785176f8642" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EV, Pascal’s Triangle, Binomial Theorem — ADI #17]]></title>
            <link>https://medium.com/@weiss.steven/ev-pascals-triangle-binomial-theorem-adi-17-ab5922d8a0d7?source=rss-b0222708b70d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab5922d8a0d7</guid>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Steven Weiss]]></dc:creator>
            <pubDate>Mon, 04 Feb 2019 05:11:53 GMT</pubDate>
            <atom:updated>2019-12-23T04:06:40.327Z</atom:updated>
            <content:encoded><![CDATA[<h3>EV, Pascal’s Triangle, Binomial Theorem — ADI #17</h3><p><em>(This is a continuing series where I work through the ArsDigita University computer science curriculum. This period of learning focuses on Discrete Mathematics. Each article is numbered in pedagogical order. ADI Uni can be found </em><a href="http://www.aduni.org/courses/"><em>here</em></a><em>)</em></p><p><strong>Expected Value</strong></p><p>Decisions are hard. What should we go with? What should we spend our time on? You would probably decide on the payoff for the decision. Intuitively, this mental calculation is called your expected value. But there is a precise way to calculate it.</p><p>Let’s take the game of rolling a die. In this game, I pay you based on the roll. What would be a fair price to get in the game? What should I charge you if I wanted to earn money?</p><pre>Die game:</pre><pre>1 = $1<br>2 = $2 etc.</pre><pre>To calculate the EV:<br>1+2+3+4+5+6 / 6 = $3.50</pre><pre>If I charge above 3.50 for you, I will earn money from your bets.  And if you can pay less than 3.50, you will earn money.  </pre><p>An alternative way to calculate the expected value is to calculate the probability of the event times the payout.</p><pre>Same but different game:<br>Roll an even: $1<br>1 =&gt; $3<br>3 =&gt; $9<br>6 =&gt; $15</pre><pre>EV(X) = P(of an even)*payout + P(1)*$3 + P(3)*$9 + P(6)*$15 =&gt; <br>1/2*1 + 1/6*$3 + 1/6*$9 + 1/6*$15 = $5</pre><pre>Don&#39;t get charged above $5.  Find a way to pay less than $5 to benefit. </pre><p><strong>Pascal’s Triangle</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*4NI_J9WcYm1_42kI.png" /></figure><p>Here we have Pascal’s Triangle. It is a number pattern triangulating between respective rows and the triangulated number below the row.</p><p>It is possible to view the numbers and see them as combinations of groups being chosen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*IxiJ5Lls88DB78ql.png" /></figure><pre>Viewing it this way gives us Pascal&#39;s Identity:</pre><pre>(n r) + (n r+1) = (n+1 r+1)</pre><p>There are patterns within the triangle in terms of combinations.</p><ol><li>We can add up a row and see that each row = n is equal to the powers of 2^n</li><li>We can push the rows together and get 11^k. Row 0 = 11⁰ = 1, Row 1 = 11¹ = 11, Row 2 = 11² = 121, Row 3 = 11³ = 1331</li><li>Diagonals into a hockey stick pattern give us the quantity of graph nodes. I want to get to 4 Choose 2 I can add the (3 choose 2 + 2 choose 1 + 1 choose 0).</li></ol><p><strong>Binomial Theorem</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab5922d8a0d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Probability — ADI #16]]></title>
            <link>https://medium.com/@weiss.steven/probability-adi-16-7089feb906e6?source=rss-b0222708b70d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7089feb906e6</guid>
            <dc:creator><![CDATA[Steven Weiss]]></dc:creator>
            <pubDate>Mon, 28 Jan 2019 04:35:30 GMT</pubDate>
            <atom:updated>2019-12-23T04:05:12.756Z</atom:updated>
            <content:encoded><![CDATA[<h3>Probability — ADI #16</h3><p><em>(This is a continuing series where I work through the ArsDigita University computer science curriculum. This period of learning focuses on Discrete Mathematics. Each article is numbered in pedagogical order. ADI Uni can be found </em><a href="http://www.aduni.org/courses/"><em>here</em></a><em>)</em></p><p><strong><em>Super Basic P(A)</em></strong></p><p>Probability is hard and not intuitive. But understanding it makes life easier to navigate. It allows you to see things in ranges. To call into questions odd statements of chance: Is something really 100% likely? Is everything really just 50/50? What does something mean to be a shot in the dark?</p><p>Probability itself is just a set of successful events divided by the total possible outcomes of the event. To flip a coin heads equals 1/2</p><pre>P(A) = # success heads / # possible outcomes </pre><pre>P(heads) = H / T or H =&gt; 1 / 1+1 = 2</pre><p>If the probability of the head is equal to 1/2 then the probability of its failure or success of tails is equal to 1/2 . The sum total of each event is equal to 1. This infers that probabilities, in general, are in the range of 0 to 1.</p><p><strong><em>Probability and Combinations</em></strong></p><p>In the previous blog, I discussed combinations or unordered groups and the possible ways to form those groups. But what if I want to know the probability of an occurrence to the group given some event?</p><p>Instead of the conference from the previous post, we have a simpler task — 3 people going to get lunch from a group of 6. Not everyone is enthusiastic about picking it up. We decide to pick some names out of a hat to see which group of three walks to the restaurant to grab the food. What is the probability I am chosen?</p><pre>P(in group to go) = # success / # possible</pre><pre>Situation where I am in the group:<br>Since I am chosen, it is 1 less than 6 choose 3.  </pre><pre># success / # possible = 5C2 / 6C3 =&gt; 5*4 / 2 * 1 // 6*5*4 / 3*2*1</pre><pre>10 / 20 = 1/2</pre><pre> # failure / # possible = 1 - # success == 1/2 in this particular case.</pre><p><strong><em>Mutually Exclusive and Not Mutually Exclusive Events</em></strong></p><p>Using our coin example, we notice that the head event and the tails event cannot occur at the same time. This is an example of a mutually exclusive event. The probability of mutually exclusive events is whether a particular event happens or another event happens. To calculate this we add all the individual probabilities of each discrete event.</p><pre>P(A or B) = P(A) + P(B)</pre><pre>P(heads or tails) = 1/2 + 1/2 = 1</pre><pre>P(1 or 6 on a die) = 1/6 + 1/6 = 1/3</pre><p>Sometimes events overlap and thus are not mutually exclusive.</p><p>In a 52-card deck, we can pull an Ace 4/52 and pull a space 13/52. we can see that it’s possible to pull an Ace of Spades.</p><pre>P(Ace or Space or Both) = 4/52 + 13/52 - 1/52 = 16/52 = 4/13</pre><p><strong><em>Independent Events</em></strong></p><p>Back to the coin, imagine I have flipped 4 consecutive heads? What is the probability I flip heads on the fifth flip?</p><pre>P(fifth head after four consecutive heads) = ...</pre><pre>Tricky, but the answer is just the 1/2 because flipping the coin is independent of what happenened prior to it.</pre><p>Guessing anything otherwise would mean you were subjected to the hot- hand fallacy. You think a string of events coming together have anything to do with each other. It’s easy to understand how rare any of this is by calculating how likely it would have been to get 5 heads in a row starting at zero coins flipped.</p><pre>P(5 heads in a row) = 1/2 * 1/2 * 1/2 * 1/2 * 1/2 = 1/32</pre><p>This leads to a general formula for independent events. We can say that all events happen at the same time without dependency, or that an event A and event B happened.</p><pre>P(A and B) = P(A) * P(B)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7089feb906e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[More Counting Techniques Part 2 — ADI #15]]></title>
            <link>https://medium.com/@weiss.steven/more-counting-techniques-part-2-adi-15-6594ff0b533a?source=rss-b0222708b70d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6594ff0b533a</guid>
            <dc:creator><![CDATA[Steven Weiss]]></dc:creator>
            <pubDate>Mon, 21 Jan 2019 01:16:21 GMT</pubDate>
            <atom:updated>2019-12-23T04:00:38.331Z</atom:updated>
            <content:encoded><![CDATA[<h3>More Counting Techniques — part 2 — ADI#15</h3><p><em>(This is a continuing series where I work through the ArsDigita University computer science curriculum. This period of learning focuses on Discrete Mathematics. Each article is numbered in pedagogical order. ADI Uni can be found </em><a href="http://www.aduni.org/courses/"><em>here</em></a><em>)</em></p><p><strong>Overcounting and Correction</strong></p><p><strong><em>Duplicate Letters</em></strong></p><p>It is quite easy to count individuals items that are distinct. But often, we need to count items where there is overlap.</p><p>Let us review how to count something. Take the name SHAWN. How many words can we make from this? 5! =&gt; 5*4*3*2*1. =120</p><p>What is the word is SUSIE? There are 120 words once again if we consider the S’s to be distinct.</p><pre>S1 U S2 I E</pre><pre>One possible set of arrangements could be S1 S2 U I E &amp;  S2 S1 U I </pre><p>This sort of distinction may not matter to you depending on the situation and so thus, we can see there is an overlap have counted one word twice.</p><p>How can we account for this? We can divide our permutation by two to account for our two variants of S.</p><p>What happens with a word like SELLS?</p><p>Again, 5! find all possible arrangements.</p><p>Simple — we know to account for each possbility of overlap. Thus, we have:</p><pre>5! / 2*2 since there are two S&#39;s and two L&#39;s.  <br>This gives us 30 ways to arrange SELLS that are distinct.</pre><p>Try giving MISSISSIPPI a shot.</p><p><strong><em>Counting Pairs</em></strong></p><p>I play on a basketball team of twelve players and we believe in improving our team spirits. How many ways can the whole team dap everyone else on the team to support each others game?</p><p>Casework would be a good way to approach this.</p><p>I’m player twelve. I have to give eleven other people daps. That’s 11.</p><p>Then the next player goes down the line and he gives daps the next 10 and so forth until there is only 1 player left.</p><pre>Basketball Team</pre><pre>11+10+9+8...+2+1 </pre><pre>That&#39;s just addition. </pre><pre>But it&#39;s better to come up with a closed form.  And if you&#39;ve heard of Gauss through your studies, then you will know the n(n+1) / 2 formula.  </pre><pre>66.  There are 66 ways for everyone to give daps to each other on the team.</pre><p><strong>Committees and Combinations</strong></p><p>Permutations are simply counting problems where order matters. But many times we realize order does not matter. Counting situations where the order does no matter are combinations. When we play with a padlock, it is not a combination but a permutation lock.</p><p>Now if I work in an office with six people and we need to create a committee to go to the computer conference by car, we can calculate this as 6 (ways to choose the driver’s seat) *5 (ways to choose shotgun) *4 (ways to choose the backseat).</p><pre>6 * 5 * 4 = 120</pre><p>But if I decide to take a bus and there is no assigned seating, then order does not matter. Hopefully, you see that there intuitively isn’t 120 seat arrangements. Instead, we can use the same principle from the overcounting letters problem. We want groups of 3 from our 6 people. In mathematical terms, we say 6 choose 3.</p><pre>6 * 5 * 4 / 3 * 2 * 1 = 20 possible groups of 3 where order does not matter.</pre><p><strong><em>The Formula</em></strong></p><p>We just calculated 6 Choose 3, but what if I want to calculate any group size N and choose committees sized R.</p><pre>6 C 3 ==&gt; 6 * 5 * 4 / 3 * 2 * 1 ==&gt; (6! / 3!) / 3! ==&gt; 6! / (3! 3!)</pre><pre>n C r ==&gt; n(n-1)(n-2)...(n-r+1) / r! =&gt; </pre><pre>n! / r!(n-r)!</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6594ff0b533a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[More Counting Techniques — ADI #14]]></title>
            <link>https://medium.com/@weiss.steven/more-counting-techniques-adi-14-2127939e9b1f?source=rss-b0222708b70d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2127939e9b1f</guid>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Steven Weiss]]></dc:creator>
            <pubDate>Sun, 13 Jan 2019 00:45:29 GMT</pubDate>
            <atom:updated>2019-12-23T03:58:38.779Z</atom:updated>
            <content:encoded><![CDATA[<h3>More Counting Techniques — part 1 — #ADI 14</h3><p><em>(This is a continuing series where I work through the ArsDigita University computer science curriculum. This period of learning focuses on Discrete Mathematics. Each article is numbered in pedagogical order. ADI Uni can be found </em><a href="http://www.aduni.org/courses/"><em>here</em></a><em>)</em></p><p><strong>More Counting Techniques</strong></p><p>We can use our hands, our toes, permutations, Venn Diagrams to count sets. These are not the only strategies. We can break sets down into specific cases, we can count what we do not have (a sets complement), and finally, we can the ways that the parts are built.</p><p><strong>Casework</strong></p><p>We are planning a trip to Boston from New York. En route to Boston we can pass by one of two cities — Hartford or Providence. If we go in the direction of Hartford, there are four possible roads going there and three possible exits going to Boston. If we go in the direction of Providence, there are two possible roads going there and five possible exits going to Boston. We can either go one way passing either city but not both, how many possible routes are there?</p><p>To answer this, we can break this up into unique cases — the Hartford routes and the Providence routes.</p><pre>Via Hartford</pre><pre>New York -&gt; Hartford gives us 4 paths. <br>Hartford -&gt; Boston gives us 3 paths.  That is 12 possibilities.  </pre><pre>New York -&gt; Providence gives us 2paths. <br>Providence -&gt; Boston gives us 5 paths.  That is 10 possibilities.</pre><pre>Now we add: 12 + 10 = 22 total possibilities.  </pre><p>Again, counting is not as simple as multiplying. We must think about the factors and decide the strategy. Casework allows us to break the problem down to a smaller piece, tend to the method, then scale the method to a similar piece of the problem.</p><p><strong>Complementary Counting</strong></p><p>Sometimes it is easier to count what is not the aim. For example, find the three-digit numbers are not multiples of 7.</p><pre>How many numbers have three-digits?<br>100, 101, 102...999</pre><pre>900 numbers have three-digits.</pre><pre>Now we want to know all the numbers that are not multiples of 7 in this set.  </pre><pre>What if we found out what all the numbers that are multiples of 7.  </pre><pre>The smallest is 15 * 7 = 105<br>The largest is 142 * 7 = 994</pre><pre>15, 16...142 = 142-15+1 = 128 numbers that are multiples of 7.  </pre><pre>We want to know NON-multiples.  Thus, 900-128 = 772 numbers that are non-multiples of 7.</pre><p>When we want something, often it is easier to find out what we do not want. When we read how many are or not, it is useful to ask the opposite. When we read how many have at least one, it is useful to ask how many have none.</p><p><strong>Constructive &amp; Restrictive Counting</strong></p><p>Sometimes it is not easy to see a pattern in counting. Casework or direct permutation may not be obvious.</p><p>Earlier, in complementary counting problem, we started using constructive methods to determine our range. We figured that the 100’s column had to be at least a 1. If the number had a 0, it would cease to be a three-digit number.</p><p>In a comparable problem, such as how many 3-digit numbers have exactly one zero, we again look at the restrictions first, then build.</p><pre>0 cannot go into the hundreds column, so our first number has nine choices =&gt; 9 * _ * _</pre><pre>The ten&#39;s digit or the units digit can either a zero.  This is two choices giving us 9 * 2 * _ </pre><pre>Whatever column is left that does not have a zero, we again have 9 choices.  </pre><pre>9 * 2 * 9 = 162 such 3-digit numbers.  </pre><p>And this problem: How many ways can I arrange 3 different history books and 5 different math books on my bookshelf, if I require the history books at the end?</p><p>Again, start at the restrictions.</p><pre>Bookshelf looks like this H(books in middle)H meaning the math will look something like this =&gt; End * Middle 1 * Middle 2 * Middle 3 * Middle 4 * Middle 5 * Middle 6 * End </pre><pre>3 history books for the first booked end = 3 * Middle 1 * Middle 2 * Middle 3 * Middle 4 * Middle 5 * Middle 6 * End</pre><pre>Dealing with restrictions, we want to see the end next.  Because the end must be a history book, we have 3 * End * Middle 1 * Middle 2 * Middle 3 * Middle 4 * Middle 5 * Middle 6.</pre><pre>Since there are 2 history books left, the equation is 3 * 2 * Middle 1 * Middle 2 * Middle 3 * Middle 4 * Middle 5 * Middle 6</pre><pre>Now we have 6 books left with no restriction moving along the shelf as follows:<br>3 * 2 * 6 * Middle 2 * Middle 3 * Middle 4 * Middle 5 * Middle 6<br>3 * 2 * 6 * 5 * Middle 3 * Middle 4 * Middle 5 * Middle 6<br>3 * 2 * 6 * 5 * 4 * Middle 4 * Middle 5 * Middle 6<br>3 * 2 * 6 * 5 * 4 * 3 * Middle 5 * Middle 6<br>3 * 2 * 6 * 5 * 4 * 3 * 2 * Middle 6<br>3 * 2 * 6 * 5 * 4 * 3 * 2 * 1</pre><pre>3 * 2 * 6! = 4,320 book arrangements.  </pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2127939e9b1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Counting Techniques — ADI #13]]></title>
            <link>https://medium.com/@weiss.steven/basic-counting-techniques-adi-13-815276596d48?source=rss-b0222708b70d------2</link>
            <guid isPermaLink="false">https://medium.com/p/815276596d48</guid>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Steven Weiss]]></dc:creator>
            <pubDate>Sun, 06 Jan 2019 23:49:29 GMT</pubDate>
            <atom:updated>2019-12-23T04:00:05.846Z</atom:updated>
            <content:encoded><![CDATA[<h3>Permutations &amp; Multiple Events-ADI#13</h3><p><em>(This is a continuing series where I work through the ArsDigita University computer science curriculum. This period of learning focuses on Discrete Mathematics. Each article is numbered in pedagogical order. ADI Uni can be found </em><a href="http://www.aduni.org/courses/"><em>here</em></a><em>)</em></p><p>Counting is still the name of the game. But instead of a set or multiple sets (or items outside of the set), we want to know the arrangements of events.</p><p><strong>Not-Independent Events</strong></p><p>I have four different books on a shelf. How can I arrange them?</p><p>Book 1 will have 4 choices. How about Book 2? We have already chosen 1, so Book 2 has 3 books to choose from. And Book 3? 2 books are left so we have 2 choices. And finally, for Book 4 we have only 1 choice.</p><p>This is the beginning of a permutation — counting that relates to sets’ position. To calculate we multiple along the events.</p><pre>For our bookshelf we have </pre><pre>4 * 3 * 2 * 1 at each position giving us 24 possibilities to arrange our books.  </pre><p>We can say it is 4! to arrange 4 books on a shelf where each space on the shelf is dependent on the prior event.</p><p><strong>Independent Events</strong></p><p>What about passwords on your iPhone? The iPhone 4 allows numbers alone. How many times would a hacker need to get into your phone with a 4-digit password?</p><pre>0-9 keypad is 10 numbers.  </pre><pre>We can choose 10 numbers for place 1.  </pre><pre>But what about place 2?</pre><pre>Because we haven&#39;t &quot;used&quot; up any number in place 1 (or we get to use all digits from 0-9), we can multiply place 1 by place 2.  And then extend this for the rest of the passcode.  </pre><pre>10 choices for place 1 * 10 choices for place 2 * 10 choices for place 3 * 10 choices for place 4 =&gt; 10 * 10 * 10 * 10</pre><pre>Giving us 10^4 = 10,000 shots.  </pre><p>This is not really a lot. Apple knows this and creates a reset when at only the sixth mistake.</p><p>The new release of the iPhone 5 and above was the bain of the FBI as it increased the passcode to 6 digits moving the probability of cracking the phone at 1/10⁶.</p><p><strong>Thinking in Trees</strong></p><p>I have four shirts and three ties. How many ways can I make one shirt and one tie?</p><p>In the way we used the Venn Diagram to visualize what to count, we can do the same using trees.</p><pre>Shirt 1 --- Tie 1<br>Shirt 1 --- Tie 2<br>Shirt 1 --- Tie 3</pre><pre>Shirt 2 --- Tie 1<br>Shirt 2 --- Tie 2<br>Shirt 2 --- Tie 3</pre><pre>Shirt 3 --- Tie 1<br>Shirt 3 --- Tie 2<br>Shirt 3 --- Tie 3</pre><pre>3 * 4 gives us 12 outfits.  </pre><p>To help remember, think “<strong>P</strong>ermutation … <strong>P</strong>osition”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=815276596d48" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics of Summations — ADI #12]]></title>
            <link>https://medium.com/@weiss.steven/basics-of-summations-adi-12-a563181c4f?source=rss-b0222708b70d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a563181c4f</guid>
            <dc:creator><![CDATA[Steven Weiss]]></dc:creator>
            <pubDate>Mon, 31 Dec 2018 18:24:34 GMT</pubDate>
            <atom:updated>2019-12-23T04:04:38.519Z</atom:updated>
            <content:encoded><![CDATA[<h3>Basics of Counting — ADI #12</h3><p><em>(This is a continuing series where I work through the ArsDigita University computer science curriculum. This period of learning focuses on Discrete Mathematics. Each article is numbered in pedagogical order. ADI Uni can be found </em><a href="http://www.aduni.org/courses/"><em>here</em></a><em>)</em></p><p>The gist of discrete math is counting. It is worth looking over just what that means.</p><p><strong>Basics</strong></p><p>How many numbers are between 1 and 100? Of course — 100.</p><p>How about 100 and 999? Is it 899? No. It is 900. Or, rather 999–100+1. How about 7 to 29? 29–7? That would be 22 and it would be incorrect. The answer is 21. How can we simply deal with these ‘off by one’ encounters? Like, anything in programming — taking it one step at a time.</p><p>We know how to easily count from 1 to any number. Thus, a good technique for dealing with odd ranges is to create a range starting at 1.</p><pre>100-999 becomes 100-99 &amp; 999-99 becoming 1-900.  How many numbers do we have? 900. </pre><pre>7-29 -&gt; -6 on both ends gets you 1-23 and thus, there are 23 numbers in a list. </pre><p>This works for whole numbers, but what about fractions/decimals?</p><pre>2.5, 5.5, 8.5...27.5?</pre><pre>Just as the subtracting strategy above, we can add a number to make the range into something workable. By adding .5 we get:</pre><pre>3, 6, 9...28 </pre><pre>Then we can divide by three to make the range look like our early range</pre><pre>1, 2, 3...9 </pre><pre>This gives us 9 numbers in the range.  </pre><p><strong>Using Venn Diagrams to Count</strong></p><p>Often we have to deal with counting items that are in or outside of sets. And often, some data is missing. But we can still ascertain the remaining data if we analyze what’s given correctly. There are a few ways to do this. One way is to visualize where the related data in question exists with respect to the remaining data by using a Venn Diagram. This allows us to count things which occur in overlapping sets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/0*u3OdrFNQfqzWS830.png" /></figure><p><strong>Using a Venn Diagram</strong></p><pre>There are 12 students.  All the students are taking at least one science class.  8 are taking chemistry.  5 are taking physics and chemistry.  How many are taking physics?</pre><pre>Simple - 8 + 5 = 13.  Of course, that is incorrect because that would be more than the total students.  </pre><pre>Using a Venn Diagram we could put the 5 on the inner most circle.  <br>Then subtract 8 - 5 to get the 3 students only taking chemistry.  For the physics students, since we have 12 total students, 3 only taking chemistry and 5 taking both, we can say 12 - 5 - 3 = x(physics) giving us 4.  </pre><p><strong>Another Example</strong></p><pre>There are 27 carrots at the grocery.  14 of them are orange.  11 of them are baby sized.  5 of the carrots are red and grown.  How many of them are orange and baby sized?</pre><pre>Let&#39;s start with what is not desired.  We know that 5 of the carrots are not desired but are in the universe of carrots.  We count this but outside of the Venn Diagram.  </pre><pre><strong>Not Baby, Orange or Baby &amp; Orange = </strong>5</pre><pre>Next, move to the inner circle. We do not know this but it is what we want.  We can call this &#39;x&#39;</pre><pre><strong>Baby &amp; Orange = </strong>x</pre><pre>Next, we use x to create context for Baby only and Orange only.  </pre><pre><strong>Orange =&gt; 14 - x <br>Baby =&gt; 11 - x</strong></pre><pre>We know there are 27 carrots in the grocery so we can set all our sets equal to to this total.</pre><pre><strong>27 = (14 - x) + (11 - x) + x + 5</strong></pre><pre>Simplify.</pre><pre><strong>27 = 14 - x + 11 - x + x + 5<br>27 = 30 - x <br>x = 3</strong></pre><pre>Knowing that <strong>Baby &amp; Orange = 3. </strong>We can also find Baby only and Orange only.  </pre><pre><strong>Orange =&gt; 14 - 3 = 11<br>Baby =&gt; 11 - 3 = 8</strong></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a563181c4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Repertoire Method — ADI #11]]></title>
            <link>https://medium.com/@weiss.steven/repertoire-method-adi-11-930ce4f1d35?source=rss-b0222708b70d------2</link>
            <guid isPermaLink="false">https://medium.com/p/930ce4f1d35</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Steven Weiss]]></dc:creator>
            <pubDate>Sun, 23 Dec 2018 16:23:17 GMT</pubDate>
            <atom:updated>2019-12-23T04:03:55.158Z</atom:updated>
            <content:encoded><![CDATA[<h3>Repertoire Method — ADI#11</h3><p><em>(This is a continuing series where I work through the ArsDigita University computer science curriculum. This period of learning focuses on Discrete Mathematics. Each article is numbered in pedagogical order. ADI Uni can be found </em><a href="http://www.aduni.org/courses/"><em>here</em></a><em>)</em></p><p>To study discrete math is to figure out how seemingly disparate problems have much in common. But it is not a matter of ‘guessing’, one needs to prove such things. To do so, one requires mathematical tools. Two such important tools for analysis are the repertoire method and proof by induction. This post is about the repertoire method to derive closed from functions.</p><p><strong>The Repertoire Method</strong></p><p>In the prior post, I discussed problems of recurrence — problems where the pattern can be described by smaller cases of itself. When seeking to solve recurrence problems we try and find the recursive pattern along with its base case, then seek a closed form solution.</p><p>The convenience of the closed form solution was the ability to find a solution for a particular “n” versus having to look up every result for “n” starting at the base case. At times, finding the closed form can be tricky. The repertoire method gives us additional tools to derive our closed form from the recursive pattern observed in the recurrence.</p><p>How to gather our repertoire to get a closed form; an example:</p><pre>We are given a pattern and observe the recurrence as such:</pre><pre>T0 = 7<br>Tn = 2n^2 + 7 + Zn−1, n &gt; 0</pre><pre>We cannot simply guess a complex closed form.  But we can create guess smaller, simpler closed forms; create recursive functions with the simpler closed forms and then work with this repertoire to get the closed form for the complex recurrence.</pre><pre>From the above recurrence, we can generalize this and use the generalized form to get our repertoire :</pre><pre>T0 = (little) q0<br>Tn = tn + Tn-1</pre><pre>Since we are trying to solve for the recurrence, we want to create equations that may get us to n^2 and 7 (a constant).</pre><pre>But we must <strong>guess </strong>candidates for 2n^2 and 7.</pre><pre>Starting at 7, we can generalize the constant and guess its closed form as n.  Then, use recursion to confirm that the closed form is correct.</pre><pre>-----</pre><pre>Trying to deal with our 2n^2 we will build our first repertoire that approaches this solution.</pre><pre>Our first closed form guess: Bn = n^2 (Bn is an arbitrary variable choice)</pre><pre>What is the recursive form of n^2? Recursion needs to be something in terms of itself and a base case.</pre><pre>Bn = something + Bn-1<br>B0 = n^2 = 0^2 = 0<br>(rewriting our recursion using the generalization from above as a model) Bn = bn + Bn-1</pre><pre>Because we guessed Bn = n^2, we can guess Bn-1 = (n-1)^2 and rewrite our recursion:</pre><pre>n^2 = bn + (n-1)^2 =&gt; n^2 = bn + n^2 - 2n + 1 =&gt; bn = 2n-1</pre><pre>Recursive Form: Bn = 2n-1 + Bn-1 &amp; B0 = 0<br>Closed Form: n^2</pre><pre>Our first guess got us something close to our form.  We started with n^2 and got 2n.  But we want 2n^2.  Then, we can guess n^3 and see if that might get us 2n^2.</pre><pre>An = an + An-1<br>An = n^3</pre><pre>n^3 = an + (n-1)^3 =&gt; n^3 = an + n^3 - 3n^2 + 3n^2 + 3n-1 =&gt; an = 3n^2 - 3n + 1</pre><pre>Recursive Form: An = 3n^2 - 3n + 1 + An-1 &amp; A0 = 0<br>Closed Form: n^3</pre><pre>We are approaching our solution.  </pre><pre>Cn = n<br>Cn = cn + Cn-1</pre><pre>Cn = cn + Cn-1<br>n = cn + (n-1)<br>cn = 1</pre><pre>Recursive Form: 1 + Cn-1<br>Closed Form: n</pre><pre>Now we have our <strong>repertoire:</strong></pre><pre>An = n^3 &lt;=&gt; 3n^2 - 3n + 1 + An-1 &amp; A0 = 0</pre><pre>Bn = n^2 &lt;=&gt; Bn = 2n-1 + Bn-1 &amp; B0 = 0</pre><pre>Cn = n &lt;=&gt; 1 + Cn-1<br><br>How can we use these formulas to get our original recurrence?</pre><pre>First, we can introduce constants α, β, and γ and trying to  find a closed form for the more general recurrence and try and scale our repertoire towards solving our initial recurrence.  </pre><pre>Tn = α(An) + β(Bn) + γ(Cn)<br>Tn-1 = α(An-1) + β(Bn-1) + γ(Cn-1)</pre><pre>Then, plug and play:</pre><pre>Tn = α(3n^2 - 3n + 1 + An-1) + β(2n-1 + Bn-1) + γ(1 + Cn-1)<br>=&gt; α(3n^2) + (-3α + 2β)n + (α-β+γ) + α(An-1) + β(Bn-1) + γ(Cn-1)<br>=&gt; (3αn^2) + (-3α + 2β)n + (α-β+γ)</pre><pre>(3αn^2) + (-3α + 2β)n + (α-β+γ)</pre><pre>3α = 2 =&gt; α = 2/3 <br>-3α + 2β = 0 =&gt; 2β = 3(2/3) β = 1<br>α-β+γ =&gt; 2/3 - 3/3 + γ = 22/3</pre><pre>Tn = 2/3(An) + 1(Bn) + 22/3(Cn)</pre><pre>We must respect that the base case was 7.  So, we add this to the end of our closed form to complete the function.</pre><pre>Tn = 2/3(An) + 1(Bn) + 22/3(Cn) + 7<br>T0 = 7<br>Tn = 2n^2 + 7 + Zn−1, n &gt; 0</pre><pre>And we have the closed form for our recurrence using our repertoire. </pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=930ce4f1d35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Induction — ADI #10]]></title>
            <link>https://medium.com/@weiss.steven/induction-adi-10-3eb3f9421310?source=rss-b0222708b70d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3eb3f9421310</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Steven Weiss]]></dc:creator>
            <pubDate>Sun, 23 Dec 2018 13:31:38 GMT</pubDate>
            <atom:updated>2019-12-23T04:03:25.961Z</atom:updated>
            <content:encoded><![CDATA[<h3>Induction — ADI #10</h3><p><em>(This is a continuing series where I work through the ArsDigita University computer science curriculum. This period of learning focuses on Discrete Mathematics. Each article is numbered in pedagogical order. ADI Uni can be found </em><a href="http://www.aduni.org/courses/"><em>here</em></a><em>)</em></p><p>To study discrete math is to figure out how seemingly disparate problems have much in common. But it is not a matter of ‘guessing’, one needs to prove such things. To do so, one requires mathematical tools. Two such important tools for analysis are the repertoire method and proof by induction. This post is about proof by induction.</p><p><strong>Proof by Induction</strong></p><p>To prove something, we could look at every instance of a function and check. That would take far too long. Induction allows us a nice shortcut by checking only two components to a prove a proof: the base case and the base case plus 1. If you prove these two pieces, then you have concluded that the proof is true.</p><p>Consider an algorithm and its soundness. We want to see what it looks like at its simplest, then the next case. But it would take forever to figure out if it works in all cases. Instead, we could use induction to check the algorithms soundness.</p><p>How to work through a proof by induction:</p><pre>Steps for Induction:</pre><pre>1. Check for the truth of a base case (ex. k=0 or k=1 or k=whatever<br>2. Assume it works for some k.<br>3. Using that assumption, prove it works for k+1</pre><p>Let’s work through an example.</p><pre>Prove [Σ 1 &lt;= j &lt;= n] such that (-1)^j*j^2 = [(-1)^n * n(n+1)] / 2<br>This is saying, prove the first formula, when the range from j to n are summed, that for any n at integer j will equal the second formula at the equivalent n.  </pre><pre>Using the method of induction, first, we will find a base case.</pre><pre><strong>1. Base Case of n=1</strong></pre><pre>(-1)^1*1^2 and [(-1)^1 * 1(1+1)] / 2<br>-1 = [-1 * 1 * 2] / 2 <br>-1 = -1 is true, thus the formula is proved at the base case.  </pre><pre><strong>2. Assume true for some k.  </strong></pre><pre>We assume [Σ 1 &lt;= j &lt;= k] such that (-1)^j*j^2 = [(-1)^k * k(k+1)] / 2</pre><pre><strong>3. Prove </strong>Σ <strong>k+1 gets us [(-1)^k+1 * k+1(k+1+1)] / 2</strong></pre><pre>[Σ 1 &lt;= j &lt;= k+1](-1)^j*j^2 = [Σ 1 &lt;= j &lt;= k ](-1)^j * j^2 + (-1)^k+1 * (k+1)^2</pre><pre>Through substitution, we can replace k summation with our assumption to get a new comparison.</pre><pre>[Σ 1 &lt;= j &lt;= k+1 ](-1)^j * j^2 = [ (-1)^k * k(k+1)] / 2 + (-1)^k + 1 * (k+1)^2</pre><pre>Then, on the right side of the equation, we simplify (with a bit of algebra) and combine terms.</pre><pre>[ (-1)^k * k(k+1)] / 2 + [ (-1)^k + 1 * (k+1)^2 ] * (2/2) ==&gt;</pre><pre>[(-1)^k * [k^2 + k - 2k^2 - 4k - 2]] / 2 =&gt;</pre><pre>[(-1)^k * [ -k^2 - 3k - 2]] / 2 =&gt; </pre><pre>(-1)^k * [(-1)^1 *[ k^2 - 3k + 2]] / 2 =&gt;</pre><pre>(-1)^k * (-1)^1 *[ k^2 - 3k + 2] / 2 =&gt;</pre><pre>(-1)^k+1 *[ k + 1 * k + 2 ] / 2 =&gt;</pre><pre>(-1)^k+1 *[ k + 1 * k + 1 + 1] / 2 === <strong>[(-1)^k+1 * k+1(k+1+1)] / 2</strong></pre><pre>Proving our induction.   </pre><p>How about another?</p><pre>Given:<br> Tn = Tn-1 + Tn-2 + Tn-3 and n &gt;= 4<br> T1 = T2 = T3 = 1</pre><pre>Prove: Tn &lt; 2^n</pre><pre><strong>1. Solve for the Base Case</strong></pre><pre>T1 = 2^1 T2 = 2^2 T3 = 2^3<br>1 &lt; 1 1 &lt; 4 and 1 &lt; 8.</pre><pre>Thus, the base case is true. </pre><pre><strong>2. Assume true for some k</strong></pre><pre>We cannot just assume it works for k=4 and k-1=3.  We must also make sure that it works for k-2=2 because as we progress to higher numbers of k, just as we had three numbers in our base case, we need to prove three numbers back from k.  </pre><pre>Tk &lt; 2^k<br>Tk-1 &lt; 2^k-1<br>Tk-2 &lt; 2^k-2</pre><pre><strong>3. Show that it works for Tk+1 &lt; 2^k+1</strong></pre><pre>Tn+1 = Tn-1+1 + Tn-2+1 + Tn-3+1 =&gt; </pre><pre>Tn + Tn-1 + Tn-2 &lt; 2^k + 2^k-1 + 2^k-2 =&gt;</pre><pre>&lt; 2^k(1 + 2^-1 + 2^-2)<br>&lt; 2^k(1 + 1/2 + 1/4)<br>&lt; 2^k(4/4 + 2/2 + 1/4) =&gt; 2^k(7/4) =&gt; 2^k(2^1 3.5/4) =&gt; 2^k+1(3.5/4) =&gt; 2^k+1(7/8)</pre><pre>Tn+1 &lt; 2^k+1(7/8) is proved (the 7/8 is negligible).  </pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3eb3f9421310" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recurrence — ADI #9]]></title>
            <link>https://medium.com/@weiss.steven/recurrence-adi-9-69e6b3bbc1de?source=rss-b0222708b70d------2</link>
            <guid isPermaLink="false">https://medium.com/p/69e6b3bbc1de</guid>
            <dc:creator><![CDATA[Steven Weiss]]></dc:creator>
            <pubDate>Mon, 10 Dec 2018 18:30:39 GMT</pubDate>
            <atom:updated>2019-12-23T04:02:24.467Z</atom:updated>
            <content:encoded><![CDATA[<h3>Recurrence, The Basics— ADI#9</h3><p><em>(This is a continuing series where I work through the ArsDigita University computer science curriculum. This period of learning focuses on Discrete Mathematics. Each article is numbered in pedagogical order. ADI Uni can be found </em><a href="http://www.aduni.org/courses/"><em>here</em></a><em>)</em></p><p>In the book <em>Liber Abaci</em> (1202) by Leonardo of Pisa, known as Fibonacci, Fibonacci considers the growth of an idealized (biologically unrealistic) rabbit population, assuming that:</p><ol><li>a single newly born pair of rabbits (one male, one female) are put in a field;</li><li>rabbits are able to mate at the age of one month so that at the end of its second month a female can produce another pair of rabbits;</li><li>rabbits never die and a mating pair always produces one new pair (one male, one female) every month from the second month on.</li></ol><p>The puzzle that Fibonacci posed was: how many pairs will there be in one year? The answer: The Fibonnacci sequence 1, 1, 3, 5, 8, 13… But what is most important is the process — to view such problems as a recurrence problem.</p><p>What is a recurrence problem? A problem in which the solution depends on solutions from smaller versions of the original problem.</p><p>It can be quite difficult to see through this mess, but anytime we are looking at problems of recurrence, we must parse the clues. In the rabbit problem, we know the birth rates of the first two rabbits — zero. And so, we have a result of one. This is our base case. In the Tower Hanoi, another recurrence problem, it might be difficult to determine the moves for a three disk or a ten disk setup, but we can easily see how many moves are necessary for a zero or one disk setup. In solving a recurrence, we start with a base case.</p><p>Next, we want to create proper notation. And see what the sequence is telling us. In the case of Fibonacci, we have our base case and a pattern that is described in terms of prior cases.</p><pre>F(index)0 = 0<br>F1 = 1</pre><pre>F2 = F1 + F0 ==&gt; 1</pre><pre>F3 = F2 + F1 ==&gt; 2</pre><pre>F4 = F3 + F2 ==&gt; 3</pre><pre>F5 = F4 + F3 ==&gt; 5 </pre><p>This pattern — our base case/boundary conditions and the equation in term of the prior cases is a recurrence. We can generalize our recurrence allowing us to find a particular Fn if we know the prior Fn’s.</p><pre>Fn = Fn-1 + Fn-2 </pre><p>This can be a nuisance. This method, while important only allows us to determine solutions if we iterate through all the patterns. What we want is something more convenient — a closed form. The closed form allows us to drop in at any “n” and solve. As it stands, Fibonacci can be solved with Binet’s formula, a topic outside of this post. The formula is written as follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/210/0*wSsCIFr9woEeswGR.gif" /></figure><p>The basics of solving a recurrence:</p><ol><li>Find the base case</li><li>Find the pattern</li><li>Create a closed form solution</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69e6b3bbc1de" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>