<?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:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Logical.AI]]></title><description><![CDATA[artificial intelligence ⋅ mathematics ⋅ programming ⋅ quantitative design ⋅ civil liberties ⋅ humanism]]></description><link>http://illuminium.org/</link><image><url>http://illuminium.org/favicon.png</url><title>Logical.AI</title><link>http://illuminium.org/</link></image><generator>Ghost 3.40</generator><lastBuildDate>Fri, 10 Apr 2026 20:23:46 GMT</lastBuildDate><atom:link href="http://illuminium.org/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Flying eaves]]></title><description><![CDATA[These upward-curving roofs let in daylight while keeping rain out. You can calculate the amount of daylight for a given roof shape using trigonometry.]]></description><link>http://illuminium.org/flying-eaves/</link><guid isPermaLink="false">601dd707639a6abc73f799cf</guid><category><![CDATA[light]]></category><category><![CDATA[morsels]]></category><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Sat, 06 Feb 2021 01:57:31 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1518663392635-94580fd4ba4e?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MXwxMTc3M3wwfDF8c2VhcmNofDIwfHxjaGluYSUyMGVhdmVzfGVufDB8fHw&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1518663392635-94580fd4ba4e?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MXwxMTc3M3wwfDF8c2VhcmNofDIwfHxjaGluYSUyMGVhdmVzfGVufDB8fHw&ixlib=rb-1.2.1&q=80&w=2000" alt="Flying eaves"><p>Have you ever wondered about the distinctive sweeping roof shape on certain buildings? These are <em>flying eaves</em> (飞檐 in Chinese; 추녀, chunyeo in Korean). They are not only supremely beautiful, they also serve a key functional purpose: when the eaves are upturned, they can welcome in more sunlight while still shielding from overhead rain. This additional sunlight helps dry out wooden homes after a rainstorm and hence prevent mold and rot.</p><p>I was interested in studying the shape of these eaves and modeling their rain-protecting and light-welcoming properties.  In this article, I present a simple mathematical model that shows how these properties change depending on roof shape.</p><h2 id="the-sun-on-the-sloping-roof">The sun on the sloping roof</h2><p>For simplicity, we will consider a two-dimensional rectangular house consisting of two walls, a floor, and a ceiling. The house is aligned with the sun, so that one wall lies to the east and the other lies to the west.</p><p>Let us also assume that the sun is infinitely far away. This allows us to model the sun's rays as perfectly parallel, and chart the sun's position throughout the day using a single angle measure \(\theta\). We can say that at 0° is daybreak, when the sun appears on the horizon; 90° is high noon, when it is directly overhead; and 180° is nightfall, when the it reaches the opposite horizon.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://illuminium.org/content/images/2021/02/eaves-1-3.png" class="kg-image" alt="Flying eaves" srcset="http://illuminium.org/content/images/size/w600/2021/02/eaves-1-3.png 600w, http://illuminium.org/content/images/size/w1000/2021/02/eaves-1-3.png 1000w, http://illuminium.org/content/images/2021/02/eaves-1-3.png 1100w" sizes="(min-width: 720px) 720px"><figcaption>A rectangular house in a two-dimensional world. As the angle of the sun changes, the shadow of the house changes.</figcaption></figure><p>Note that in the figure, I have made the unusual choice to represent East as leftward. This unusual choice means that the sun will move from left to right throughout the course of the day, which I find convenient to visualize. The figure therefore depicts some time in the morning.</p><p>Next, let us add flying eaves to the roof.  We can model an eave as a curve in the plane, say a piecewise linear function like this one:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://illuminium.org/content/images/2021/02/eaves-2.png" class="kg-image" alt="Flying eaves" srcset="http://illuminium.org/content/images/size/w600/2021/02/eaves-2.png 600w, http://illuminium.org/content/images/size/w1000/2021/02/eaves-2.png 1000w, http://illuminium.org/content/images/2021/02/eaves-2.png 1100w" sizes="(min-width: 720px) 720px"><figcaption>The shape of the roof can be represented as a function with Cartesian coordinates—in this case, a piecewise linear function. The scale in this cartoon has been exaggerated to make the roof easier to see.</figcaption></figure><p>The rooftop contour can in general be any continuous curve, but to ensure that the eaves properly "fly" upward, we should require the contour to be a<em> convex, increasing function.</em> This prevents the roof from bending back onto itself, forming strange peaks, or sloping downward. The roof in the figure is a nice choice of convex, increasing function.</p><h2 id="the-umbrella-equation">The umbrella equation</h2><p>To calculate the effect of light and shadow on this roof, we can set up a 2D coordinate system where ground level is the line \(y=0\).  Supposing the roof is a piecewise linear function with endpoint coordinates \(\langle a_i, b_i\rangle\), how does the shadow vary with time of day \(\theta\)?</p><p>Note that each junction of the piecewise-linear roof casts its own shadow on the ground, forming a right triangle. The angle of the triangle is \(\theta\)—the angle of the sun—and the width of the triangle's base is \(b_i \cot(\theta)\) by basic trigonometry.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://illuminium.org/content/images/2021/02/eaves-3.png" class="kg-image" alt="Flying eaves" srcset="http://illuminium.org/content/images/size/w600/2021/02/eaves-3.png 600w, http://illuminium.org/content/images/size/w1000/2021/02/eaves-3.png 1000w, http://illuminium.org/content/images/2021/02/eaves-3.png 1100w" sizes="(min-width: 720px) 720px"><figcaption>Each endpoint on the piecewise-linear roof function projects a shadow along the sunlight direction \(\theta\) onto the ground, forming a right triangle. The projected shadow of that endpoint is at position \(a_i+b_i\cot(\theta)\). Because the roof's shadow is convex, its right endpoint is the maximum of all the projected endpoints.</figcaption></figure><p>Putting together the shadows of all the junctions, we can see the whole shadow of the roof:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://illuminium.org/content/images/2021/02/eaves-4.png" class="kg-image" alt="Flying eaves" srcset="http://illuminium.org/content/images/size/w600/2021/02/eaves-4.png 600w, http://illuminium.org/content/images/size/w1000/2021/02/eaves-4.png 1000w, http://illuminium.org/content/images/2021/02/eaves-4.png 1106w" sizes="(min-width: 720px) 720px"><figcaption>The shadow of the roof is a line segment on the ground. One endpoint is anchored on the house. The other one moves with the angle of the sun.</figcaption></figure><p>The figure above shows that the rightmost endpoint of the shadow is the projection of the rightmost edge of the house. This remains true throughout the morning, but in the afternoon—when shadows are cast toward the left—the rightmost end of the roof's shadow can be the projection of other endpoints instead:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://illuminium.org/content/images/2021/02/eaves-5-1.png" class="kg-image" alt="Flying eaves" srcset="http://illuminium.org/content/images/size/w600/2021/02/eaves-5-1.png 600w, http://illuminium.org/content/images/size/w1000/2021/02/eaves-5-1.png 1000w, http://illuminium.org/content/images/2021/02/eaves-5-1.png 1106w" sizes="(min-width: 720px) 720px"><figcaption>For a piecewise-linear roof, the end of the roof's shadow is always the projection of one of the roof's junctions. In the morning, it is always the projection of the rightmost junction. In the afternoon, when light enters under the eaves, it will be the projection of other junctions.</figcaption></figure><p>Look at the figure above. You can visualize the qualitative behavior of the shadow as it changes throughout the course of the day:</p><ul><li>At daybreak, the shadow stretches westward into infinity. </li><li>The shadow shortens until noon, when it lies directly under the roof.</li><li>Starting in the afternoon, the light begins to reach the area beneath the eaves for the first time.</li><li>As the sunlight reaches beneath the eaves, the boundary between light and shadow is a line segment. That line is parallel to the sun's rays and passes through one of the roof's endpoints.</li><li>Because the curve is convex and increasing, this "<a href="https://en.wikipedia.org/wiki/Terminator_(solar)">terminator</a>" line segment actually transits through each of the roof's endpoints in reverse order, from right to left.  It starts at the rightmost endpoint. It transitions between two consecutive endpoints just when the angle of the sun matches the slope of the roof segment between them.</li><li>At some point in the evening, the sunlight finally reaches the western foundation of the house.  The light will begin to climb the walls of the house, until it illuminates the entire western wall and roof. They will remain entirely illuminated until sunset.</li></ul><p>We know that whatever the piecewise-linear shape of the roof, the rightmost edge of the roof's shadow will be the rightmost projection of its individual segments. Using trigonometry, we can express this using the following formula, which I call the <strong>umbrella equation:</strong></p><!--kg-card-begin: html--><blockquote>
    <b>Umbrella equation (piecewise-linear)</b>. For a piecewise linear increasing roof with endpoint coordinates \(\langle a_i, b_i\rangle\), the shadow is a line segment on the ground with one moving endpoint \(\langle \alpha(\theta), 0\rangle\). That endpoint sweeps out a position given by:
    
    $$\alpha(\theta) = \max_i \left[a_i + b_i \cot(\theta)\right]$$
    
</blockquote><!--kg-card-end: html--><p>In fact, the same result holds if we generalize from piecewise-linear increasing functions to <em>any</em> convex increasing curve:</p><!--kg-card-begin: html--><blockquote>
    <strong>Umbrella equation (general form)</strong>. For any convex increasing roof shape with coordinates \(\langle u, f(u)\rangle\), the shadow is a line segment whose moving endpoint sweeps out a curve \(\langle \alpha(\theta), 0\rangle\) given by:
    
    $$\alpha(\theta) = \sup_u \left[u + f(u) \cot(\theta)\right]$$
    
</blockquote><!--kg-card-end: html--><h2 id="the-interplay-of-light-and-rain">The interplay of light and rain</h2><p>We now understand how a roof with a given shape lets in light throughout the day; it is governed by the umbrella equation. How about the rain?</p><p>If the day is not so windy, then rain falls vertically onto the roof (the same as the sun's rays at noontime.)  The shadow of the rain extends exactly as far as the rightmost part of the roof, regardless of time of day.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://illuminium.org/content/images/2021/02/eaves-6.png" class="kg-image" alt="Flying eaves" srcset="http://illuminium.org/content/images/size/w600/2021/02/eaves-6.png 600w, http://illuminium.org/content/images/size/w1000/2021/02/eaves-6.png 1000w, http://illuminium.org/content/images/2021/02/eaves-6.png 1100w" sizes="(min-width: 720px) 720px"><figcaption>Without wind, the rain falls vertically downward, just as the rays of sun at noon. The shadow of the rain extends exactly as far right as the rightmost part of the roof, regardless of time of day.</figcaption></figure><p><strong>How the height of the roof matters. </strong>We can learn something by contrasting how the sun and the rain fall onto the roof.  For one thing, a higher roof allows more sunlight to come in, but does not affect the rain at all.  In an extreme case, a roof with extremely high eaves would shelter everything under it from the rain, while only minimally affecting the amount of sunlight in the afternoon. (Alas, in the morning, such a tall eave would leave the entire west side of the house in shadow.)</p>]]></content:encoded></item><item><title><![CDATA[Why not put the steering wheel on the other side?]]></title><description><![CDATA[When you put the steering wheel on the curb side of the car, the driver can get in and out safely onto the curb. Mail trucks are built like this. Why not all cars?]]></description><link>http://illuminium.org/why-are-steering-wheels-on-the-wrong-side/</link><guid isPermaLink="false">6015ec22639a6abc73f7966a</guid><category><![CDATA[proposal]]></category><category><![CDATA[vehicles]]></category><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Sun, 31 Jan 2021 00:12:28 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1585854142856-39397c7d3704?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MXwxMTc3M3wwfDF8c2VhcmNofDd8fHBvc3RhbCUyMHRydWNrfGVufDB8fHw&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1585854142856-39397c7d3704?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MXwxMTc3M3wwfDF8c2VhcmNofDd8fHBvc3RhbCUyMHRydWNrfGVufDB8fHw&ixlib=rb-1.2.1&q=80&w=2000" alt="Why not put the steering wheel on the other side?"><p>Have you ever noticed that mail trucks have their steering wheel on the <strong>curb side</strong> of the vehicle?  This puts mailboxes within arm's reach, so that postal workers don't have to get out of their vehicle when doing mail delivery rounds. As an added benefit, when they do need to get out of their vehicle, they can step directly onto the curb, instead of into traffic.</p><p>What a useful safety feature! Why shouldn't <em>every</em> car have curb-side driving, so that the driver can safely enter and exit from the curb side? For people driving alone, this seems like a total advantage. For people with passengers, it doesn't change how many people have to exit into traffic.</p><p>(And note that this isn't an issue of driving the <em>car</em> on the left or right side of the road; it's the entirely separate issue of which side to put the <em>steering wheel </em>on.)</p><p>I tried to think of justifications for putting the steering wheel on the center-line side.  Speculating wildly, I guessed it might be a hold over from horse-drawn carriages, where the passengers were in a higher hierarchical position,and so their comfort and convenience was prioritized.</p><p>After doing some <a href="https://www.worldstandards.eu/cars/trivia-about-driving-left/">digging</a>, I discovered that the first cars <em>did</em> have curb-side driving—they were imitating the horse-drawn carriages, which <em>also</em> had curb-side driving. Ford changed to center-line side driving in 1908, citing that:</p><ol><li>It's convenient for the front-seat passenger to exit onto the curb.</li><li>The center-line driver can better judge the distance to the center line and oncoming traffic.</li></ol><p>But if the only real reason is to dodge oncoming traffic, perhaps we have all been disadvantaged by speed disease—the city-planning philosophy that gives fast-as-possible cars a monopoly over our road infrastructure, rather than enabling the broadest range of makeshift vehicles, bikes, animals, and pedestrians to be able to get where they need to go.  Avoiding oncoming traffic becomes a top-line priority only when everything is moving at such breakneck speed that conversation and negotiation with other drivers becomes impossible. </p><p>Cars are a complicated issue. It is useful to be able to move fast, particularly <em>between</em> cities, and cars provide both liberation and access to people who might not have other modes of transportation. But we should definitely ditch the speed disease, invest in better public transportation within our cities, and moreover design our cities so that lightning-fast vehicles are unnecessary within them. As long as we have cars, however, perhaps we should design them for our convenience. We should aspire to slow down so we can restore the steering wheel to its rightful place on the curb side of the car.</p>]]></content:encoded></item><item><title><![CDATA[Gemstones and light]]></title><description><![CDATA[I derive the ideal gemstone shape based on physical principles. Along the way, I uncover connections between gemstones, mirrors, lasers, and glass.]]></description><link>http://illuminium.org/gemstones-and-light/</link><guid isPermaLink="false">600e8feb639a6abc73f79375</guid><category><![CDATA[light]]></category><category><![CDATA[gemstones]]></category><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Sat, 16 Jan 2021 08:00:00 GMT</pubDate><media:content url="http://illuminium.org/content/images/2021/01/triangle-bounces-1.png" medium="image"/><content:encoded><![CDATA[<img src="http://illuminium.org/content/images/2021/01/triangle-bounces-1.png" alt="Gemstones and light"><p>How do you cut a gemstone to make it shine brightest? Can you find an ideal shape using physical principles?</p><!--kg-card-begin: html--><center><video controls autoplay loop src="http://logical.ai/other/gemsparkle_small.mp4"></video></center><!--kg-card-end: html--><p>Gems are usually set into a ring or other piece of jewelry so that one main face (the "crown") is visible. Light enters the gem through the crown, where it bounces off of the interior facets and/or leaks through them. The brightness of a gem is determined by how much light is reflected back out through the crown instead of leaking out. Therefore, the <a href="https://usfacetersguild.org/refractive-index-and-critical-angle/">simple rule</a> for achieving shiny gems is:</p><blockquote>Reflect as much light as possible back out of the crown.</blockquote><p>This is basically a geometry problem: using mirrors and glass, you could design a <a href="https://en.wikipedia.org/wiki/Corner_reflector">triangular retroreflector</a> that bounced light around in exactly this way. In 2D, you would make an isosceles triangle where the base side (the crown) is clear glass, and the other two sides are mirrored. By choosing good angles for the triangle, you could ensure that all light entering straight into the crown would bounce off the two mirrored sides and emerge back out. Problem solved.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://illuminium.org/content/images/2021/01/triangle-bounces.png" class="kg-image" alt="Gemstones and light"><figcaption>A triangular retroreflector, with two mirrored legs, can reflect all incoming light back out of the crown.</figcaption></figure><p>For gemstones, however, there is also a materials problem: even polished gemstones are translucent, not mirrored. So, light entering the crown will tend to leak out of the bottom facets instead of bouncing---the surface behaves more like glass than a mirror. However, there is a solution: if light strikes the gemstone from an <a href="https://en.wikipedia.org/wiki/Total_internal_reflection#Critical_angle">appropriately shallow angle</a>, it will bounce perfectly instead of leaking through. This phenomenon is <a href="https://en.wikipedia.org/wiki/Total_internal_reflection">total internal reflection</a>: when light that hits a surface at a shallow angle, the surface behaves like an essentially perfect mirror. (When you dive into a swimming pool and look up at the surface of the water, total internal reflection explains why the surface forms a perfect silvery mirror except for a <a href="https://en.wikipedia.org/wiki/Snell%27s_window">small circular window</a>.)</p><p>Every material has its own critical angle, which is determined by the material's refractive index.</p><figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="http://illuminium.org/content/images/2021/01/FishTankTIR04.jpg" class="kg-image" alt="Gemstones and light" srcset="http://illuminium.org/content/images/size/w600/2021/01/FishTankTIR04.jpg 600w, http://illuminium.org/content/images/size/w1000/2021/01/FishTankTIR04.jpg 1000w, http://illuminium.org/content/images/2021/01/FishTankTIR04.jpg 1590w" sizes="(min-width: 1200px) 1200px"><figcaption>A laser hitting the surface of the water at a shallow angle will reflect off of it like a perfect mirror, instead of shining through. Image from http://sites.fas.harvard.edu/~scidemos/LightOptics/FishTankTIR/FishTankTIR.html</figcaption></figure><p>Returning to our triangular model, the material's critical angle will determine how steep we should make the sides of the gemstone. We want to make it steep enough so that the walls of the gem become mirrored and all the light entering straight into the crown will be reflected out. We are looking for a design parameter: what angle to make our triangle. Gemologists refer to this design parameter as the <em>pavillion angle</em>, labeled as \alpha in the figure below. We have four constraints on \alpha altogether: two geometric constraints and two material constraints. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://illuminium.org/content/images/2021/01/triangle-reflect.png" class="kg-image" alt="Gemstones and light" srcset="http://illuminium.org/content/images/size/w600/2021/01/triangle-reflect.png 600w, http://illuminium.org/content/images/2021/01/triangle-reflect.png 795w" sizes="(min-width: 720px) 720px"><figcaption>A triangular gem. The choice of pavillion angle \alpha controls the reflection angles \theta_1 and \theta_2. They must be shallow enough to enable total internal reflection in our chosen material.&nbsp;</figcaption></figure><ol><li>The angles \(\theta_1\) and \(\theta_2\) represent reflections, so they must lie between 0 and 90 degrees.</li><li>By triangle geometry, \(\theta_1=\alpha\), and \(\theta_2 = 180^\circ -3\alpha\). </li><li>In order for the first bounce to behave like a mirror, \(\theta_1\) must exceed the material's critical angle.</li><li>In order for the second bounce to behave like a mirror, \(\theta_2\) must exceed the material's critical angle.</li></ol><p>These four constraints, along with the definition of critical angle \(\theta_c = \arcsin(1/n)\) in terms of refractive index <em>n</em>, enable us to find the acceptable range of angles for making our shiny gemstone. </p><p>In the following graph, I have depicted the four constraints and their range of solutions: </p><figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="http://illuminium.org/content/images/2021/01/gem-zone.png" class="kg-image" alt="Gemstones and light" srcset="http://illuminium.org/content/images/size/w600/2021/01/gem-zone.png 600w, http://illuminium.org/content/images/size/w1000/2021/01/gem-zone.png 1000w, http://illuminium.org/content/images/size/w1600/2021/01/gem-zone.png 1600w, http://illuminium.org/content/images/size/w2400/2021/01/gem-zone.png 2400w" sizes="(min-width: 1200px) 1200px"><figcaption>A gemstone becomes a perfect mirror when its underside is cut into an appropriate triangular shape. As shown in this graph, the range of allowed pavillion angles (horizontal axis) depends on the refractive index of the gemstone material (vertical axis).&nbsp;</figcaption></figure><p></p><h2 id="fun-applications">Fun Applications </h2><p>In short, we have learned—to first approximation—that you make a gemstone shine brightest by making it into a <em>retroreflector with two internal rotations</em>. You can dream up some interesting consequences of this fact, a few of which I enumerate below: </p><ul><li><strong>Gems are like other retroreflectors.</strong> Gems work by using mirrored surfaces to send incoming light right back out, the same principle as eyeshine in cats and other animals, and those bright retroreflectors on highways.</li><li><strong>Miscut gems become windows. </strong>If you cut the gem at the wrong angle, the bottom facets will leak light instead of reflecting the light back up. Gemologists refer to this unfortunate event as <em>windowing </em>the gem. We now understand the physics behind it: instead of becoming total internal reflectors, the facets of a miscut gem remain translucent like windows.</li><li><strong>You can't make gems out of certain materials.</strong> Our recipe is for making a gemstone using two total internal reflections. If a material's refractive index is below \(\sqrt{2}\approx 1.41\), you can't achieve those two internal reflections.</li><li><strong>A bigger index means a wider range. </strong>Materials with greater refractive indices have more flexible ranges of pavillion angle.</li><li><strong>You can quench fire with water.</strong> The shape of a gem is tailored to the refractive index of the material and also, implicitly, the refractive index of air. If you put a loose gem into water, its facets stop behaving like perfect mirrors and it loses all of its sparkle.</li><li><strong>Sunlight is best. </strong>In our approximation, we only imagined parallel light rays coming straight into the sun. Of course, most lighting environments have diffuse light coming in from all directions. A superb example of parallel light is sunlight; hence gems will look their best when you're looking straight into the crown, and the sun's rays shine directly into the crown as well. </li><li><strong>You can make cones, too. </strong>In 3D, instead of making the pavillion out of triangular facets, you could simply lathe the gem into a cone of the appropriate angle. This would achieve the total internal reflection just as well as discrete facets. It wouldn't have sparkling facets, but I expect it would have its own smoothly luminous beauty. </li><li><strong>You can't see through a gem.</strong> Here's one way to confirm that gems use total internal reflection: you can't see through it when you're looking through the crown! This is most obvious on a large, loose, translucent gem: hold the gem up to a colorful surface and look through the crown. You won't be able to see the colorful surface through the gem.</li></ul>]]></content:encoded></item><item><title><![CDATA[Polyhedra in Knots]]></title><description><![CDATA[Drawing Celtic knots using platonic solids as the underlying shape.]]></description><link>http://illuminium.org/polyhedra-in-knots/</link><guid isPermaLink="false">600e7711639a6abc73f79128</guid><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Wed, 06 Jan 2021 08:19:00 GMT</pubDate><media:content url="http://illuminium.org/content/images/2021/01/knot2.jpg" medium="image"/><content:encoded><![CDATA[<img src="http://illuminium.org/content/images/2021/01/knot2.jpg" alt="Polyhedra in Knots"><p>Celtic knots, or interlace, are a beautiful, ancient art form with interesting symmetries and topological properties:</p><p>It turns out that you can follow a recipe to turn any planar graph into its corresponding knotwork, or vice-versa. (You can follow this recipe, the <a href="http://www.entrelacs.net/The-basics%20">Mercat procedure</a>, by hand; alternatively, it's precise enough that you can implement it as a <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.98.3119&amp;rep=rep1&amp;type=pdf">computer program</a>.)</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://logical.ai/polyknot/img/trifoil.png" class="kg-image" alt="Polyhedra in Knots"><figcaption>You can transform any graph into knotwork. (<a href="http://illuminium.org/polyhedra-in-knots/entrelacs.com">entrelacs.com</a>)</figcaption></figure><p>With this recipe in hand, I began seriously wondering what some of my favorite and familiar graphs would look like as knotwork. What about the triforce symbol? Or a square? What about a cube? Oh! And what about the rest of the platonic solids as well?</p><figure class="kg-card kg-gallery-card kg-width-wide kg-card-hascaption"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/tetra.png" width="160" height="152" alt="Polyhedra in Knots"></div><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/cube.png" width="160" height="178" alt="Polyhedra in Knots"></div><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/octahedron.png" width="160" height="158" alt="Polyhedra in Knots"></div></div><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/dodecahedron.png" width="160" height="160" alt="Polyhedra in Knots"></div><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/icosa.png" width="160" height="154" alt="Polyhedra in Knots"></div></div></div><figcaption>The five platonic solids. (Images from Wikipedia)</figcaption></figure><p>Yes, that was a good challenge. The platonic solids are fun to try to visualize (I hadn't learned how to effectively visualize yarn wrapping around 3D shapes, so I had to try several ways of drawing them in two-dimensional flatland; see below.). After much trial and error, I got the following glorious series of pictures:</p><figure class="kg-card kg-gallery-card kg-width-wide kg-card-hascaption"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/knot-tetra-1.png" width="443" height="420" alt="Polyhedra in Knots"></div><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/knot-cube-2.png" width="423" height="423" alt="Polyhedra in Knots"></div><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/knot-octa-1.png" width="478" height="449" alt="Polyhedra in Knots"></div></div><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/knot-dodeca-1.png" width="815" height="798" alt="Polyhedra in Knots" srcset="http://illuminium.org/content/images/size/w600/2021/01/knot-dodeca-1.png 600w, http://illuminium.org/content/images/2021/01/knot-dodeca-1.png 815w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/knot-icosa-1.png" width="784" height="740" alt="Polyhedra in Knots" srcset="http://illuminium.org/content/images/size/w600/2021/01/knot-icosa-1.png 600w, http://illuminium.org/content/images/2021/01/knot-icosa-1.png 784w" sizes="(min-width: 720px) 720px"></div></div></div><figcaption>From left to right, knotwork corresponding to the tetrahedron, cube, octahedron, dodecahedron, and icosahedron.</figcaption></figure><p>As you can see here,</p><ol><li>Each knotwork consists of <strong>interlocked circles</strong> (3 for the tetrahedron; 4 for the cube and octahedron; 6 for the dodecahedron and icosahedron).</li><li>Corresponding pairs of <a href="https://en.wikipedia.org/wiki/Dual_polyhedron">dual shapes</a> have the same number of circles (cube-octahedron, dodecahedron-icosahedron). They vary based on how the circles are arranged; e.g. whether there's a central circle.</li><li>Each knotwork has various symmetries including rotational and reflective, as well as the over-under pattern of string crossings.</li><li>The overlapping circles create regions with recognizable shapes. For example, the icosahedron's knotwork is made up of five-sided and three-sided regions (with a pentagon in the middle). Its dual, the dodecahedron, is made of the same shapes, but with a triangle in the middle. You can see these shapes more clearly when the regions are colored in a checkerboard pattern (see below). The cube and octahedron include four-sided regions.</li><li>There are other patterns if you look—for example, how many stars can you spot in the icosahedron and dodecahedron knotwork below?</li></ol><figure class="kg-card kg-gallery-card kg-width-wide kg-card-hascaption"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/tile-tetra.png" width="443" height="420" alt="Polyhedra in Knots"></div><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/tile-cube.png" width="423" height="423" alt="Polyhedra in Knots"></div><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/tile-octa.png" width="478" height="449" alt="Polyhedra in Knots"></div></div><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/tile-dodeca.png" width="815" height="798" alt="Polyhedra in Knots" srcset="http://illuminium.org/content/images/size/w600/2021/01/tile-dodeca.png 600w, http://illuminium.org/content/images/2021/01/tile-dodeca.png 815w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="http://illuminium.org/content/images/2021/01/tile-icosa.png" width="784" height="740" alt="Polyhedra in Knots" srcset="http://illuminium.org/content/images/size/w600/2021/01/tile-icosa.png 600w, http://illuminium.org/content/images/2021/01/tile-icosa.png 784w" sizes="(min-width: 720px) 720px"></div></div></div><figcaption>Checkerboard-shaded knotworks for the tetrahedron, cube, octahedron, dodecahedron, and icosahedron.</figcaption></figure><hr><figure class="kg-card kg-image-card"><img src="http://logical.ai/polyknot/img/sm/knot-icosa.png" class="kg-image" alt="Polyhedra in Knots"></figure><p><strong>Mathematical remark</strong>: To count the number of threads, you can use the formula: \(|<em>T</em>(−1,−1)|=2^<em>c</em>−1\) where <em>T</em> is the <a href="https://en.wikipedia.org/wiki/Tutte_polynomial#Deletion%E2%80%93contraction">Tutte polynomial</a> of the planar graph, and <em>c</em> is the number of threads. Incidentally, because the dual of a graph has the same Tutte polynomial with <em>x</em> and <em>y</em> exchanged, this implies a full generalization of the result we discovered here: every graph has the same number of knotwork strands as its dual.</p><p><strong>Mathematical remark</strong>: As shown in the checkerboard-shaded pictures, the knotwork for each polyhedron divides space into two kinds of shape, e.g. triangles and pentagons. The two shapes are apparently directly related to the <a href="https://en.wikipedia.org/wiki/Schl%C3%A4fli_symbol">Schlaffi symbol</a> for the polyhedron—that is, the shape of each face, and the number of faces meeting at each vertex.</p><h2 id="1-how-i-generated-these">1 How I generated these</h2><p>To generate this knotwork, you start with one of the figures such as the icosahedron:</p><figure class="kg-card kg-image-card"><img src="http://logical.ai/polyknot/img/nice-icosa.jpg" class="kg-image" alt="Polyhedra in Knots"></figure><p>You want to stretch it so that you can draw it on a flat piece of paper without any of the lines crossing. In this particular case, you can take the back-face triangle and pull all of its vertices out from behind the icosahedron. The result is a <a href="https://en.wikipedia.org/wiki/Platonic_graph">planar graph</a>:</p><figure class="kg-card kg-image-card"><img src="http://logical.ai/polyknot/img/nicer-icosa.png" class="kg-image" alt="Polyhedra in Knots"></figure><p>Now we can apply the <a href="http://www.entrelacs.net/The-basics%20">Mercat procedure</a> to draw threads that cross in pairs at the midpoint of every edge in the graph. The result is a bit messy, but if you color in each of the threads in a different color, you see that the knotwork is made up of simple (non-self-intersecting) closed loops.</p><p>To straighten out the wobby loops into perfect circles, all I did was arrange some colored circles by trial and error into positions that had the same symmetry as the knotwork. I then checked whether my circles had the same crossings as the knotwork, and made the same shaped regions (triangles, pentagons). The result is as you've seen, and you can repeat this process for any of the other polyhedra:</p><figure class="kg-card kg-image-card"><img src="http://illuminium.org/content/images/2021/01/thick-dodeca-1.png" class="kg-image" alt="Polyhedra in Knots"></figure>]]></content:encoded></item><item><title><![CDATA[Colorless green mana sleeps furiously]]></title><description><![CDATA[The Magic: The Gathering card game has evolved its own English dialect, complete with new grammar. Here, I describe and codify some of the (implicit) rules.]]></description><link>http://illuminium.org/colorless-green-mana-sleeps-furiously/</link><guid isPermaLink="false">600e831a639a6abc73f79257</guid><category><![CDATA[linguistics]]></category><category><![CDATA[magic-the-gathering]]></category><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Mon, 16 Nov 2020 10:49:00 GMT</pubDate><media:content url="http://illuminium.org/content/images/2021/01/colorless-green.png" medium="image"/><content:encoded><![CDATA[<img src="http://illuminium.org/content/images/2021/01/colorless-green.png" alt="Colorless green mana sleeps furiously"><p>The <em>Magic: The Gathering</em> card game has evolved its own strange and wonderful dialect. Although the rules on each card were originally written in standard informal English, the language has been shored up over time so that it is more technically precise and unambiguous—a kind of specialist, almost legalese, offshoot of English. The break with standard English grammar is striking and profound.</p><p>For example, <em>Magic</em> has a new determiner, "target", that standard English lacks (ex: <em>Destroy target land</em>) and the word <em>permanent</em> can be <a href="https://en.wikipedia.org/wiki/Nominalized_adjective">used as a noun</a> but never as an adjective (ex: <em>Permanents you control can't block</em>).</p><p>And the differences go beyond mere tweaks to the lexicon, i.e. just adding new words or new ways of using words. These differences pervade the grammar at a deep level: Certain phrasings, while innocuous in English, sound wrong to anyone who has played <em>Magic</em> long enough to get the knack of it. Compare<sup><a href="http://logical.ai/mtgparse/org/journal.html#fn.1">1</a></sup>:</p><ul><li>All creatures have haste.</li><li>* Creatures have haste.</li><li>Red creatures have haste.</li><li>* All red creatures have haste.</li></ul><p>These phrasing rules are—to my knowledge—not stated explicitly anywhere. They are learned apparently without direct instruction and without most players even noticing it. And while the lexicon was carefully put together by hand, the grammar appears to have emerged organically. Nonetheless, I claim that Magic players generally all acquire an ear for these rules, and generally have consistent judgments about what sounds strange.</p><p>I'm curious about what these rules are. This article is an attempt to do some linguistic investigative work to characterize the strange and wonderful dialect of <em>Magic</em>. I think it would be interesting to do a proper linguistics study; in lieu of this, I have surveyed my Magic-playing friends to corroborate my guesses. I have also made use of the fact that Magic has a de facto exhaustive corpus—namely, the text of all cards that have ever been printed. I use this corpus testimony to confirm that certain phrasings are allowable, and (although a productive grammatical system can produce an infinite variety of things to say) that when I label a phrasing as unallowable, it genuinely doesn't occur anywhere.</p><p>I start the linguistic investigation here in this article, but <em>Magic</em>'s grammar is so complex, I can hardly cover everything. I hope that others might be inspired to take on some aspect of this work. There is much work to be done.</p><h2 id="static-abilities">Static abilities</h2><h3 id="scoping-quantifiers-all-creatures-have-haste-">Scoping quantifiers: All creatures have haste.</h3><p>Let's start with a simple static ability "All creatures have haste". Consider these variations:</p><ol><li>[?] All creatures have haste</li><li>[?] Creatures have haste</li><li>[?] Red creatures have haste</li><li>[?] Creatures you control have haste</li><li>[?] Red creatures you control have haste</li><li>[?] All red creatures have haste</li><li>[?] All creatures you control have haste.</li></ol><p>If you're a fluent speaker of Magic, I suspect some of these sentences sound better—more <em>correct</em>—than others. Before reading further, feel free to take a moment to consider which of these sentences sounds a little off; we can see if our judgments agree.</p><p>Here are my judgments; in the case of positive judgments, I've attempted to find a card as supporting evidence. Although it was not always possible to find an <em>exact</em> match, the card is always a clear and compelling relative—one that merely uses White instead of Red, or flying instead of haste, for example.</p><ol><li>All creatures have haste (<a href="https://api.scryfall.com/cards/f51699d1-982d-4cfa-b0e0-7e89ec68dd96?format=text&amp;pretty=true">Concordant crossroads</a>)</li><li>* Creatures have haste</li><li>Red creatures have haste (<a href="https://api.scryfall.com/cards/adfa87eb-9a11-459c-bff8-87bb09b61b87?format=text&amp;pretty=true">Aysen Highway</a>)</li><li>Creatures you control have haste. (<a href="https://api.scryfall.com/cards/037b396c-2146-4d86-9d13-757685c850c7?format=text&amp;pretty=true">Archetype of Imagination</a>)</li><li>Red creatures you control have haste. (<a href="https://api.scryfall.com/cards/734ad23e-7603-4625-b8e3-54466ad86736?format=text&amp;pretty=true">Bloodmark Mentor</a>)</li><li>* All red creatures have haste.</li><li>* All creatures you control have haste.</li></ol><p>and the same variations with the subtype Sliver added:</p><ol><li>All Sliver creatures have haste. (<a href="https://api.scryfall.com/cards/d0dc86d6-aa3e-46c6-9405-86f1e1ee7844?format=text&amp;pretty=true">Battering Sliver</a>)</li><li>* Sliver creatures have haste.</li><li>Red Sliver creatures have haste.</li><li>Sliver creatures you control have haste. (<a href="https://api.scryfall.com/cards/b78b8268-b090-4012-a3ba-5daab491f78d?format=text&amp;pretty=true">Belligerent Sliver</a>)</li><li>Red Sliver creatures you control have haste.</li><li>* All red Sliver creatures you control have haste.</li><li>* All Sliver creatures you control have haste.</li></ol><p>What distinguishes the good-sounding cases from the bad-sounding ones? I suggest the following theory:</p><ul><li>The main noun (creatures) must have some scoping quantifier attached to it. Intuitively, <em>Creatures have haste</em> doesn't sound specific enough---<em>which</em> creatures have haste?</li><li>The scoping quantifier can be any of these: The universal quantifier ("All"), a color ("Red"), a control status ("__ you control") or an ability clause ("__ with flying").</li><li>The quantifier "All" can't co-occur with any of the other qualifiers. Everything else can happily co-occur.</li><li>Type descriptors, such as "Sliver", are totally optional—they aren't a kind of scoping quantifier like "all" "red" or "you control". You can always include them and always leave them out.</li></ul><p>Using the Python Natural Language Toolkit, you can define a <a href="https://www.nltk.org/book/ch09.html">feature-based grammar</a> to account for these observations. (See the Appendix at the end of this section for file details.)</p><p>To codify the static-ability theory here, I introduce a binary feature <code>+definite</code> which is conferred by each of the scoping quantifiers and inherited upwards (so any phrase containing a <code>+definite</code> constituent is itself definite). The grammar thereby imposes the "scoping quantifier" requirement by requiring the overall sentence to be <code>+definite</code>. Finally, the word "All" confers definiteness, but can only be paired with a <code>-definite</code> (definite-lacking) phrase.</p><p>(I use an irritating contrivance to ensure that each of the quantifiers occurs at most once: the quantifiers are considered in the order "_ with/out [ability]", "_ [player] controls", "[color] __", "[type descriptor] __." As an unfortunate side effect, this makes the rules-list longer and more cumbersome than it needs to be. Perhaps I will rewrite it with a more elegant approach later.)</p><!--kg-card-begin: markdown--><pre><code>% start S
S -&gt; StaticAbility

StaticAbility -&gt; DefinedClause[num=?n, +definite] HasAbility[num=?n] Ability

DefinedClause[num=?n, +definite] -&gt; 'all' WithAbilityClause[num=pl, -definite]
DefinedClause[num=?n, +definite] -&gt; 'other' WithAbilityClause[num=pl]
DefinedClause[num=?n, definite=?d] -&gt; WithAbilityClause[num=pl, definite=?d]

WithAbilityClause[num=?n, +definite] -&gt; ControlledClause[num=?n] 'with' Ability | ControlledClause[num=?n] 'without' Ability 
WithAbilityClause[num=?n, definite=?d] -&gt; ControlledClause[num=?n, definite=?d] 

ControlledClause[+definite, num=?n] -&gt; ColorClause[num=?n] 'you' 'control'
ControlledClause[definite=?d, num=?n] -&gt; ColorClause[definite=?d, num=?n]

ColorClause[+definite, num=?n] -&gt; Color SubtypeClause[num=?n]
ColorClause[definite=?d, num=?n] -&gt; SubtypeClause[num=?n, definite=?d]

# Subtypes don't confer definiteness 
SubtypeClause[definite=?d, num=?n] -&gt; 'sliver' FinalClause[definite=?d, num=?n] | FinalClause[definite=?d, num=?n]

FinalClause[definite=?d, num=?n] -&gt; Permanent[num=?n,definite=?d]

Permanent[num=sg] -&gt; 'permanent'| 'land'| 'creature'| 'artifact'
Permanent[num=pl,-definite] -&gt; 'permanents'| 'lands'| 'creatures'| 'artifacts'
Permanent[num=pl,-definite] -&gt; 'slivers'

Ability -&gt; 'haste' | 'flying' | 'vigilance' | 'reach' | 'defender' | 'lifelink' | 'deathtouch' | 'menace'
</code></pre>
<!--kg-card-end: markdown--><p></p><h3 id="1-2-negative-polarity-creatures-can-t-block-">1.2 Negative polarity: Creatures can't block.</h3><p>In the previous section, we showed how the "…have haste" static ability requires some sort of scoping quantifier such as "All" or "Red" or "_ you control". As we will see, the "…can't block" predicate has a different set of requirements:</p><ol><li>* All creatures can't block.</li><li>Creatures can't block. (Bedlam)</li><li>Red creatures can't block. (Awe for the Guilds, Flooded woodlands)</li><li>Creatures you control can't block. (Blightbeetle, Cosmotronic wave)</li><li>Red creatures you control can't block. (Deepchannel Mentor)</li><li>* All red creatures can't block.</li><li>* All creatures you control can't block.</li><li>Slivers you control can't block (Doomed Artisan)</li><li>Sliver creatures can't block (Ruthless invasion) (?)</li></ol><p>In this context, apparently all scoping quantifiers are now optional—they can always be included or left out. The one exception is "All", which is completely forbidden.</p><p>Why should "All" be completely forbidden in this context? To my ear, "All" sounds wrong in the <a href="https://en.wikipedia.org/wiki/Polarity_item">negative context</a> created by "can't". In standard English, this happens with words like "somewhat" that are ungrammatical in a negative environment:</p><ul><li>I liked the movie somewhat. (Standard English)</li><li>* I didn't like the movie somewhat. (Standard English)</li></ul><p>In fact, we've got some evidence that Magic's "All" is a positive-polarity item. Contrast these two abilities:</p><ul><li>All red creatures can block […] (Frenzied Saddlebrute)</li><li>* All red creatures can't block.</li></ul><p>To accomodate this theory, we can introduce a new lexical feature <code>+polarity</code>. The "can't" phrase introduces negative polarity <code>-polarity</code>, while "All" is a word that must bind to a phrase with positive <code>+polarity</code> and (as already established) negative <code>-definite</code>-ness.</p><p>Here's the new rule for static abilities, updated accordingly:</p><!--kg-card-begin: markdown--><pre><code>StaticAbility -&gt; DefinedClause[-polarity] &quot;can't&quot; &quot;block&quot;
StaticAbility -&gt; DefinedClause[num=?n, +definite] HasAbility[num=?n] Ability

DefinedClause[num=?n,+definite, +polarity] -&gt; 'all' WithAbilityClause[num=pl, -definite]
</code></pre>
<!--kg-card-end: markdown--><h2 id="2-appendix-python-nltk">2 Appendix: Python nltk</h2><p>The grammars in this article are written using the Python Natural Language Toolkit (nltk). In the general setup, I have a file containing the grammar <code>mtg.fcfg</code> which is written in a kind of context-free grammar syntax. I also have a python script that loads the grammar and uses it to test various sentences. For example:</p><!--kg-card-begin: markdown--><pre><code class="language-python">import nltk

from nltk import grammar, parse
cp = parse.load_parser('mtg.fcfg')

sentences = [
    (&quot;creatures have haste&quot;, False),
    (&quot;all creatures have haste&quot;, True), # Concordant crossroads
    (&quot;creatures you control have haste&quot;, True),
    (&quot;red creatures have haste&quot;, True), # Aysen Highway
    (&quot;all red creatures have haste&quot;, False), 
    (&quot;all creatures you control have haste&quot;, False),
    (&quot;red creatures you control have haste&quot;, True ), 
    (&quot;sliver creatures have haste&quot;, False),
    (&quot;all sliver creatures have haste&quot;, True),
    (&quot;all red sliver creatures you control have haste&quot;, False),
    (&quot;red sliver creatures you control have haste&quot;, True),
    (&quot;other creatures have haste&quot;, True),
    (&quot;slivers you control have haste&quot;, True),
    (&quot;all slivers have haste&quot;, True),
    (&quot;creatures with flying have haste&quot;, True), #Empyrean Eagle #Smog Elemental

    (&quot;creatures can't block&quot;, True), # Bedlam
    (&quot;all creatures can't block&quot;, False),
    (&quot;other creatures can't block&quot;, True),
    (&quot;red creatures can't block&quot;, True),
    (&quot;slivers can't block&quot;, True)
]

for s,judgment in sentences:
    tokens = s.split()
    trees = cp.parse(tokens)

    has_parse = None
    for t in trees :
        has_parse = t
        break
    if has_parse :
        print(s)
        # print(t)
    else :
        print(&quot;*&quot;, s)

    if bool(has_parse) != bool(judgment) :
        print(&quot;\t\t&lt;&lt;&lt;Unit test failed&quot;)
        ```</code></pre>
<!--kg-card-end: markdown--><h2 id="footnotes-">Footnotes:</h2><p><sup><a href="http://logical.ai/mtgparse/org/journal.html#fnr.1">1</a></sup> In this article, following standard linguistic conventions, I mark sentences with an asterisk (*) when I think they sound strange (ungrammatical); unmarked sentences sound right.</p>]]></content:encoded></item><item><title><![CDATA[Fitting conics to data]]></title><description><![CDATA[Given some empirical data points, find the best-fit hyperbola/parabola/ellipse passing through them. Includes Python code.]]></description><link>http://illuminium.org/fittings-conics-to-data/</link><guid isPermaLink="false">6017a0c5639a6abc73f79973</guid><category><![CDATA[conic-sections]]></category><category><![CDATA[linear-algebra]]></category><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Fri, 19 Jul 2019 00:07:00 GMT</pubDate><media:content url="http://illuminium.org/content/images/2021/02/fitted_hyperbola.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="http://illuminium.org/content/images/2021/02/fitted_hyperbola.png" alt="Fitting conics to data"><p>The conic sections are a family of shapes consisting of parabolas, hyperbolas, and ellipses. Conic sections show up in many scientific applications; for example, celestial orbits trace out different conic sections depending on their energy<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>.  The shadow cast by a sundial's &quot;spike&quot; (<em>gnomon</em>) traces out a different conic section depending on latitude and time of year<sup class="footnote-ref"><a href="#fn2" id="fnref2">[2]</a></sup>. And mirrors shaped like conic sections have important optical properties for focusing light<sup class="footnote-ref"><a href="#fn3" id="fnref3">[3]</a></sup>.</p>
<p>It's therefore useful to be able to take some imprecise physical measurements and fit a conic-shaped curve to them. In this article, I provide some code for doing this. The figure above illustrates fitting some real data points for a sundial; the algorithm finds the hyperbolic shape shown.</p>
<p>Algebraically, conic sections are the graphs of the equation: $$Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0$$</p>
<p>(It's just any general polynomial you can make involving <em>x</em> and <em>y</em> where no term has a combined exponent bigger than two.) There is some <a href="https://en.wikipedia.org/wiki/Matrix_representation_of_conic_sections">beautiful linear algebra</a> under the hood; one useful fact is that the discriminant \(B^2-4AC\) is either positive, negative, or zero, which tells you whether the shape is an ellipse, hyperbola, or parabola.</p>
<p>To measure how well a particular conic section fits your data \(\langle<br>
x_i, y_i\rangle\), you might imagine a straightforward algorithm: compute \(A x_i^2 + Bx_iy_i + C y_i^2 + D x_i + E y_i + F\) for each data point, square those values and add them up, then see how far away the sum is from zero. To find the optimal fit, vary the coefficients to make this sum as close to zero as possible.</p>
<p>This basic approach almost works, despite the search space being unstable<sup class="footnote-ref"><a href="#fn4" id="fnref4">[4]</a></sup>. You can modify it to make it more stable and to allow the user to specify a target conic type (hyperbola, parabola, or ellipse) in advance. In a <a href="http://illuminium.org/conic-fitting-82101893.pdf">paper</a> by Nievergelt, the author describes how to do this. I implemented the suggested algorithm in Python, as shown below.</p>
<p>Interestingly, the algorithm gets less stable the <em>better</em> the data fit a particular conic; a little empirical noise is useful. Because my target application (determining whether a blackbox function represents a conic) involved extremely accurate conic sections, this threw off my results. So I modified the algorithm slightly. Where the algorithm uses an SVD decomposition to decide whether the points all lie on a line, I use the Theil-Sen estimator<sup class="footnote-ref"><a href="#fn5" id="fnref5">[5]</a></sup>.</p>
<p>I also found a few typos in the manuscript, which when fixed allowed me to exactly reproduce the curves in the paper.</p>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"><p>In a flyby, the object has enough surplus energy to escape the gravitational pull, and gets flung out along a hyperbolic orbit. In a closed orbit, the object remains gravitationally captive, tracing an elliptic orbit. In the parabolic case, the object has <em>just</em> enough energy to exactly cancel the gravitational pull, and also escapes. <a href="#fnref1" class="footnote-backref">↩︎</a></p>
</li>
<li id="fn2" class="footnote-item"><p>For most places, the sun rises and sets, spending the night below the horizon. In this case, the gnomon's shadow traces out a hyperbolic path over the course of the day.  Near the poles, the sun might spend the entire day above the horizon, and the shadow traces out an ellipse. In the exact intermediate case, the sun barely grazes the horizon before rising again, and the shadow traces out a parabola. <a href="#fnref2" class="footnote-backref">↩︎</a></p>
</li>
<li id="fn3" class="footnote-item"><p>See the Cassegrain telescope design, for example. <a href="#fnref3" class="footnote-backref">↩︎</a></p>
</li>
<li id="fn4" class="footnote-item"><p>Small variations in data can cause large variations in best-fit conic; infinitesimal changes to a parabola will make it an ellipse or hyperbola; the algorithm can often fit non-conic data extremely closely, which is unfortunate for <em>detecting</em> conics. <a href="#fnref4" class="footnote-backref">↩︎</a></p>
</li>
<li id="fn5" class="footnote-item"><p>The Theil-Sen estimator is a neat simple algorithm to find a best-fit line to some data: First, you compute all lines through all pairs of points. Then you determine the median slope \(m\) among the slopes of those lines. Second, you draw a line of slope \(m\) through each of the data points and compute their y-intercepts. Find the median intercept value \(b\). The overall fit line is \(y=mx+b\), and it's particularly resistant to outliers because we used medians throughout. <a href="#fnref5" class="footnote-backref">↩︎</a></p>
</li>
</ol>
</section>
<!--kg-card-end: markdown--><h1 id="source-code">Source code</h1><pre><code class="language-python">from numpy.linalg import svd, qr, solve, det
from numpy import array, matmul, float64, transpose # , allclose, matmul, float64
from math import sqrt

#### Given a list of 2D points, return an array
#### describing the best-fit conic. Returns something special in the
#### case of degenerate conics (e.g. straight lines)

# See paper: Yves Nievergelt, "Fitting conics of specific types to
# data"


SMALL = 10**-12
sqrt2 = 2**0.5

TYPE_HYPERBOLA = "hyperbola"
TYPE_PARABOLA = "parabola"
TYPE_ELLIPSE = "ellipse"


def centered(points) :
    """Subtract the average from the (x,y) pairs."""
    xs_uncentered = [x for (x,y) in points]
    ys_uncentered = [y for (x,y) in points]

    x_center = sum([x for x in xs_uncentered])/len(points)
    y_center = sum([y for y in ys_uncentered])/len(points)

    xs = [x-x_center for x in xs_uncentered]
    ys = [y-y_center for y in ys_uncentered]

    return list(zip(xs,ys)), (x_center, y_center)


def collinearity(points) :
"""Return a number indicating how very nearly the points follow a line. Zero indicates perfect fit."""
    # This is a very hackish parody of Theil-Sen estimator. I'm using
    # it because SVD sometimes fails to converge, and besides for this
    # application I care only about detecting near-perfect
    # fits. Returns the mean square error of the estimator, as a
    # number.

    (x0, y0) = points[0]

    average_x_deviation = sum(abs(x-x0) for (x,y) in points[1:])/len(points)
    if (average_x_deviation &lt; SMALL) :
        # VERTICAL LINE
        return 0

    slopes = sorted([(y-y0)/float(x-x0) for (x,y) in points[1:]])
    median_slope = slopes[int(len(slopes)/2)]
    
    intercepts = sorted([y - median_slope*x for (x,y) in points[1:]])
    median_intercept = intercepts[int(len(intercepts)/2)]
    
    average_deviation = sum((y-median_slope*x-median_intercept)**2/len(points)
                            for (x,y) in points)
    return average_deviation


def smallest_singular(M, compute_singular_vector=True) :
    """Return a pair containing the smallest singular value of M and a
corresponding singular vector.
    """

    if compute_singular_vector: 
        _, s, Vh = svd(M, full_matrices=True)
        return s[-1], Vh[-1]
    

def fit_conic(points, desired_type=None) :
    points, center = centered(points)

    matrix_monomials = array([
        [1, x, y,    y*y-x*x, 2*x*y, y*y+x*x]
        for (x,y) in points])

    # ---- Check for degenerate conic lying on a single line
    if (collinearity(points) &lt; SMALL) :
        return None


    # ---- Perform decomposition
    submatrix = matrix_monomials[:,:3] # (1,x,y)
    q,r = qr(submatrix, "complete")

    
    R_full = matmul(transpose(q), matrix_monomials)
    RA = R_full[:3, 0:3]
    RB = R_full[:3, 3:6]
    RC = R_full[3:, 3:6]
    _, vec_smallest = smallest_singular(RC)

    # ----- Determine type of conic
    Z = array([[-1,0,1],
               [0,sqrt2,0],
               [1,0,1]]) / sqrt2
    D = array([[-1,0,0],
               [0,-1,0],
               [0,0,1]])/4

    A_det = transpose(vec_smallest) @ D @ vec_smallest
    A_trace = vec_smallest[2]

    conic_type = TYPE_PARABOLA if (abs(A_det) &lt; SMALL) else TYPE_ELLIPSE if A_det &gt; 0 else TYPE_HYPERBOLA


    # ---- Adjust answer if it doesn't match desired conic type (not
    # ---- implemented yet)
    
    if(False and desired_type == TYPE_PARABOLA) :
        # "desired type" not implemented yet.  also not necessary for
        # this application b/c empirical points are expected to be
        # extremely unambiguously close to particular conics.
        
        pass
    else :
        q = vec_smallest


    # ------ Solve for conic coefficients
    ret = solve(RA, -1 * (RB @ q)) # c, *two_b

    params = [*ret, *q]

    conic_coeffs = [ params[5]-params[3],
                         2*params[4],
                         params[5]+params[3],
                         params[1],
                         params[2],
                         params[0]]

    
    fit  = sum([x**2 for x in matmul(matrix_monomials, array(params))])/len(points)


    A,B,C,D,E,F = conic_coeffs

    
    quadratic_form = array([[A, B/2],[B/2,C]])

    full_form = array([[  A, B/2, D/2],
                       [B/2,   C, E/2],
                       [D/2, E/2,   F]])

    if(abs(det(full_form)) &lt; 1e-8) :
            # degenerate conic
            return None
    
    
    u,s,vh = svd(quadratic_form)

    K =  -det(full_form)/det(quadratic_form) if det(quadratic_form) != 0 else None

    axes = None
    try :
        axes = [(K/x)**0.5 for x in s.tolist()]
    except Exception :
        pass
        
    return {"type" : conic_type,
            "coeffs" : conic_coeffs,
            "fit" : fit,
            "axes" : axes,
            "diagonalizer" : vh.tolist(),        
    }, center</code></pre>]]></content:encoded></item><item><title><![CDATA[Optimal Tychokinesis]]></title><description><![CDATA[Game-playing strategies for card games with luck manipulation.]]></description><link>http://illuminium.org/optimal-tychokinesis/</link><guid isPermaLink="false">600e7fa4639a6abc73f7920b</guid><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Sat, 23 Feb 2019 08:00:00 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1541278107931-e006523892df?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MXwxMTc3M3wwfDF8c2VhcmNofDV8fHBva2VyfGVufDB8fHw&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1541278107931-e006523892df?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MXwxMTc3M3wwfDF8c2VhcmNofDV8fHBva2VyfGVufDB8fHw&ixlib=rb-1.2.1&q=80&w=2000" alt="Optimal Tychokinesis"><p>The card game Push is played between two people. A deck is shuffled then divided in half, with each player receiving a half (face down). During a round, both players reveal the top card of their deck; the high card scores a point. (Ties are handled in a special way.) The winning player is whoever has the most points after all of the cards have been revealed. Obviously players can control the outcome of the game by magically manipulating probabilities.  In this brief note, I discuss optimal strategies for increasingly complex variations of the game. I describe the variant in one paragraph, followed by the solution. You should feel free to read the variant and discover the solution on your own. </p><h2 id="1-two-full-decks">1 Two full decks </h2><blockquote><strong>Problem</strong>: Suppose you are playing a simpler version of this game where you and your opponent each get a full deck of cards. Suppose the cards are numbered, say 1 through 52. Finally, suppose you know the exact order of your opponent's cards, which will not change. How should you, through tychokinesis, order your cards so as to achieve the highest possible score?</blockquote><p>Solution: The [only?] optimal solution is whenever your opponent plays a card, you play the card ranked one above it. The only card for which this strategy is impossible is when your opponent plays the highest-ranked card in the deck (which is unbeatable) in which case you play the lowest-ranked card in the deck. This "rotate by one" strategy is optimal because you win every round except the one in which your opponent plays a card that can never lose and you match it with a card that can never win. </p><h2 id="2-splitting-one-deck">2 Splitting one deck</h2><blockquote> <strong>Problem</strong>: Now suppose we split a single shuffled deck in half, giving one half to you and one half to your opponent. Suppose you still have perfect knowledge in this variant: you know exactly the shuffled order of your opponent's cards, which will not change. Consequently, you can determine which cards you've been dealt. How should you, through tychokinesis, order your cards so as to achieve the highest possible score?</blockquote><p>Solution: Note that we are trying to decide which cards in your deck to match against which cards in your opponent's deck. Once we've decided on that matchup policy, it doesn't matter how the opponent's deck is shuffled; just play the corresponding matched card. Here's an optimal strategy: You know which cards you have and which cards your opponent has. Mentally arrange your deck in ascending order of rank, and arrange your opponents cards the same way. Look at your opponent's highest-ranked card, and pair it with the lowest-ranked card you have that can beat it. (If none of your cards can beat it, pair it with your lowest-ranked card overall.)  Eliminate those two cards from consideration and repeat the matching process. This strategy is at least locally optimal because whenever you play a high card, you win, and whenever you don't, it's impossible to win. I suspect it is globally optimal as well. This strategy is also very general: it subsumes the strategy from the previous section, and actually applies to any two decks of the same size (not just decks created by splitting a single deck in half). </p><h2 id="3-opponent-plays-at-random">3 Opponent plays at random </h2><blockquote><strong>Problem</strong>: Now suppose you only know the contents, but not the order, of both decks: we split a single shuffled deck in half, giving one half to you and one half to your opponent. You know which cards each person has, and your opponent's cards are in a fixed but unknown order. How should you, through tychokinesis, order your cards so as to achieve the highest possible score?</blockquote><p>Solution: Perhaps surprisingly, you can't do anything strategic against a random opponent. Regardless of your chosen strategy, your expected score is equal to the probability that you win a random matchup between one of your cards and one of theirs, times the number of cards you have. You can prove this by induction, using an n-by-n matrix which has a 1 in entry (i,j) if your ith card beats their jth card and a 0 otherwise. Regardless of strategy, your expected score is equal to the sum of the entries in this matrix, divided by n. </p><h2 id="4-paying-for-entropy">4 Paying for entropy</h2><blockquote><strong>Problem</strong>: Next, we introduce tychokinetic costs. Again, a shuffled deck is split in two, with both players receiving a half. You know the contents of both decks, and as with the deterministic variant, suppose you know the fixed order of your opponent's deck. Normally, when you play a card, you are drawing uniformly from the set of all cards you haven't played yet. Using tychokinesis, you may instead choose to draw uniformly from a smaller subset. The smaller subset consists of your choice of one or more cards that you haven't played yet. When drawing from a smaller subset, you must pay an entropy cost of (n/k) log(n/k), where k&gt;0 is the size of the subset and n is the total number of unplayed cards in your deck. Suppose you just want to win, not necessarily by the largest possible margin. Find the strategy that minimizes the amount of entropy you pay for, subject to the condition that you still win the game if possible.</blockquote><p>Solution: ??? </p><h2 id="5-adversarial-zero-cost">5 Adversarial zero-cost </h2><blockquote><strong>Problem</strong>: In the ordinary game, you and an opponent have a face-down shuffled deck split between you. You draw the top card of your deck and your opponent does the same; then you reveal both cards and whoever's card has higher rank wins a point. The two cards are discarded and the process is repeated. The winner of the game is whoever has the most points when the decks are depleted. (If we suppose players do not know the contents of either deck, it is equivalent and conceptually simpler to model the game with both players drawing cards from a single face-down deck instead.) Now for tychokinesis. Before revealing a card, you may secretly, and at no cost, choose any subset of two or more specific cards that haven't been played yet. Your card will be drawn uniformly at random from this subset. Your opponent may do the same. (Neither of you has any information about whether the other person has used tychokinesis or which subset they've chosen, and the choice of subset is made before any cards are drawn that round.)  Cards are guaranteed by the laws of physics to be distinct. Is there an effective strategy for cheating that improves your chances of winning over playing fairly, or is the best strategy to play fairly? </blockquote><p>Solution: If you draw the card of highest rank, you win with certainty. If you draw the card of next-highest rank, you win unless your opponent draws the card of highest rank. If you draw any card of lower rank, you are less likely to win against any particular subset of cards; therefore, to maximize your expected winnings, you should choose the subset consisting of the two highest-ranked cards. By symmetry, so should your opponent. Also by symmetry, your probability of winning when both players use this strategy each round is 50%. Finally, each round, there are always at least two cards remaining in the shared deck. Because this strategy does not otherwise depend on which cards are in the deck, this strategy is optimal each round and your probability of winning the game overall is 50%. </p><h2 id="other-variants">Other variants</h2><ol><li>Minimax: You and an opponent play the game adversarially. Contents of both decks are unknown. You and the opponent may each pay entropy to draw from a smaller subset of /two/ or more cards that haven't been played yet. (You and your opponent are guaranteed by the laws of physics to draw distinct cards.)  Win, according to some metric of energy and points. </li><li>Energy profiles: If you and your opponent have available entropy budgets of H_1 and H_2, respectively, does this uniquely determine your expected probability of victory? (Or is uniform play still optimal so that the budget is never used?)</li></ol>]]></content:encoded></item><item><title><![CDATA[Empirical Pokémon Typing]]></title><description><![CDATA[How would you experimentally determine the Pokémon type chart if you didn't already know the types and their interaction strengths?]]></description><link>http://illuminium.org/empirical-pokemon-typing/</link><guid isPermaLink="false">600e7e8f639a6abc73f791ff</guid><category><![CDATA[pokemon]]></category><category><![CDATA[linear-algebra]]></category><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Tue, 02 Oct 2018 23:43:00 GMT</pubDate><media:content url="http://illuminium.org/content/images/2021/01/prof-oak.jpeg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="http://illuminium.org/content/images/2021/01/prof-oak.jpeg" alt="Empirical Pokémon Typing"><p>As you may know, the Pokémon type system consists of (approximately) seventeen different types, each with different comparative advantages over the others like a more elaborate version of rock-paper-scissors. In the Pokémon video games, the types and their advantages are hardcoded as laws. But if you adopt the view of someone who actually lives in the Pokémon universe, those advantages would have to be scientifically measured and discovered.</p>
<p>How would you empirically determine the types and their advantages? What information would you need to be able to measure, and how many measurements would you need to get a reasonably accurate picture? What would it take to be reasonably sure you had discovered all existing types and interactions? Questions like these comprise a field of study I call <strong>empirical Pokémon typing</strong>, and this article contains a few preliminary results.</p>
<h1 id="problem1relatingattackinganddefendingtypes">Problem #1: Relating attacking and defending types</h1>
<p>In our first result, I'll point out a feature of the type-effectiveness system that is surprisingly hard to discover empirically. We are told in the game that attacks have types, and Pokémon species have types, and that these types come from the same list: there are Fire-type attacks <em>and</em> Fire-type Pokémon. If you weren't told this relationship in advance, how could you discover it empirically?</p>
<p>There's one particularly good way to do it: same-type attack bonus (STAB) directly shows the link between an attack type and a Pokémon type, because the Pokémon using that attack gets an additional bonus. You could set up an experiment to identify STAB and therefore associate attack types with Pokémon types. I discuss this method in the next section.</p>
<p>You could also use an indirect method, such as assuming that a Pokémon shares a type with most of the attacks it learns. Then you could compute the appropriate learnset statistics to guess which attack types are associated with which Pokémon. This, however, is less decisive than STAB.</p>
<p>It turns out, actually, that STAB is the <em>only</em> direct method: without STAB, there is no way to empirically associate Pokémon types with attack types. Details follow.</p>
<p>Here's the basic structure of an empirical Pokémon typing experiment: You start with a group of Pokémon subjects, each of which knows some attacks. You have each Pokémon use each attack against each other Pokémon, and somehow measure the resulting susceptibility (type effectiveness).</p>
<p>Tabulating the results, you could fill out a table of empirically-determined type effectiveness values. The rows of the table will be attacks, and the columns of the table will be Pokémon species. Duplicate rows or duplicate columns suggest that two attacks / species are of the same type.</p>
<p>This effectiveness table is the source of our data. Now we must make a theory of how many types exist and what their effectivenesses are. To start, let's first approach the problem in a setting with the following simplifying assumptions:</p>
<ol>
<li><strong>No dual types</strong>. Each Pokémon has exactly one type. This way, we don't need to disentangle whether we are dealing with a dual type or not.</li>
<li><strong>Our measurements are perfect.</strong>  Our data has no errors because we can perfectly measure the susceptibility of each Pokémon to each attack.</li>
<li><strong>We can perfectly distinguish different species and types</strong>. Assume we are never confused about whether two species of Pokémon are the same, or whether two attacks are the same. (No crocodile vs alligator ambiguity)</li>
<li><strong>No STAB</strong>. Type effectiveness is completely determined by the attack type and defending Pokémon type. In particular, there are no other factors like same-type attack bonus (&quot;STAB&quot;). (Same-type attack bonus amplifies the type effectiveness of an attack based on the type of <em>attacking</em> Pokémon.)</li>
</ol>
<p>Under even these simplifying conditions, we have a surprising negative result:</p>
<blockquote>
<p>Without same-type attack bonus (STAB), there is no principled way to identify types of attack with types of Pokémon based on susceptibility measurements alone.</p>
</blockquote>
<p>In other words, using the effectiveness table, you could divide the <em>Pokémon species</em> into groups that seem to share the same type. And you could divide the <em>attacks</em> into groups that seem to share the same type. But there would be no principled way to match up the Pokémon species types with the corresponding attack types.</p>
<p>This means that if you weren't told that the attacks we call Fire-type (attacks that are super-effective against Grass defenders and ineffective against Water defenders) should be identified with the type of Pokémon we call Fire-type (that are vulnerable to Ground-type attacks and resistant to Ice-type attacks.), you would have no way to infer that information from the susceptibility type chart alone.</p>
<p>Or put another way: if I reorder the rows and columns of the ground-truth type susceptibility table, then erase the type labels, there is no principled way for you to figure out which attacking types match which defending types just by looking at the chart.</p>
<h2 id="proofattacktypesandspeciestypesareunrelated">Proof: Attack types and species types are unrelated.</h2>
<p>This negative result can actually be viewed as a consequence of a theorem from linear algebra, which states that there is no canonical basis for the dual of a vector space. Put more colloqually, if you cannot measure the similarity of one type to another, then there's no relationship between attacking and defending types.</p>
<p>You can show that this result applies by showing that Pokémon type effectiveness has the structure of a linear (vector) space, as follows.</p>
<p>Attack effectiveness in practice is a multiplicative factor. Possible effectiveness values consist of 2x, 1x, 0.5x, and 0x. In order to apply linear algebra, which is additive instead of multiplicative, we will not deal with effectiveness values directly, but instead with (base 2) logarithms of effectiveness values; I call these <strong>susceptability values</strong>.</p>
<p>If there are <em>n</em> Pokémon types, then we can form an \(n \times n\) effectiveness matrix \(\mathbf{S}\) of susceptibility values. Using \(\mathbf{S}\), you can compute how effective an attack will be against a particular Pokémon through straightforward matrix multiplication: The defending Pokémon's type(s) are encoded in a length-<em>n</em> column vector \(\vec{d}\). Each entry is 1 if the Pokémon has that type, or 0 if the Pokémon does not<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>. The product \(\mathbf{S}\cdot\vec{d}\) is then a column vector neatly listing the Pokémon's susceptibility to each type.</p>
<p>If \(\vec{a}\) is a length-<em>n</em> row vector describing the type of the attack, then \(\vec{a}\cdot \mathbf{S}\cdot \vec{d}\) is a single number indicating the susceptibility of the specific Pokémon with type \(\vec{d}\) to the attack of type \(\vec{a}\). Next, the collection of all theoretically possible Pokémon type combinations forms an <em>n</em>-dimensional vector space. It's the collection of all possible \(\vec{d}\) vectors. There's one dimension for each type, and the value of each component tells you how many copies of that type a Pokémon has. Because we'll need to distinguish attacking and defending types, we might call this the <em>defending type space</em>. An attacking type is a map assigning a susceptibility value to each of the <em>n</em> defending types. Susceptibility values add, so that a Pokémon with multiple types has the sum of the susceptibility values of the individual types---this means that an attacking type is a <em>linear</em> map assigning a susceptibility value to each of the <em>n</em> defending types. Hence the space of all theoretically possible attacking types is a space of linear functionals on defending types; it's the <em>dual</em> of the space of defending types.</p>
<p>But there is no canonical way to associate the basis of a mere vector space (such as the single types in defending type space) with a basis in the dual space (such as the <em>n</em> different attacking types.) It follows that, without additional structure, we have no principled way to identify defending types (a vector space) with attacking types (functionals on that space).</p>
<h1 id="irrationalfactorsandsametypeattackbonus">Irrational factors and same-type attack bonus</h1>
<p>As I've pointed out, same-type attack bonus (STAB) is the only direct way to identify which attacking and defending types should be identified with each other.</p>
<p>You can empirically determine STAB using a straightforward experimental setup like this: make an empirical susceptibility table with attacking species+move along one dimension and defending species on the other, then finding two rows that are identical except that when Pokémon A performs attack B against Pokémon C, there is a boost to susceptibility that does not occur when Pokémon A' performs that same attack against Pokémon C.  This is conclusive evidence of STAB, because the difference is not in the type of attack or the type of defending Pokémon, but the type of attacking Pokémon.</p>
<p>But in fact, there's an even easier analytic route to identifying STAB: if we assume that STAB confers a multiplicative factor of 1.5 as it does in game, then its logarithmic susceptibility value is \(\gamma \equiv \log_2(1.5)\approx 0.5849\). This is an irrational number, and it means that we'll get a row of irrational susceptibility values in our susceptibility table when, and only when, STAB occurs. Details follow.</p>
<p>In practice, if we can make some assumptions about allowed susceptibility values, there is an even easier analytic route to determining STAB which does not require more than one attacking Pokémon. The idea is that STAB yields irrational susceptibility values instead of rational ones, and so is immediately identifiable.</p>
<p>The possible monotype effectiveness values are [2x 1x 0.5x 0x] which correspond to susceptibility values of [1 0 -1 -∞]. We could consider alternative possible values for STAB, but in the games it confers 1.5x effectiveness, or a susceptibility of \(\gamma \equiv \log_2(1.5)\approx 0.5849\). This susceptibility value is irrational (because if \(\gamma = p/q\) is rational then \(2^{p/q} = 1.5\) so \(2^{(p/q)+1} = 3\) so \(2^{p+q} = 3^{q}\), contradicting the unique factorization of integers.)  But natural susceptibility values (those unaffected by STAB) are all integers (or infinite). Therefore, if we are told that natural susceptibility values are all integers (or infinite) and are given precise empirical susceptibility measurements, we can always identify STAB because it will produce irrational susceptibility values wherever it occurs.</p>
<p>In fact, if we know that the STAB component is irrational---even if we don't know its exact value---we can compute its value uniquely from the table: if the susceptiblity is an integer combination of STAB and non-STAB susceptibilities (\(m + n\gamma\)), note that these coefficients are unique; if \(m + n\gamma = m^\prime + n^\prime\gamma\) then \((m-m^\prime) = (n^\prime-n)\gamma\). If \(n\neq n^\prime\), then \((m-m^\prime)/(n-n^\prime) = \gamma\)---but the left side is a rational number and the right side is irrational, a contradiction. Therefore \(n=n^\prime\), so \(m=m^\prime\), so these coefficients are unique.</p>
<h1 id="futureprojects">Future projects</h1>
<p>This article is just the beginning --- there are many other directions you could go in exploring empirical Pokémon typing. Some future directions I'm interested in are:</p>
<ul>
<li><strong>Type inference from learned attacks</strong>. Which attacks give you the most information about a Pokémon's type?  Do those attacks share a type with the Pokémon or not?</li>
<li><strong>Additive trees</strong> If you use various Pokémon traits (such as evolution strategy, learned movesets, etc.) to define a distance metric between species, do they cluster into clearly-delineated types?</li>
<li><strong>Informational bounds</strong> Given the existing type system (as opposed to a theoretically possible alternative type system), how much information do you need in order to reliably reconstruct the susceptibility table?  How likely are two types to appear the same, due to coincidentally measuring points where their susceptibilities overlap?  What's the worst case scenario in terms of failing to distinguish two different types, and how likely is that scenario?</li>
<li><strong>Type triage / decision trees</strong> Design the most efficient battery of susceptibility tests to determine the type of a never-before-seen Pokémon. A greedy (potentially non-optimal) decision tree covering all pairs of seventeen types is available [[<a href="http://logical.ai/guess/allergy/">http://logical.ai/guess/allergy/</a>][here]]; note that it has a fun in-universe presentation. It takes seven questions in the worst (normal-steel) case.</li>
</ul>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"><p>Theoretically, there is no barrier to a Pokémon having more than two types or having multiple copies of a single type, though this never occurs in-game. <a href="#fnref1" class="footnote-backref">↩︎</a></p>
</li>
</ol>
</section>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Kirchhoff's Law for Renters]]></title><description><![CDATA[Solving a subletting problem with an elegant payment protocol.]]></description><link>http://illuminium.org/kirchhoffs-law-for-renters/</link><guid isPermaLink="false">600e7c89639a6abc73f791b9</guid><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Sat, 25 Aug 2018 07:00:00 GMT</pubDate><content:encoded><![CDATA[<p></p><p>Here's a plausible model of renting an apartment:</p><ol><li>The apartment has several single-tenant rooms that vary in monthly rent depending on area and other factors. Their sum constitutes the total monthly rent of the household. Rent is paid in discrete monthly intervals.</li><li>Often, landlords will demand a collateral deposit upon moving in, and return it (in the simplest case) upon moving out. Let's say the deposit is proportional to rent (e.g. twice rent).</li><li>Subletting is a process by which some members move out and others move in without the direct involvement of the landlord. Even if the landlord is not directly involved, we expect that everyone moving out will receive their collateral deposit, and everyone moving in will pay a collateral deposit.</li></ol><p>Here are a few scenarios that may arise during the renting process. Think about what ideally should happen, and who owes what amount of money:</p><ol><li><em>Someone moves out and a subletter moves in to take their place.</em> This situation is easy to handle, because the subletter's security deposit can be given to the exiting roommate to refund that person's security deposit. (As an aside, note that when subletting, security deposits cease to serve their original purpose as a safeguard because they're immediately consumed during the moving process instead of placed in a bank.)</li><li><em>No one moves in or out, but the roommates merely swap rooms with each other.</em> Intuitively, perhaps it shouldn't matter if roommates swap rooms—room swapping isn't "noticeable" to the outside world. It's perhaps noteable that a roommate who moves into a smaller room pays a small security deposit, and if they later swap for a larger room and ultimately move out, they receive a larger security deposit. On the other hand, this isn't a big deal because whatever room they move out of, the incoming subletter will pay the security deposit.</li><li><em>The house consists of a large and a small room. Someone moves out of the large room; the person in the small room swaps into the large room; and a new subletter takes the small room.</em> This presents a tough problem actually—do you see why? If the two room rates are <em>x </em>&lt; <em>y</em>, then someone needs to fund the exiting roommate the amount <em>x</em>. On the other hand, the entering roommate is only paying <em>y</em>—not enough to cover the refund. Where should the remaining money come from? Should the roommate who swapped rooms be forced to pay something? But in the previous scenario, we thought it was alright for roommates to swap rooms with impunity. Why should it suddenly matter that people are swapping rooms?</li></ol><p>There is a very simple principle which ensures that everyone is paid what they're owed. I call it:</p><blockquote><strong>Kirchhoff's Law for Renters</strong>: In addition to the rooms with their own room rates, treat "not living here" as a virtual room whose rent rate is 0. Whenever someone switches rooms, they pay the difference between their new rate and old rate. (Or <em>k</em> times the difference, if security deposit is proportional to rent by a factor <em>k.) *</em></blockquote><p>As a consequence of this rule:</p><ol><li>People who move in owe a security deposit. After all, their old rent ("not living here") was 0 and their new rent is <em>x</em>.</li><li>People who move out are owed a security deposit. After all, their old rent is <em>x</em> and their new rent is 0, and the difference is negative.</li><li>Swapping rooms, even when no one moves in or out, does involve payment. You pay the difference between your new and old rent to the person whose room you're moving into. In fact, under this scheme, swapping rooms is equivalent to moving out of your old room (and getting refunded) followed by moving into your new room (and paying a new security deposit.) Elegant!</li><li>If someone moves out and a current tenant moves to take their place, the difference in rent is used to refund the exiting roommate's security deposit. In fact, miraculously, whatever the chain of moves/swaps the exiting roommate is a part of, the payments involved end up perfectly covering the cost of refunding the security deposit.</li><li>More generally: As long as all rooms are filled each month (through any combination of moving in, moving out, and swapping rooms), the various costs of moving will cover each other perfectly. The net payments will always be zero.</li><li>Moving out is a limiting case of downsizing. (In fact, in an extreme theoretical case, one could move through a sequence of increasingly tiny, low-rent rooms, recovering almost all of their original security deposit, before imperceptibly moving out and collecting the infinitesimal remainder.)</li></ol><p>The analogy with Kirchoff's law for voltage is that security deposits create a kind of “financial potential” analogous to electrical potential, with the ground state naturally being not-living-here. The flow of individual people into and out of the house, or from room to room, constitutes a kind of current. The assumption that all rooms are filled is a condition that there is zero net current between the rooms of the house and ground. "Power" is expended when moving in or upsizing, and regained when moving out or downsizing.</p><hr><p>* Negative proportionality constants are possible but perverse: in that case, someone pays you to move in, and you have to return the money in order to move out; upsizing is profitable and downsizing costs money.<br></p>]]></content:encoded></item><item><title><![CDATA[Kinsey Strings]]></title><description><![CDATA[Using pushpins and yarn to depict compatible attraction.]]></description><link>http://illuminium.org/kinsey-strings/</link><guid isPermaLink="false">600ea2c4639a6abc73f79430</guid><category><![CDATA[diagrams]]></category><category><![CDATA[queer]]></category><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Sat, 09 Jun 2018 07:00:00 GMT</pubDate><media:content url="http://illuminium.org/content/images/2021/01/relationship_compatibility.png" medium="image"/><content:encoded><![CDATA[<h2 id="two-genders"><br>Two genders</h2><img src="http://illuminium.org/content/images/2021/01/relationship_compatibility.png" alt="Kinsey Strings"><p>What is the shape of attraction? To find out, we can make a diagram out of string and pushpins. Suppose—reductively, but for simplicity—that there are two genders and three types of attraction: same-gendered, both-gendered, and different-gendered. Altogether, we have six different pushpins corresponding to these six different identities:</p><!--kg-card-begin: html--><center><img src="http://logical.ai/kinsey/attraction-0.png" alt="Kinsey Strings" width="260px"></center><!--kg-card-end: html--><p>We can start by drawing arrows of attraction from each identity to the identities it's potentially attracted to. You can try this exercise yourself. When I do it, I get the following diagram:</p><!--kg-card-begin: html--><center><img src="http://logical.ai/kinsey/attraction-1.png" alt="Kinsey Strings" width="260px"></center><!--kg-card-end: html--><p>Of course, some of these attractions are unrequited—there's an arrow going one way but not the other. If we get rid of those unrequited attractions, the resulting diagram depicts the shape of mutual attraction:</p><!--kg-card-begin: html--><center><img src="http://logical.ai/kinsey/attraction-2.png" alt="Kinsey Strings" width="300px"></center><!--kg-card-end: html--><p>Beautiful, isn't it?</p><p>Such a diagram also makes it clear how many degrees of separation there are between different identities—can you see which identities are separated by the longest path? Hint: There are three identity pairs that are maximally separated. You'd have to form a long chain of relationships to get people with those identity pairs into a relationship-by-transitivity with each other.</p><p>Also—take heart: No matter what your identity is, two out of three identities you're attracted to are attracted to you in return.</p><h2 id="three-genders">Three genders</h2><p>You can extend this approach to multiple discrete genders: <em>G</em> is your set of available genders and \(2^G\)—the set of all combinations of genders—is your available orientations. When <em>G</em>=3, there are 8 possible orientations, making 24 total identities. The mutually compatible relationship graph (like the one drawn above) looks like this:</p><figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="http://illuminium.org/content/images/2021/01/relationship_compatibility_2.png" class="kg-image" alt="Kinsey Strings"><figcaption>A graph of mutual attraction in a three-gender system. With three genders, there are eight orientations, hence 24 nodes denoting gender/orientation combinations. Each edge indicates mutual attraction. If a node would have a self-loop, I colored it white instead.&nbsp;</figcaption></figure><p>This is a graph of mutual attraction between three genders. Each dot represents an identity (gender + orientation combo). Edges represent mutual compatibility. The three genders are symmetrically arranged in three kite-shaped regions containing the eight possible orientations. Orientations consist of attraction to some combination of your own gender, the gender clockwise from you, and the gender counterclockwise from you (imagine the genders have some rock-paper-scissors clockwise order.) If you like, you can figure out which orientation is which by looking at their connections. Otherwise, here's the complete description. </p><p>Taking the topmost kite as an example, the eight orientations—from top to bottom and left to right—are: </p><ol><li><strong>self only </strong>(white dot at top);</li><li><strong>no attraction</strong> (disconnected black dot); </li><li><strong>self-or-widders</strong> (leftmost white dot); </li><li><strong>self-or-sunward</strong> (rightmost white dot); </li><li><strong>widders-only</strong> (leftmost black dot); </li><li><strong>sunward-only</strong> (rightmost black dot);</li><li><strong>widders-or-sunward</strong> (middle black dot);</li><li><strong>widders-sunward-self</strong> (white dot at bottom).</li></ol><p>Instead of drawing a loopy edge for own-gender orientations, I use white dots. Edge color and thickness helps you read the graph, but don't otherwise mean anything. Some interesting observations: </p><ol><li>The orientations within each gender form a cube, with each axis direction representing another gender and each face being totally connected with the face of the neighboring cube on that side—you might be able to see it here by imagining that the white dots are raised out of the plane.</li><li>When you try to connect two separate non-ace identities through a chain of mutual compatibility links, then no matter how many genders there are, you need <em>at most</em> four identities total: e.g. the starting identity, a pan person whom the starting identity likes, a pan person whom the ending identity likes, and the ending identity. (So the <em>graph diameter</em> of the connected part is always 3, regardless of the number of genders.)</li><li>With the two-gender (<em>G</em>=2) picture at the start of this article, we didn't include ace identities (identities with no links in the graph). Now that this <em>G</em>=3 picture includes them, we see more reasonably that half the identities you're attracted to are attracted to you in return (regardless of <em>G</em>). </li><li>The two-gender compatible relationship graph is, as you'd expect, contained in the three-gender compatible relationship graph:</li></ol><figure class="kg-card kg-image-card"><img src="http://illuminium.org/content/images/2021/01/compatible_subgraph.png" class="kg-image" alt="Kinsey Strings"></figure>]]></content:encoded></item><item><title><![CDATA[Social queues]]></title><description><![CDATA[My friends and I have developed a helpful strategy for working together. Social queues provide short one-way conversations that enable you to tell someone else that you'd like to talk to them, without interrupting their focus if they're working hard on a problem.]]></description><link>http://illuminium.org/social-queues/</link><guid isPermaLink="false">600f5347639a6abc73f79576</guid><category><![CDATA[proposal]]></category><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Wed, 23 Aug 2017 04:48:00 GMT</pubDate><content:encoded><![CDATA[<h2 id="a-problem">A problem</h2><p>How often has this happened to you? You are deep in thought, solving some complicated problem. You've just about had a breakthrough when someone walks by—</p><p>"Hey, I just have a quick question for you; I was thinking about—"</p><p>Your focus is upended, your train of thought evaporates, and now you have to react quickly for the sake of damage control. It's an uncomfortable position, because on the one hand you'd really like your train of thought back, or if that's impossible, to salvage what's left of it. And on the other hand, you'd probably <em>enjoy</em> talking with that person about exactly what they want to talk about, if only they had picked a better moment. Ideally, you'd like to balance getting back to your puzzle as quickly as possible, with letting the person know that you don't resent the person or the topic, just the timing.</p><p>And how often has <em>this</em> happened to you? You've just discovered something that your friend would definitely like to know about. You walk over to where they're working and, really trying to be as inobtrusive as possible, you say, "Hey I see that you're busy—is now a good time? I've just found out—"</p><p>"Ugh." says your friend, losing focus. "Oh, well. What's up?"</p><p>The problem is that even the most polite initiator demands the attention of the listener—"Are you busy? Is now a good time?". No matter how gently and briefly you try to demand someone's attention, you still have to open a two-way conversation even to let someone know that you have something to say.</p><p>You <em>could</em> have just waited until the other person no longer seemed busy, of course. But then only the other person knows when they're genuinely not busy; <em>you'd</em> have to guess. You might guess too early and interrupt them when they're busy, or guess too late and miss out on an opportunity to tell them something they'd rather know sooner. ("Oh, why didn't you tell me sooner? I wasn't actually that busy!")</p><p>There's a better way! In this short note, I describe the strategy that my friends, colleagues, and I use to alleviate this social problem for everyone involved. It allows people who are focusing to stay on track without missing out, and allows people who have something to say to be considerate while making themselves known.</p><p>You can tell that it works. We use it at work, when studying, at home. The people I've shared it with have passed it on to the social groups they're part of. It's nice because it allows people to be a lot more productive themselves, and to be obviously, mindfully considerate of others in an easy-to-follow way. This post is for everyone who wants the opportunity to participate in such a system themselves.</p><h2 id="a-solution">A solution</h2><p>In everyday life, a <strong>queue</strong> is a line of people waiting to be attended to. The cashier in a grocery store has a queue of people waiting to pay for their groceries; the mail clerk has a queue of people wanting to send packages; the restaurant has a queue of people waiting to be seated. The fundamental rule of queues is first come, first serve: you handle the first person in line, then the second, and so on.</p><p>The <strong>social queue</strong> system is a group policy for interacting with others by waiting your turn. The rules are as follows:</p><ul><li><strong>Attention. </strong>Every person has things they're focusing on at the moment. We think of it as that person's attention queue.</li><li><strong>Queue!  </strong>If you want to request someone's attention, you can put yourself into their attention queue. To put yourself in someone's queue, say the word "Queue!" to them. Now you're in their list waiting for your turn.</li><li><strong>Dequeue!  </strong>If someone says "Queue!" to you, you keep working on what you're working on. When you've finished (or have reached a good break point), you can tell the person that it's their turn. To tell someone it's their turn, say the word "Dequeue!" to them. That means that you're ready to hear what they have to say.</li><li><strong>Restraint.  </strong>In detail, the queueing process is supposed to be as inobtrusive as possible, and the only thing you should interrupt someone with is the word "Queue", after which the polite thing to do is to immediately find something else to do. In particular, you should avoid waiting for a sign of acknowledgement, or injecting a small piece of conversation, or hovering impatiently in the area while you wait your turn.</li><li><strong>Re-enforcement.  </strong>The queue system takes some time to become a habit. If someone interrupts you because they've forgotten to "Queue!" themselves, you can just remind them. When I've forgotten, people have gently cut me off with "Uh, queue that.", which works just fine.</li></ul><p>The social queue system works because it introduces a <em>short, one-sided conversation</em> that people can use to request others' attention. Because the single word "Queue!" is more like an ambient sound than a conversation, you can accommodate it subliminally without diverting much of your real attention. Because the queue system sets up an expectation that you will eventually get to everyone in your queue, people who want your attention know that the word "Queue!" is enough, and don't feel like they have to push further.</p><p>That's all there is to it.</p><h2 id="variations">Variations</h2><p>I've experimented with different variations over the years — different social groups and people with different social needs might tailor this system for their own purposes. For example:</p><ul><li><strong>Did you hear me say Queue?  </strong>Because the policy is to keep on working—basically making it inoffensive and standard to "ignore" someone who says Queue—a person who has something to say might worry about whether you heard the word Queue or not. The concern is waiting forever without actually being in line. To me, this is a deliberate design decision—I'd rather have the puzzlers generally keep their focus and initiators occasionally not say what they'd want, rather than the usual other way around. But one possible solution is for the listener to have a way of briefly acknowledging that something has been queued—for example, by replying "Ack!" ("Acknowledged!"), or "Mmm-hmm". I usually find this too mentally taxing personally, but it may work for others. See the next item in this list for an alternative.</li><li><strong>Is anything in my queue?  </strong>The social queue policy is designed to help you keep your focus as much as possible. One consequence is it's so inobtrusive, you might reach a stopping point and not remember whether anyone has said queue recently, or whether you failed to hear it. But if you're working in an environment where the people queueing things are in your general vicinity, you can try to check whether anyone has queued anything. I'll occasionally say "Dequeue?" speculatively in case anyone has something to say that I missed. Or, you can just try to catch someone's eye— if you're working jointly with someone, then they may be attentive enough to notice when you look up at them from your work. That involves less noise that might disturb others working nearby.</li><li><strong>Oops, never mind.  </strong>Often enough, I'll get stuck on a problem and want to ask a friend for help, so I say "Queue!". But I figure out the answer before I get dequeued. The standard policy (which involves no interruption) is to wait until you get dequeued, then to say, "Never mind; I figured it out." But if the other person will probably try to finish their work faster because you're in their queue, it might be better to save them the trouble. You might agree to adopt a convention of interrupting with "Never mind", "Belay that", or the deliberately ugly term "Unqueue!". I'd be careful about this, in case "Never minds" end up happening so much as to be distracting.</li><li><strong>Who, me?  </strong>If you're working in a group of people, there's a chance it could be ambiguous who you're saying Queue to. In that case, you could say "Queue: [their name]", instead.</li><li><strong>Queue one, queue two.  </strong>Some people really like the way social queues give you an orderly list of things to deal with. If you like, you can adopt a convention where you can enqueue yourself multiple times. For example, suppose I've had an important revelation, so I say "Queue!". Later, I additionally realize something that must be handled before tomorrow, so I again say "Queue!". Now I'm in the queue twice. Additionally, if I think of several items at once, I might say "Queue three things,". As always, though, it's the initiator's responsibility to remember just what and how many items they've put in someone's queue.</li><li><strong>Distinguishing how urgent your message is.  </strong>Sometimes you've found an essential bit of information; other times, you'd just like to share a joke. Part of the solution involves coming to an agreement about how much banter you'd actually like to have—a casual study session might be different from a project deadline. If you've decided you'd like some amount of banter, I've found that using "Queue!" and "Queue unimportant!" allow you to make that distinction, usually without passing on so much information that it becomes distracting.</li><li><strong>Asking what it's about.  </strong>Saying "Dequeue!" sometimes feels like giving someone indefinite use of your time and attention, without even knowing what they want to talk about. Maybe you have a small break where you'd like to handle someone's request, but not if it's time-consuming or detailed; maybe you'd just like to prioritize.<br><br>To solve this, you can always offer a disclaimer: "Dequeue—I've got five minutes to talk, will that be alright?". Or you can just ask the other person what's in the queue without actually dequeueing it. (If you'd prefer a terse keyword for that purpose, I've occasionally used "Peek!" as a way of asking what's in the queue without committing to dealing with it immediately.)</li><li><strong>I became busy in the meantime.  </strong>Sometimes you put yourself in someone's queue, then you become busy with something else, then that person tries to dequeue you, but you're busy. If you need an explicit policy to handle this, a "queue trampoline" can work — when someone says "Dequeue!", tell them to queue it instead.</li><li><strong>Who's next?  </strong>In one memorable instance, a friend of mine who was coordinating a bunch of people became so inundated with queue requests that it became an actual challenge to remember who was supposed to be dequeued in what order. Here's a strategy to preserve fairness and avoid mental overhead in these extremes: in a setting where essentially one person will be queued by everyone else, you might decide to actually write out that person's queue of names (on a readily-visible whiteboard, for example). Alternatively, have a policy where everyone keeps track of their own position in the busy person's queue: to add yourself to the busy person's queue, find the last person who was added to the queue and tell them you want to be added, too; when the busy person dequeues you, tell the person after you that they're up next.</li></ul><hr><p>In computer science, we distinguish between "queues", which are first-come, first-serve lists, and their opposite, "stacks", which serve whoever's arrived most recently. To add items to a queue, you enqueue them in the back of the list. To add items to a stack, you push them onto the top of the stack.</p><p>In our default interactions with people, we demand, however politely and briefly, to be engaged in a two-way conversation. In this short note, I've described another possible convention—one which helps people be less pushy, and instead more observant of social queues.</p><hr><!--kg-card-begin: html--><div class="footer"><a rel="license" href="http://creativecommons.org/licenses/by-nd/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nd/4.0/88x31.png"></a><br>♡2017 Dylan Holmes. <i><span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" property="dct:title" rel="dct:type">Social Queues</span></i> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://logical.ai/me" property="cc:attributionName" rel="cc:attributionURL">Dylan Holmes</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nd/4.0/">Creative Commons Attribution-NoDerivatives 4.0 International License</a>.<span class="reminder">(You may make and distribute verbatim copies of this work, even commercially, as long as you preserve this notice.)</span></div><!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[A roadside refueling relay]]></title><description><![CDATA[We nearly ran out of gas while driving between states! This usually means walking to the nearest gas station and back. In this article, I devise the optimal cooperative solution.]]></description><link>http://illuminium.org/a-roadside-refueling-relay/</link><guid isPermaLink="false">600e74c7639a6abc73f79111</guid><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Sat, 03 Sep 2016 08:47:00 GMT</pubDate><content:encoded><![CDATA[<h2 id="rules-of-the-game">Rules of the game</h2><p>While driving across the country one hot summer day, two of my friends noticed that they were running dangerously low on fuel. The driver pointed this out to the passenger and said:</p><blockquote>"Suppose we run out of gas and have to walk down the road until we find the closest gas station. Someone'd have to walk all the way down to get a canister of gas, then walk all the way back!"</blockquote><p>They debated whether there was a better solution than this for a while (as I detail below). Eventually, I heard about the conundrum and turned it into the following general puzzle (In any case, their car did not run out of gas, so the problem became purely academic.) :</p><blockquote>Suppose a car full of <em>n</em> people runs out of gas. There is a gas station 1 km away. Assuming they must walk to retrieve a canister of gas from the station, find the best cooperative solution. (That is, find the solution which minimizes the distance walked by whoever walks the most.)<br><br>Assume that the solution genuinely involves individuals going to retrieve gas; they cannot push the car, carry each other, etc.</blockquote><p>Feel free to pause at this time and solve this problem yourself. In the rest of this article, I will detail the complete solution.</p><h2 id="the-general-solution">The general solution</h2><h3 id="discussion">Discussion</h3><p>After the driver lamented the thought of walking all the way to the station and back, the passenger replied,</p><blockquote>"Actually, you can shorten the walking distance if you drive the car once you've refueled it—just have one person walk to get the gas, then have the second person meet them halfway. While the first person waits at the halfway point, the second person can go refuel the car. When the car is refueled, the second person can pick up the first person. Overall, no one has to walk more than 3/2 km."</blockquote><p>To which the driver responded,</p><blockquote>"Here's a slightly better solution: have the first person walk to the gas station and <em>one third</em> of the way back. The second person meets the first person there, walks back to refuel the car, and picks up the first person on the way out. Overall, they each walk exactly 4/3 of the way there. I wonder if we can do better?"</blockquote><p>In general, we're looking for a solution that looks like this: the first person walks to the gas station, then walks some amount of the way back. The second person walks to where the first person stops, then walks some amount of the way back. This continues until some final person walks all the way back to the car and picks everyone up.</p><h3 id="the-egalitarian-principle">The egalitarian principle</h3><p>Now we observe the following <strong>tradeoff principle</strong>: suppose everyone agrees on a solution strategy. While following the strategy, someone chooses to walk a little bit further than required. This alteration will not affect anyone who has already completed their part of the solution. However, everyone afterwards will walk a little bit less.</p><p>From this principle, we arrive at a surprising <strong>egalitarian principle</strong>: in the optimal solution, everyone must walk the same distance (!). To see that this is true, observe that:</p><ol><li>The only way to allow someone to walk a little less is for someone else to walk a little more.</li><li>When everyone walks the same amount <em>d</em>, then obviously the person who walks the most walks the amount <em>d</em>.</li><li>If you alter the egalitarian solution so that someone walks less than <em>d</em>, someone else must walk more than <em>d</em>. Therefore the person who walks the most must walk more than <em>d</em>, and so the altered solution is worse than the egalitarian solution.</li><li>Therefore the egalitarian solution is optimal.</li></ol><h3 id="the-self-similarity-principle">The self-similarity principle</h3><p>Now we apply a second trick— the <strong>self-similarity principle</strong>: Suppose that there are <em>n</em> people in the car and the canister is at the gas station 1 km away. If one person goes to the gas station and brings the gas canister back <em>x</em> units, then effectively you have a new problem with <em>n</em>−1 people in the car and the "gas station" / canister effectively (1−<em>x</em>) km away (because that's where the first person brought the gas canister.)</p><p>Hence let <em>f</em>(<em>n</em>) denote "the distance the first person should walk back from the gas station in the optimal solution for <em>n</em> people."</p><p>Obviously we have the base case: <em>f</em>(1)=1, because if there's only one person in the car, that person should walk all the way back. And by the self-similarity principles, we know that if <em>n</em>≥2, then the distance walked by the first two people is:</p><p><em>d</em>1=1+<em>f</em>(<em>n</em>)</p><p>and</p><p><em>d</em>2=[1+<em>f</em>(<em>n</em>−1)]⋅(1−<em>d</em>1)</p><p>To understand the second equation, note that [1+<em>f</em>(<em>n</em>−1)] is the optimal distance someone should walk back if there are <em>n</em>−1 people in the car and the gas station is <em>1 km</em> away. We scale this distance by (1−<em>d</em>1) to account for the fact that the canister is located (1−<em>d</em>1), not 1 km, away.</p><p>By the <em>egalitarian principle</em>, these two distances are equal. Hence we have:1+<em>f</em>(<em>n</em>)1+<em>f</em>(<em>n</em>)00<em>f</em>(<em>n</em>)=[1+<em>f</em>(<em>n</em>−1)]⋅[1−<em>f</em>(<em>n</em>)]=1+<em>f</em>(<em>n</em>−1)−<em>f</em>(<em>n</em>)−<em>f</em>(<em>n</em>−1)<em>f</em>(<em>n</em>)=<em>f</em>(<em>n</em>−1)−<em>f</em>(<em>n</em>−1)<em>f</em>(<em>n</em>)−2<em>f</em>(<em>n</em>)=−<em>f</em>(<em>n</em>)[<em>f</em>(<em>n</em>−1)+2]+<em>f</em>(<em>n</em>−1)=<em>f</em>(<em>n</em>−1)<em>f</em>(<em>n</em>−1)+2</p><h3 id="a-recurring-problem">A recurring problem</h3><p>We have reduced the problem to a recurrence relation: solve for <em>f</em>(<em>n</em>), given the recursive definition</p><p><em>f</em>(1)=1,<em>f</em>(<em>n</em>+1)=<em>f</em>(<em>n</em>)<em>f</em>(<em>n</em>)+2.</p><p>In general, we find that the solution is given by:</p><p><em>f</em>(<em>n</em>)=12<em>n</em>−1,</p><p>so that <em>f</em>(1)=1, <em>f</em>(2)=13, <em>f</em>(3)=17, <em>f</em>(4)=115, etc.</p><h2 id="other-optimizations">Other optimizations</h2><h3 id="minimize-the-maximum-average">Minimize the maximum/average</h3><p>If you want to find the solution that minimizes the <em>total</em> or <em>average</em> amount of walking, the solution is brutally simple: have one person walk there and back.</p><p>Indeed, that person will walk 2 km, the absolute minimum distance it is possible to walk when retrieving a gas canister from a station that is 1 km away.</p><h3 id="minimize-the-time">Minimize the time</h3><p>If you want minimize the amount of <em>time</em> it takes to retrieve the gas from the gas station, the solution is similarly simple: have everyone leave the car at the same time, stopping at their designated spots along the way to the gas station. The first person will reach the gas station, and walk back to where the second person has been waiting, etc.</p><p>Overall, with some simplifying assumptions, this takes essentially the same amount of time as having one person walk 2 km there and back, which is the absolute minimum.</p>]]></content:encoded></item><item><title><![CDATA[Kinsey arithmetic]]></title><description><![CDATA[Converting genders and orientations into numbers allows you to estimate relationship compatibility using arithmetic.]]></description><link>http://illuminium.org/kinsey-arithmetic/</link><guid isPermaLink="false">600f26d8639a6abc73f794ea</guid><category><![CDATA[recreational-mathematics]]></category><category><![CDATA[queer]]></category><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Thu, 11 Aug 2016 07:00:00 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h1 id="1introduction">1 Introduction</h1>
<p><strong>Assumptions</strong>: Assume for simplicity that there are two genders and that each person has exactly one of those genders. Assume that the formal compatibility of a two-person relationship is purely a function of (1) each participant's proclivity for the two genders, and (2) the relation between the genders of the partners (i.e. same or different).</p>
<p><strong>Statement of the problem:</strong> If you know the kinsey scores of me and two of my partners, estimate the compatibility of my two partners with each other.</p>
<p><strong>Outline of the solution:</strong></p>
<ol>
<li>First, we define a numerical measure of a person's proclivity for each gender — a kind of kinsey scale.</li>
<li>Next, we define the formal compatibility of a person with their two-person relationship. It is a function of both the kinsey score of the individual, and whether they have the same or different gender from their partner. The overall compatibility of a relationship is basically the sum of each individual's compatibility with the relationship.</li>
<li>If you know the gender relationship between me and each of my two partners, you can easily deduce the gender relationship between them. When gender relations are represented by ±1, we can derive an arithmetic formula for this calculation.</li>
<li>Because this problem does not tell us the gender relations between the participants—only their kinsey scores—we must define a rule for estimating gender relationships between two people in a relationship given their kinsey scores.</li>
<li>Having defined a formula for estimating gender relationships given kinsey scores and a formula for computing formal compatibility, the expected compatibility is simply an expected-value calculation.</li>
</ol>
<h1 id="2thekinseyscale">2 THE KINSEY SCALE</h1>
<p>Suppose we measure proclivity/orientation using a “kinsey scale” ranging from -1 (exclusively prefers partners of the opposite gender) to +1 (exclusively prefers partners of the same gender)<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>. Intermediate kinsey scores represent intermediate degrees of proclivity toward each gender, with a kinsey score of 0 representing equal proclivity toward each gender (&quot;bi&quot;).</p>
<p>In the binary gender model, the formal relationship between the genders of any two people can be assigned pure kinsey-like value of ±1, corresponding to whether they have the same gender or different genders. I call this the gender polarity of the pair of people; any two people have a gender polarity, but the polarity is particularly relevant when the two people are in a relationship.</p>
<h1 id="3compatibility">3 COMPATIBILITY</h1>
<p>Suppose a person has a kinsey score of k and is involved in a relationship of polarity r=±1. How should we measure that person's individual compatibility with their relationship?</p>
<p>One simple choice of compatibility measure is (C(r,k)=r\cdot k), which assigns -1 compatibility to mismatched relationships (such as a person of purely opposite-gendered proclivity in a same-gendered relationship), and 1 to matched relationships (such as a person of purely different-gendered proclivity in a different-gendered relationship.</p>
<p>One defect with this measure is that it treats bi proclivity (i.e. a kinsey score of zero) as being middlingly compatible with any relationship C(r,0)=0—whereas it might be more desirable to have bi proclivity be fully compatible with any relationship. To patch this defect, we will instead use the slightly modified function C(r,k)=min(1,1+r⋅k) which assigns compatibility scores between 0 (mismatched proclivity and relationship) and 1 (matched proclivity and relationship), with bi proclivity receiving the maximal score along with other matched relationships <sup class="footnote-ref"><a href="#fn2" id="fnref2">[2]</a></sup>.)</p>
<p>Given two people in a relationship, their overall compatibility can be determined by adding up their compatibility scores. To place compatibility values on a -1 to 1 scale, we'll subtract 1 from the total.<br>
$$ C(r,k_1,k_2)=C(r,k_1)+C(r,k_2)-1$$</p>
<p>In the next section, we will see that in a simplified version of the problem where you must determine my partners' compatibility with each other given full information—you know not only everyone's kinsey scores but also whether each pair of people has the same or different genders—the compatibility measure (C(r,k_1,k_2)) provides a direct, deterministic measure of my two partners' compatibility.</p>
<h1 id="4lovetrianglepolarity">4 LOVE TRIANGLE POLARITY</h1>
<p>If you know whether I have the same gender as each of my partners, you can easily figure out whether my partners have the same gender or different genders from each other.<br>
Numerically, if you know the gender polarity between me and each of my two partners---(r_{1,2}, r_{1,3})---but don't know the relationship polarity (r_{2,3}) between my two partners, you can easily compute it:<br>
$$r_{2,3}=r_{1,2}\cdot r_{1,3}.$$</p>
<h1 id="5inferringgenderrelationsfromkinseyscores">5 INFERRING GENDER RELATIONS FROM KINSEY SCORES</h1>
<p>To estimate the compatibility between my partners, you must somehow estimate the gender relations between them using our three kinsey scores. How should you predict whether a relationship is between same-gendered or different-gendered individuals as a function of the kinsey scores of the participants?</p>
<p>Let <em>r(a,b)</em> denote the probability that two people with respective kinsey scores of a and b are in a same-gendered relationship<sup class="footnote-ref"><a href="#fn3" id="fnref3">[3]</a></sup>. Based on common-sense considerations, the function <em>r(a,b)</em> should ideally satisfy the following criteria:</p>
<ul>
<li>r is as smooth as possible, e.g. differentiable almost everywhere. Small changes in proclivity should never cause large changes in probability.</li>
<li>r is symmetric: r(a,b)=r(b,a).</li>
<li>The order of the participants doesn't matter.</li>
<li>Inverting both kinsey scores inverts the probability: r(a,b)+r(−a,−b)=1</li>
<li>Inverting both kinsey scores instead gives the probability that they will be in an opposite-gendered relationship.</li>
<li>r is increasing: r(a+x,b)≥r(a,b) when x&gt;0.</li>
<li>You can't decrease the probability of a straight relationship by making one of the participants straighter.<sup class="footnote-ref"><a href="#fn4" id="fnref4">[4]</a></sup></li>
<li>r is maximal whenever both arguments are: (r(1,1)=1)</li>
<li>If the two participants have purely same-gendered proclivity, they are certain to be in a same-gendered relationship.</li>
<li>r is a linear interpolation whenever any argument is zero: (r(a,0)=\frac{1}{2}(1+a)).</li>
<li>When any participant is bi, the probability that the relationship is between people of the same gender is dictated by the other participant. Out of many possible functions with this behavior, one nice function is:<br>
$$r(a,b)\equiv\min\left(1,\max\left(0,1+a+\frac{b}{2}\right)\right)$$<br>
which is essentially the sum of the proclivities a and b, rescaled to interpolate between 0 and 1 when proclivities are in a middle range, and cut off at 0 and 1 when proclivities are in an extreme range.</li>
</ul>
<h1 id="6expectedcompatibility">6 EXPECTED COMPATIBILITY</h1>
<p>Now it's straightforward to compute the expected compatibility between my two partners given only everyone's kinsey scores:</p>
<p>$$\begin{eqnarray*}EC(k_1,k_2,k_3) &amp;=&amp; P(r_{2,3}=1) \cdot C(+1, k_2, k_3) + P(r_{2,3} = -1) \cdot C(-1, k_2, k_3)\<br>
\end{eqnarray*}$$</p>
<p>We can estimate the probability that (r_{2,3} = 1) by using the &quot;love triangle polarity&quot; formula above to express (r_{2,3}) in terms of r_{1,2} and r_{1,3}, then use the &quot;relationship polarity from kinsey scores&quot; to get probabilities for various values of r_{1,2} and r_{1,3} in terms of the kinsey scores of the participants.</p>
<p>$$\begin{eqnarray*}<br>
EC(k_1,k_2,k_3) &amp;=&amp; P(r_{2,3}=1) \cdot C(+1, k_2, k_3) + P(r_{2,3} =<br>
-1) \cdot C(-1, k_2, k_3)\\<br>
&amp;=&amp;\small\left[r(k_1,k_2)\cdot r(-k_1,-k_3) + r(-k_1,-k_2)\cdot<br>
r(k_1,k_3)\right]C(+1, k_2, k_3) + \left[r(k_1,k_2)\cdot r(k_1,k_3) + r(-k_1,-k_2)\cdot<br>
r(-k_1,-k_3)\right]C(-1, k_2, k_3)<br>
\end{eqnarray*}$$</p>
<h1 id="7bonus">7 Bonus</h1>
<p>In order to solve our problem, we needed a way to estimate gender relationships from known kinsey scores. Assuming binary genders, the inverse problem of estimating kinsey scores from known gender relations results in a probability distribution isomorphic to drawing black/white balls out of an urn and representing your knowledge of the proportion of black/white balls in the urn — the binomial distribution, or the bi distribution for short.</p>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"><p>A more sophisticated version of this problem would allow for more gender variation by including <em>n</em> genders and would have proclivity take on values in an <em>n</em>-dimensional unit cube so as to represent ace/aromo/etc. variations. <a href="#fnref1" class="footnote-backref">↩︎</a></p>
</li>
<li id="fn2" class="footnote-item"><p>In this simplified universe, I have decided to model bi compatibility as maximal with either gender. Other forms of proclivity are possible, e.g. considering bi compatibility to be neutral with either gender C(r,k)=rk as mentioned earlier, or even varying based on the balance of genders in a relationship. <a href="#fnref2" class="footnote-backref">↩︎</a></p>
</li>
<li id="fn3" class="footnote-item"><p>Given the two-gender assumption, the probability that they are in a opposite-gendered relationship is 1−r(a,b) <a href="#fnref3" class="footnote-backref">↩︎</a></p>
</li>
<li id="fn4" class="footnote-item"><p>&quot;Straight&quot; and &quot;straighter&quot; meaning having a negative or more negative kinsey score. <a href="#fnref4" class="footnote-backref">↩︎</a></p>
</li>
</ol>
</section>
<!--kg-card-end: markdown--><p></p><h2 id="1-introduction">1 INTRODUCTION</h2><p><strong>Assumptions</strong>: Assume for simplicity that there are two genders and that each person has exactly one of those genders. Assume that the <em>formal compatibility</em> of a two-person relationship is purely a function of (1) each participant's proclivity for the two genders, and (2) the relation between the genders of the partners (i.e. same or different).</p><p><strong>Statement of the problem</strong>: If you know the kinsey scores of me and two of my partners, estimate the compatibility of my two partners with each other.</p><p><strong>Outline of the solution</strong>:</p><ol><li>First, we define a numerical measure of a person's proclivity for each gender — a kind of kinsey scale.</li><li>Next, we define the formal compatibility of a person with their two-person relationship. It is a function of both the kinsey score of the individual, and whether they have the same or different gender from their partner. The overall compatibility of a relationship is basically the sum of each individual's compatibility with the relationship.</li><li>If you know the gender relationship between me and each of my two partners, you can easily deduce the gender relationship between them. When gender relations are represented by ±1, we can derive an arithmetic formula for this calculation.</li><li>Because this problem does not tell us the gender relations between the participants—only their kinsey scores—we must define a rule for estimating gender relationships between two people in a relationship given their kinsey scores.</li><li>Having defined a formula for estimating gender relationships given kinsey scores and a formula for computing formal compatibility, the expected compatibility is simply an expected-value calculation.</li></ol><h2 id="2-the-kinsey-scale">2 THE KINSEY SCALE</h2><p></p><!--kg-card-begin: markdown--><p>Suppose we measure proclivity/orientation using a “kinsey scale” ranging from -1 (exclusively prefers partners of the opposite gender) to +1 (exclusively prefers partners of the same gender)<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>. Intermediate kinsey scores represent intermediate degrees of proclivity toward each gender, with a kinsey score of 0 representing equal proclivity toward each gender (&quot;bi&quot;).</p>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"><p>A more sophisticated version of this problem would allow for more gender variation by including <em>n</em> genders and would have proclivity take on values in an <em>n</em>-dimensional unit cube so as to represent ace/aromo/etc. variations. <a href="#fnref1" class="footnote-backref">↩︎</a></p>
</li>
</ol>
</section>
<!--kg-card-end: markdown--><p>In the binary gender model, the formal relationship between the genders of any two people can be assigned pure kinsey-like value of ±1, corresponding to whether they have the same gender or different genders. I call this the <em>gender polarity</em> of the pair of people; any two people have a gender polarity, but the polarity is particularly relevant when the two people are in a relationship.</p><h2 id="3-compatibility">3 COMPATIBILITY</h2><p>Suppose a person has a kinsey score of <em>k</em> and is involved in a relationship of polarity <em>r</em>=±1. How should we measure that person's individual compatibility with their relationship?</p><p>One simple choice of compatibility measure is <em>C</em>(<em>r</em>,<em>k</em>)=<em>r</em>⋅<em>k</em>, which assigns -1 compatibility to mismatched relationships (such as a person of purely opposite-gendered proclivity in a same-gendered relationship), and 1 to matched relationships (such as a person of purely different-gendered proclivity in a different-gendered relationship.</p><!--kg-card-begin: markdown--><p>One defect with this measure is that it treats bi proclivity (i.e. a kinsey score of zero) as being middlingly compatible with any relationship C(r,0)=0—whereas it might be more desirable to have bi proclivity be fully compatible with any relationship. To patch this defect, we will instead use the slightly modified function C(r,k)=min(1,1+r⋅k) which assigns compatibility scores between 0 (mismatched proclivity and relationship) and 1 (matched proclivity and relationship), with bi proclivity receiving the maximal score along with other matched relationships <sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>.)</p>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"><p>In this simplified universe, I have decided to model bi compatibility as maximal with either gender. Other forms of proclivity are possible, e.g. considering bi compatibility to be neutral with either gender C(r,k)=rk as mentioned earlier, or even varying based on the balance of genders in a relationship. <a href="#fnref1" class="footnote-backref">↩︎</a></p>
</li>
</ol>
</section>
<!--kg-card-end: markdown--><p>Given two people in a relationship, their overall compatibility can be determined by adding up their compatibility scores. To place compatibility values on a -1 to 1 scale, we'll subtract 1 from the total.</p><p><em>C</em>(<em>r</em>,<em>k</em>1,<em>k</em>2)=<em>C</em>(<em>r</em>,<em>k</em>1)+<em>C</em>(<em>r</em>,<em>k</em>2)−1</p><p>In the next section, we will see that in a simplified version of the problem where you must determine my partners' compatibility with each other given <em>full</em> information—you know not only everyone's kinsey scores but also whether each pair of people has the same or different genders—the compatibility measure <em>C</em>(<em>r</em>,<em>k</em>1,<em>k</em>2) provides a direct, deterministic measure of my two partners' compatibility.</p><h2 id="4-love-triangle-polarity">4 LOVE TRIANGLE POLARITY</h2><p>If you know whether I have the same gender as each of my partners, you can easily figure out whether my partners have the same gender or different genders from each other.</p><p>Numerically, if you know the gender polarity between me and each of my two partners — <em>r</em>1,2,<em>r</em>1,3 — but don't know the relationship polarity <em>r</em>2,3 between my two partners, you can easily compute it:</p><p><em>r</em>2,3=<em>r</em>1,2⋅<em>r</em>1,3.</p><h2 id="5-inferring-gender-relations-from-kinsey-scores">5 INFERRING GENDER RELATIONS FROM KINSEY SCORES</h2><p>To estimate the compatibility between my partners, you must somehow estimate the gender relations between them using our three kinsey scores. How should you predict whether a relationship is between same-gendered or different-gendered individuals as a function of the kinsey scores of the participants?</p><p>Let <em>r</em>(<em>a</em>,<em>b</em>) denote the probability that two people with respective kinsey scores of <em>a</em> and <em>b</em> are in a same-gendered relationship<sup><a href="http://logical.ai/kinsey/org/arithmetic.html#fn.3">3</a></sup>. Based on common-sense considerations, the function <em>r</em>(<em>a</em>,<em>b</em>) should ideally satisfy the following criteria:</p><p><em>r</em> is as smooth as possible, e.g. differentiable almost everywhere.</p><p><em>Small changes in proclivity should never cause large changes in probability.</em></p><p><em>r</em> is symmetric: <em>r</em>(<em>a</em>,<em>b</em>)=<em>r</em>(<em>b</em>,<em>a</em>).</p><p><em>The order of the participants doesn't matter.</em></p><p>Inverting both kinsey scores inverts the probability: <em>r</em>(<em>a</em>,<em>b</em>)+<em>r</em>(−<em>a</em>,−<em>b</em>)=1</p><p><em>Inverting both kinsey scores instead gives the probability that they will be in an</em> opposite-gendered <em>relationship.</em></p><p><em>r</em> is increasing: <em>r</em>(<em>a</em>+<em>x</em>,<em>b</em>)≥<em>r</em>(<em>a</em>,<em>b</em>) when <em>x</em>&gt;0.</p><p><em>You can't decrease the probability of a straight relationship by making one of the participants straighter.</em><sup><a href="http://logical.ai/kinsey/org/arithmetic.html#fn.4">4</a></sup></p><p><em>r</em> is maximal whenever both arguments are: <em>r</em>(1,1)=1</p><p><em>If the two participants have purely same-gendered proclivity, they are certain to be in a same-gendered relationship</em>.</p><p><em>r</em> is a linear interpolation whenever any argument is zero: <em>r</em>(<em>a</em>,0)=12(1+<em>a</em>).</p><p><em>When any participant is bi, the probability that the relationship is between people of the same gender is dictated by the other participant.</em></p><p>Out of many possible functions with this behavior, one nice function is:</p><p><em>r</em>(<em>a</em>,<em>b</em>)≡min(1,max(0,1+<em>a</em>+<em>b</em>2))</p><p>which is essentially the sum of the proclivities <em>a</em> and <em>b</em>, rescaled to interpolate between 0 and 1 when proclivities are in a middle range, and cut off at 0 and 1 when proclivities are in an extreme range.</p><h2 id="6-expected-compatibility">6 EXPECTED COMPATIBILITY</h2><p>Now it's straightforward to compute the expected compatibility between my two partners given only everyone's kinsey scores:</p><p><em>EC</em>(<em>k</em>1,<em>k</em>2,<em>k</em>3)=<em>P</em>(<em>r</em>2,3=1)⋅<em>C</em>(+1,<em>k</em>2,<em>k</em>3)+<em>P</em>(<em>r</em>2,3=−1)⋅<em>C</em>(−1,<em>k</em>2,<em>k</em>3)</p><p>We can estimate the probability that r<sub>2,3</sub> = 1 by using the "love triangle polarity" formula above to express r<sub>2,3</sub> in terms of r<sub>1,2</sub> and r<sub>1,3</sub>, then use the "relationship polarity from kinsey scores" to get probabilities for various values of r<sub>1,2</sub> and r<sub>1,3</sub> in terms of the kinsey scores of the participants.</p><p><em>EC</em>(<em>k</em>1,<em>k</em>2,<em>k</em>3)==<em>P</em>(<em>r</em>2,3=1)⋅<em>C</em>(+1,<em>k</em>2,<em>k</em>3)+<em>P</em>(<em>r</em>2,3=−1)⋅<em>C</em>(−1,<em>k</em>2,<em>k</em>3)[<em>r</em>(<em>k</em>1,<em>k</em>2)⋅<em>r</em>(−<em>k</em>1,−<em>k</em>3)+<em>r</em>(−<em>k</em>1,−<em>k</em>2)⋅<em>r</em>(<em>k</em>1,<em>k</em>3)]<em>C</em>(+1,<em>k</em>2,<em>k</em>3)+[<em>r</em>(<em>k</em>1,<em>k</em>2)⋅<em>r</em>(<em>k</em>1,<em>k</em>3)+<em>r</em>(−<em>k</em>1,−<em>k</em>2)⋅<em>r</em>(−<em>k</em>1,−<em>k</em>3)]<em>C</em>(−1,<em>k</em>2,<em>k</em>3)</p><h2 id="7-bonus">7 Bonus</h2><p>In order to solve our problem, we needed a way to estimate gender relationships from known kinsey scores. Assuming binary genders, the inverse problem of estimating kinsey scores from known gender relations results in a probability distribution isomorphic to drawing black/white balls out of an urn and representing your knowledge of the proportion of black/white balls in the urn — the binomial distribution, or the <strong>bi distribution</strong> for short.</p><h2 id="footnotes-1">Footnotes:<sup><a href="http://logical.ai/kinsey/org/arithmetic.html#fnr.1">1</a></sup></h2><p>A more sophisticated version of this problem would allow for more gender variation by including <em>n</em> genders and would have proclivity take on values in an <em>n</em>-dimensional unit cube so as to represent ace/aromo/etc. variations.<sup><a href="http://logical.ai/kinsey/org/arithmetic.html#fnr.2">2</a></sup></p><p>In this simplified universe, I have decided to model bi compatibility as maximal with either gender. Other forms of proclivity are possible, e.g. considering bi compatibility to be neutral with either gender <em>C</em>(<em>r</em>,<em>k</em>)=<em>rk</em> as mentioned earlier, or even varying based on the balance of genders in a relationship.<sup><a href="http://logical.ai/kinsey/org/arithmetic.html#fnr.3">3</a></sup></p><p>Given the two-gender assumption, the probability that they are in a <em>opposite</em>-gendered relationship is 1−<em>r</em>(<em>a</em>,<em>b</em>)<sup><a href="http://logical.ai/kinsey/org/arithmetic.html#fnr.4">4</a></sup></p><p>"Straight" and "straighter" meaning having a negative or more negative kinsey score.</p>]]></content:encoded></item><item><title><![CDATA[How to cross the street]]></title><description><![CDATA[By optimizing my walk home, I've discovered some beautiful graphs and an unexpected conclusion.]]></description><link>http://illuminium.org/how-to-cross-the-street/</link><guid isPermaLink="false">600f57e2639a6abc73f795b9</guid><category><![CDATA[diagrams]]></category><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Wed, 20 May 2015 07:00:00 GMT</pubDate><media:content url="http://illuminium.org/content/images/2021/01/diagram-crossing.png" medium="image"/><content:encoded><![CDATA[<h2 id="the-street-crossing-puzzle">The street crossing puzzle</h2><img src="http://illuminium.org/content/images/2021/01/diagram-crossing.png" alt="How to cross the street"><p>I've been thinking a lot recently about how to cross the street. Specifically, when standing at the position labeled START in the map shown here, what's the best way to get to the position labeled HOME? </p><!--kg-card-begin: html--><svg version="1.1" id="map" width="400" height="340" style="float:right;margin:1em;"><rect x="0" y="0" width="384" height="192" fill="#474747"/><line x1="0" y1="96" x2="256" y2="96" stroke="#888" stroke-width="4" stroke-dasharray="6,4"/><line x1="320" y1="96" x2="384" y2="96" stroke="#888" stroke-width="4" stroke-dasharray="6,4"/><line x1="288" y1="0" x2="288" y2="64" stroke="#888" stroke-width="4" stroke-dasharray="6,4"/><line x1="288" y1="128" x2="288" y2="192" stroke="#888" stroke-width="4" stroke-dasharray="6,4"/><line x1="32" y1="64" x2="32" y2="128" stroke="#bff073" stroke-width="7"/><line x1="224" y1="64" x2="224" y2="128" stroke="#bff073" stroke-width="7"/><line x1="352" y1="64" x2="352" y2="128" stroke="#0dc9f7" stroke-width="7"/><line x1="256" y1="32" x2="320" y2="32" stroke="#bff073" stroke-width="7"/><line x1="256" y1="160" x2="320" y2="160" stroke="#0dc9f7" stroke-width="7"/><text x="48" y="84" fill="#fff" font-size="16" font-weight="bold" font-family="Cabin" textalign="start">1</text><text x="288" y="84" fill="#fff" font-size="16" font-weight="bold" font-family="Cabin" textalign="middle">2</text><rect x="0" y="0" width="256" height="64" fill="#d8d2cf" stroke="#c0bbb8" stroke-width="1"/><rect x="0" y="128" width="256" height="64" fill="#d8d2cf" stroke="#c0bbb8" stroke-width="1"/><rect x="320" y="0" width="64" height="64" fill="#d8d2cf" stroke="#c0bbb8" stroke-width="1"/><rect x="320" y="128" width="64" height="64" fill="#d8d2cf" stroke="#c0bbb8" stroke-width="1"/><text x="32" y="32" font-size="16" font-family="Cabin" fill="#666" text-anchor="middle" font-weight="bold">START</text><text x="352" y="160" font-size="16" font-family="Cabin" fill="#666" text-anchor="middle" font-weight="bold">HOME</text></svg><!--kg-card-end: html--><p>There are two main strategies that I know some people employ:</p><ol><li><strong>Disregarding</strong>: Never cross at the first vertical crosswalk. Instead, always proceed to the second crosswalk.</li><li><strong>Opportunism</strong>: If the first vertical crosswalk is available when you arrive, cross there. Otherwise, proceed to the second crosswalk.</li></ol><p>Interestingly, I asked around and found that both Disregarding and Opportunism are popular strategies — and that advocates of one consider their own strategy to be obviously superior:</p><blockquote><em><strong>Disregarder</strong></em>: “By proceeding to the second crossing, you can cross in whichever direction is available, then cross in the other direction immediately afterwards. It's more efficient if you don't have to wait for the right direction to become available.”</blockquote><blockquote><em><strong>Opportunist</strong></em>: “By crossing immediately, you take the opportunity to bring yourself closer to your goal right away; it's more efficient if you have to wait for only one light rather than two.”</blockquote><p>I decided to find an analytic solution, which led to some beautiful graphs— and an unexpected verdict.<br></p><p>(Which strategy do you think is better? Are they equally efficient?)</p><h2 id="the-crosswalk-model">The crosswalk model</h2><p>Here are some of the main features of my model:</p><ul><li>Each crosswalk switches between horizontal and vertical with a cycle time of S seconds.</li><li>You take a constant amount of time T seconds to cross any street. (For example, you don't sprint to make it across the street in time.)</li><li>You take less than one cycle time to cross the street. 0&lt;T&lt;S</li><li>At the second crosswalk, there is no "dead time" where no one can walk. (In practice, dead time would be used to allow cars to make turns against the direction of traffic.)</li><li>The first and second crosswalk have independent cycles.</li></ul><h1 id="depictions-of-crossing-strategies">Depictions of crossing strategies</h1><h2 id="when-you-wait-to-cross-the-street-both-directions">When you wait to cross the street both directions</h2><p>In this image, you see all possible outcomes of crossing the street twice consecutively. The horizontal axis records the state of the crosswalk, which alternates between allowing horizontal and vertical crossings. The vertical axis measures the activity of a person over time — the person's arrival is marked at the top of the image, and time proceeds downward. As the person's time advances, so does the state of the crosswalk — so individuals are represented by lines at a 45° angle.</p><!--kg-card-begin: html--><svg version="1.1" id="twoway" width="700" height="330"><g transform="translate(60,0)"><g transform="rotate(45)"><text x="30" y="16" font-size="11" font-family="Cabin" fill="#555">NO TIME</text><text x="130" y="16" font-size="11" font-family="Cabin" fill="#555">WALK #1</text><text x="210" y="16" font-size="11" font-family="Cabin" fill="#555">WAIT FOR CYCLE TO FINISH</text><text x="380" y="16" font-size="11" font-family="Cabin" fill="#555">WALK #2</text></g></g><line x1="60" y1="0" x2="130" y2="70" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="70" x2="200" y2="140" stroke-width="6" stroke="#bff073"/><line x1="200" y1="140" x2="310" y2="250" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="250" x2="380" y2="320" stroke-width="6" stroke="#0dc9f7"/><line x1="69" y1="0" x2="130" y2="61" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="61" x2="200" y2="131" stroke-width="6" stroke="#bff073"/><line x1="200" y1="131" x2="310" y2="241" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="241" x2="380" y2="311" stroke-width="6" stroke="#0dc9f7"/><line x1="78" y1="0" x2="130" y2="52" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="52" x2="200" y2="122" stroke-width="6" stroke="#bff073"/><line x1="200" y1="122" x2="310" y2="232" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="232" x2="380" y2="302" stroke-width="6" stroke="#0dc9f7"/><line x1="87" y1="0" x2="130" y2="43" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="43" x2="200" y2="113" stroke-width="6" stroke="#bff073"/><line x1="200" y1="113" x2="310" y2="223" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="223" x2="380" y2="293" stroke-width="6" stroke="#0dc9f7"/><line x1="96" y1="0" x2="130" y2="34" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="34" x2="200" y2="104" stroke-width="6" stroke="#bff073"/><line x1="200" y1="104" x2="310" y2="214" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="214" x2="380" y2="284" stroke-width="6" stroke="#0dc9f7"/><line x1="105" y1="0" x2="130" y2="25" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="25" x2="200" y2="95" stroke-width="6" stroke="#bff073"/><line x1="200" y1="95" x2="310" y2="205" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="205" x2="380" y2="275" stroke-width="6" stroke="#0dc9f7"/><line x1="114" y1="0" x2="130" y2="16" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="16" x2="200" y2="86" stroke-width="6" stroke="#bff073"/><line x1="200" y1="86" x2="310" y2="196" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="196" x2="380" y2="266" stroke-width="6" stroke="#0dc9f7"/><line x1="123" y1="0" x2="130" y2="7" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="7" x2="200" y2="77" stroke-width="6" stroke="#bff073"/><line x1="200" y1="77" x2="310" y2="187" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="187" x2="380" y2="257" stroke-width="6" stroke="#0dc9f7"/><line x1="132" y1="0" x2="132" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="132" y1="0" x2="202" y2="70" stroke-width="6" stroke="#bff073"/><line x1="202" y1="70" x2="310" y2="178" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="178" x2="380" y2="248" stroke-width="6" stroke="#0dc9f7"/><line x1="141" y1="0" x2="141" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="141" y1="0" x2="211" y2="70" stroke-width="6" stroke="#bff073"/><line x1="211" y1="70" x2="310" y2="169" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="169" x2="380" y2="239" stroke-width="6" stroke="#0dc9f7"/><line x1="150" y1="0" x2="150" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="150" y1="0" x2="220" y2="70" stroke-width="6" stroke="#bff073"/><line x1="220" y1="70" x2="310" y2="160" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="160" x2="380" y2="230" stroke-width="6" stroke="#0dc9f7"/><line x1="159" y1="0" x2="159" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="159" y1="0" x2="229" y2="70" stroke-width="6" stroke="#bff073"/><line x1="229" y1="70" x2="310" y2="151" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="151" x2="380" y2="221" stroke-width="6" stroke="#0dc9f7"/><line x1="168" y1="0" x2="168" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="168" y1="0" x2="238" y2="70" stroke-width="6" stroke="#bff073"/><line x1="238" y1="70" x2="310" y2="142" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="142" x2="380" y2="212" stroke-width="6" stroke="#0dc9f7"/><line x1="177" y1="0" x2="177" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="177" y1="0" x2="247" y2="70" stroke-width="6" stroke="#bff073"/><line x1="247" y1="70" x2="310" y2="133" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="133" x2="380" y2="203" stroke-width="6" stroke="#0dc9f7"/><line x1="186" y1="0" x2="186" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="186" y1="0" x2="256" y2="70" stroke-width="6" stroke="#bff073"/><line x1="256" y1="70" x2="310" y2="124" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="124" x2="380" y2="194" stroke-width="6" stroke="#0dc9f7"/><line x1="195" y1="0" x2="195" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="195" y1="0" x2="265" y2="70" stroke-width="6" stroke="#bff073"/><line x1="265" y1="70" x2="310" y2="115" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="115" x2="380" y2="185" stroke-width="6" stroke="#0dc9f7"/><line x1="204" y1="0" x2="204" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="204" y1="0" x2="274" y2="70" stroke-width="6" stroke="#bff073"/><line x1="274" y1="70" x2="310" y2="106" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="106" x2="380" y2="176" stroke-width="6" stroke="#0dc9f7"/><line x1="213" y1="0" x2="213" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="213" y1="0" x2="283" y2="70" stroke-width="6" stroke="#bff073"/><line x1="283" y1="70" x2="310" y2="97" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="97" x2="380" y2="167" stroke-width="6" stroke="#0dc9f7"/><line x1="222" y1="0" x2="222" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="222" y1="0" x2="292" y2="70" stroke-width="6" stroke="#bff073"/><line x1="292" y1="70" x2="310" y2="88" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="88" x2="380" y2="158" stroke-width="6" stroke="#0dc9f7"/><line x1="231" y1="0" x2="231" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="231" y1="0" x2="301" y2="70" stroke-width="6" stroke="#bff073"/><line x1="301" y1="70" x2="310" y2="79" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="79" x2="380" y2="149" stroke-width="6" stroke="#0dc9f7"/><line x1="240" y1="0" x2="310" y2="70" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="70" x2="380" y2="140" stroke-width="6" stroke="#bff073"/><line x1="380" y1="140" x2="490" y2="250" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="250" x2="560" y2="320" stroke-width="6" stroke="#0dc9f7"/><line x1="249" y1="0" x2="310" y2="61" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="61" x2="380" y2="131" stroke-width="6" stroke="#bff073"/><line x1="380" y1="131" x2="490" y2="241" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="241" x2="560" y2="311" stroke-width="6" stroke="#0dc9f7"/><line x1="258" y1="0" x2="310" y2="52" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="52" x2="380" y2="122" stroke-width="6" stroke="#bff073"/><line x1="380" y1="122" x2="490" y2="232" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="232" x2="560" y2="302" stroke-width="6" stroke="#0dc9f7"/><line x1="267" y1="0" x2="310" y2="43" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="43" x2="380" y2="113" stroke-width="6" stroke="#bff073"/><line x1="380" y1="113" x2="490" y2="223" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="223" x2="560" y2="293" stroke-width="6" stroke="#0dc9f7"/><line x1="276" y1="0" x2="310" y2="34" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="34" x2="380" y2="104" stroke-width="6" stroke="#bff073"/><line x1="380" y1="104" x2="490" y2="214" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="214" x2="560" y2="284" stroke-width="6" stroke="#0dc9f7"/><line x1="285" y1="0" x2="310" y2="25" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="25" x2="380" y2="95" stroke-width="6" stroke="#bff073"/><line x1="380" y1="95" x2="490" y2="205" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="205" x2="560" y2="275" stroke-width="6" stroke="#0dc9f7"/><line x1="294" y1="0" x2="310" y2="16" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="16" x2="380" y2="86" stroke-width="6" stroke="#bff073"/><line x1="380" y1="86" x2="490" y2="196" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="196" x2="560" y2="266" stroke-width="6" stroke="#0dc9f7"/><line x1="303" y1="0" x2="310" y2="7" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="7" x2="380" y2="77" stroke-width="6" stroke="#bff073"/><line x1="380" y1="77" x2="490" y2="187" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="187" x2="560" y2="257" stroke-width="6" stroke="#0dc9f7"/><line x1="312" y1="0" x2="312" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="312" y1="0" x2="382" y2="70" stroke-width="6" stroke="#bff073"/><line x1="382" y1="70" x2="490" y2="178" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="178" x2="560" y2="248" stroke-width="6" stroke="#0dc9f7"/><line x1="321" y1="0" x2="321" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="321" y1="0" x2="391" y2="70" stroke-width="6" stroke="#bff073"/><line x1="391" y1="70" x2="490" y2="169" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="169" x2="560" y2="239" stroke-width="6" stroke="#0dc9f7"/><line x1="330" y1="0" x2="330" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="330" y1="0" x2="400" y2="70" stroke-width="6" stroke="#bff073"/><line x1="400" y1="70" x2="490" y2="160" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="160" x2="560" y2="230" stroke-width="6" stroke="#0dc9f7"/><line x1="339" y1="0" x2="339" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="339" y1="0" x2="409" y2="70" stroke-width="6" stroke="#bff073"/><line x1="409" y1="70" x2="490" y2="151" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="151" x2="560" y2="221" stroke-width="6" stroke="#0dc9f7"/><line x1="348" y1="0" x2="348" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="348" y1="0" x2="418" y2="70" stroke-width="6" stroke="#bff073"/><line x1="418" y1="70" x2="490" y2="142" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="142" x2="560" y2="212" stroke-width="6" stroke="#0dc9f7"/><line x1="357" y1="0" x2="357" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="357" y1="0" x2="427" y2="70" stroke-width="6" stroke="#bff073"/><line x1="427" y1="70" x2="490" y2="133" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="133" x2="560" y2="203" stroke-width="6" stroke="#0dc9f7"/><line x1="366" y1="0" x2="366" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="366" y1="0" x2="436" y2="70" stroke-width="6" stroke="#bff073"/><line x1="436" y1="70" x2="490" y2="124" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="124" x2="560" y2="194" stroke-width="6" stroke="#0dc9f7"/><line x1="375" y1="0" x2="375" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="375" y1="0" x2="445" y2="70" stroke-width="6" stroke="#bff073"/><line x1="445" y1="70" x2="490" y2="115" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="115" x2="560" y2="185" stroke-width="6" stroke="#0dc9f7"/><line x1="384" y1="0" x2="384" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="384" y1="0" x2="454" y2="70" stroke-width="6" stroke="#bff073"/><line x1="454" y1="70" x2="490" y2="106" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="106" x2="560" y2="176" stroke-width="6" stroke="#0dc9f7"/><line x1="393" y1="0" x2="393" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="393" y1="0" x2="463" y2="70" stroke-width="6" stroke="#bff073"/><line x1="463" y1="70" x2="490" y2="97" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="97" x2="560" y2="167" stroke-width="6" stroke="#0dc9f7"/><line x1="402" y1="0" x2="402" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="402" y1="0" x2="472" y2="70" stroke-width="6" stroke="#bff073"/><line x1="472" y1="70" x2="490" y2="88" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="88" x2="560" y2="158" stroke-width="6" stroke="#0dc9f7"/><line x1="411" y1="0" x2="411" y2="0" stroke-width="6" stroke="#7f7f7f"/><line x1="411" y1="0" x2="481" y2="70" stroke-width="6" stroke="#bff073"/><line x1="481" y1="70" x2="490" y2="79" stroke-width="6" stroke="#ed1c24"/><line x1="490" y1="79" x2="560" y2="149" stroke-width="6" stroke="#0dc9f7"/></svg><!--kg-card-end: html--><p>Each diagonal line represents a single individual who has arrived at the crosswalk when it's in a particular state. As the person waits and walks, their line changes color. For example, the leftmost line in the image represents the worst case scenario: the person arrives having not enough time to cross, and so must wait (grey segment). When the light changes, the person crosses (green segment). Afterwards, the person waits for the current cycle to finish (red segment) so as to cross in the other direction next (blue segment).</p><p>Here are some interesting observations about waiting times in this scenario:</p><ul><li>The grey region has width and height equal to your crossing time T, because you only miss the light if it has fewer than T seconds remaining.</li><li>The image is periodic in the horizontal direction with period S, because the state of the crosswalk is periodic.</li><li>The red region has a 90° corner because if you must wait for a new cycle to begin, you'll spend T seconds walking across, and the full remainder of the cycle S−T seconds waiting for the light to change. On the other hand, if you arrive after the cycle has started, you'll spend T seconds walking across, and less than the full cycle waiting.</li><li>(!) The waiting-time regions (red and grey) align perfectly, forming triangular regions of width and height S. This is because the first waiting time is at worst T, and the second waiting time is at worst S−T.</li><li>As a corollary, average waiting time in the second crossing strategy is <em>independent of walking speed</em>; the gain from crossing the street quickly is cancelled by the fact that you'll have to wait that much longer for the cycle to complete once you've reached the other side.</li></ul><h2 id="when-you-must-cross-the-street-in-only-one-direction">When you must cross the street in only one direction</h2><p>In the case where you <em>can't</em> cross at the first crosswalk, the Opportunist and the Disregarder follow the same strategy: they proceed to the second crosswalk and cross as efficiently as possible.</p><p>So, if there is to be any difference in waiting times between the two strategies, it must appear when it's genuinely possible to cross the street — when the Opportunist chooses to cross, and the Disregarder chooses not to.</p><p>In that case, the Opportunist can cross in one direction immediately, spending no time waiting at all. Then, at the second crosswalk, the Opportunist's outcomes look like this:</p><!--kg-card-begin: html--><svg version="1.1" id="oneway" width="700" height="400"><g transform="translate(60,20)"><g transform="rotate(45)"><text x="30" y="20" font-size="11" font-family="Cabin" fill="#555">NO TIME</text><text x="130" y="20" font-size="11" font-family="Cabin" fill="#555">CAN'T CROSS THIS DIRECTION</text><text x="380" y="20" font-size="11" font-family="Cabin" fill="#555">WALK</text></g></g><line x1="60" y1="24" x2="60" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="60" y1="24" x2="130" y2="94" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="94" x2="310" y2="274" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="274" x2="380" y2="344" stroke-width="6" stroke="#0dc9f7"/><line x1="69" y1="24" x2="69" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="69" y1="24" x2="130" y2="85" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="85" x2="310" y2="265" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="265" x2="380" y2="335" stroke-width="6" stroke="#0dc9f7"/><line x1="78" y1="24" x2="78" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="78" y1="24" x2="130" y2="76" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="76" x2="310" y2="256" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="256" x2="380" y2="326" stroke-width="6" stroke="#0dc9f7"/><line x1="87" y1="24" x2="87" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="87" y1="24" x2="130" y2="67" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="67" x2="310" y2="247" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="247" x2="380" y2="317" stroke-width="6" stroke="#0dc9f7"/><line x1="96" y1="24" x2="96" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="96" y1="24" x2="130" y2="58" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="58" x2="310" y2="238" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="238" x2="380" y2="308" stroke-width="6" stroke="#0dc9f7"/><line x1="105" y1="24" x2="105" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="105" y1="24" x2="130" y2="49" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="49" x2="310" y2="229" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="229" x2="380" y2="299" stroke-width="6" stroke="#0dc9f7"/><line x1="114" y1="24" x2="114" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="114" y1="24" x2="130" y2="40" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="40" x2="310" y2="220" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="220" x2="380" y2="290" stroke-width="6" stroke="#0dc9f7"/><line x1="123" y1="24" x2="123" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="123" y1="24" x2="130" y2="31" stroke-width="6" stroke="#7f7f7f"/><line x1="130" y1="31" x2="310" y2="211" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="211" x2="380" y2="281" stroke-width="6" stroke="#0dc9f7"/><line x1="132" y1="24" x2="310" y2="202" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="202" x2="310" y2="202" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="202" x2="310" y2="202" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="202" x2="380" y2="272" stroke-width="6" stroke="#0dc9f7"/><line x1="141" y1="24" x2="310" y2="193" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="193" x2="310" y2="193" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="193" x2="310" y2="193" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="193" x2="380" y2="263" stroke-width="6" stroke="#0dc9f7"/><line x1="150" y1="24" x2="310" y2="184" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="184" x2="310" y2="184" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="184" x2="310" y2="184" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="184" x2="380" y2="254" stroke-width="6" stroke="#0dc9f7"/><line x1="159" y1="24" x2="310" y2="175" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="175" x2="310" y2="175" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="175" x2="310" y2="175" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="175" x2="380" y2="245" stroke-width="6" stroke="#0dc9f7"/><line x1="168" y1="24" x2="310" y2="166" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="166" x2="310" y2="166" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="166" x2="310" y2="166" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="166" x2="380" y2="236" stroke-width="6" stroke="#0dc9f7"/><line x1="177" y1="24" x2="310" y2="157" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="157" x2="310" y2="157" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="157" x2="310" y2="157" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="157" x2="380" y2="227" stroke-width="6" stroke="#0dc9f7"/><line x1="186" y1="24" x2="310" y2="148" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="148" x2="310" y2="148" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="148" x2="310" y2="148" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="148" x2="380" y2="218" stroke-width="6" stroke="#0dc9f7"/><line x1="195" y1="24" x2="310" y2="139" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="139" x2="310" y2="139" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="139" x2="310" y2="139" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="139" x2="380" y2="209" stroke-width="6" stroke="#0dc9f7"/><line x1="204" y1="24" x2="310" y2="130" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="130" x2="310" y2="130" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="130" x2="310" y2="130" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="130" x2="380" y2="200" stroke-width="6" stroke="#0dc9f7"/><line x1="213" y1="24" x2="310" y2="121" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="121" x2="310" y2="121" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="121" x2="310" y2="121" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="121" x2="380" y2="191" stroke-width="6" stroke="#0dc9f7"/><line x1="222" y1="24" x2="310" y2="112" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="112" x2="310" y2="112" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="112" x2="310" y2="112" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="112" x2="380" y2="182" stroke-width="6" stroke="#0dc9f7"/><line x1="231" y1="24" x2="310" y2="103" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="103" x2="310" y2="103" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="103" x2="310" y2="103" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="103" x2="380" y2="173" stroke-width="6" stroke="#0dc9f7"/><line x1="240" y1="24" x2="310" y2="94" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="94" x2="310" y2="94" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="94" x2="310" y2="94" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="94" x2="380" y2="164" stroke-width="6" stroke="#0dc9f7"/><line x1="249" y1="24" x2="310" y2="85" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="85" x2="310" y2="85" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="85" x2="310" y2="85" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="85" x2="380" y2="155" stroke-width="6" stroke="#0dc9f7"/><line x1="258" y1="24" x2="310" y2="76" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="76" x2="310" y2="76" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="76" x2="310" y2="76" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="76" x2="380" y2="146" stroke-width="6" stroke="#0dc9f7"/><line x1="267" y1="24" x2="310" y2="67" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="67" x2="310" y2="67" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="67" x2="310" y2="67" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="67" x2="380" y2="137" stroke-width="6" stroke="#0dc9f7"/><line x1="276" y1="24" x2="310" y2="58" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="58" x2="310" y2="58" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="58" x2="310" y2="58" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="58" x2="380" y2="128" stroke-width="6" stroke="#0dc9f7"/><line x1="285" y1="24" x2="310" y2="49" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="49" x2="310" y2="49" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="49" x2="310" y2="49" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="49" x2="380" y2="119" stroke-width="6" stroke="#0dc9f7"/><line x1="294" y1="24" x2="310" y2="40" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="40" x2="310" y2="40" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="40" x2="310" y2="40" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="40" x2="380" y2="110" stroke-width="6" stroke="#0dc9f7"/><line x1="303" y1="24" x2="310" y2="31" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="31" x2="310" y2="31" stroke-width="6" stroke="#7f7f7f"/><line x1="310" y1="31" x2="310" y2="31" stroke-width="6" stroke="#ed1c24"/><line x1="310" y1="31" x2="380" y2="101" stroke-width="6" stroke="#0dc9f7"/><line x1="312" y1="24" x2="312" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="312" y1="24" x2="312" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="312" y1="24" x2="312" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="312" y1="24" x2="382" y2="94" stroke-width="6" stroke="#0dc9f7"/><line x1="321" y1="24" x2="321" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="321" y1="24" x2="321" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="321" y1="24" x2="321" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="321" y1="24" x2="391" y2="94" stroke-width="6" stroke="#0dc9f7"/><line x1="330" y1="24" x2="330" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="330" y1="24" x2="330" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="330" y1="24" x2="330" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="330" y1="24" x2="400" y2="94" stroke-width="6" stroke="#0dc9f7"/><line x1="339" y1="24" x2="339" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="339" y1="24" x2="339" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="339" y1="24" x2="339" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="339" y1="24" x2="409" y2="94" stroke-width="6" stroke="#0dc9f7"/><line x1="348" y1="24" x2="348" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="348" y1="24" x2="348" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="348" y1="24" x2="348" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="348" y1="24" x2="418" y2="94" stroke-width="6" stroke="#0dc9f7"/><line x1="357" y1="24" x2="357" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="357" y1="24" x2="357" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="357" y1="24" x2="357" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="357" y1="24" x2="427" y2="94" stroke-width="6" stroke="#0dc9f7"/><line x1="366" y1="24" x2="366" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="366" y1="24" x2="366" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="366" y1="24" x2="366" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="366" y1="24" x2="436" y2="94" stroke-width="6" stroke="#0dc9f7"/><line x1="375" y1="24" x2="375" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="375" y1="24" x2="375" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="375" y1="24" x2="375" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="375" y1="24" x2="445" y2="94" stroke-width="6" stroke="#0dc9f7"/><line x1="384" y1="24" x2="384" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="384" y1="24" x2="384" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="384" y1="24" x2="384" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="384" y1="24" x2="454" y2="94" stroke-width="6" stroke="#0dc9f7"/><line x1="393" y1="24" x2="393" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="393" y1="24" x2="393" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="393" y1="24" x2="393" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="393" y1="24" x2="463" y2="94" stroke-width="6" stroke="#0dc9f7"/><line x1="402" y1="24" x2="402" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="402" y1="24" x2="402" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="402" y1="24" x2="402" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="402" y1="24" x2="472" y2="94" stroke-width="6" stroke="#0dc9f7"/><line x1="411" y1="24" x2="411" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="411" y1="24" x2="411" y2="24" stroke-width="6" stroke="#7f7f7f"/><line x1="411" y1="24" x2="411" y2="24" stroke-width="6" stroke="#ed1c24"/><line x1="411" y1="24" x2="481" y2="94" stroke-width="6" stroke="#0dc9f7"/></svg><!--kg-card-end: html--><p>The worst case scenario is when the Opportunist arrives during the tail end of the cycle which they need to take — they have no time to cross, and must wait for one complete cycle in the wrong direction before they can cross. The best case, occurring prevalently, is when they arrive sometime during the cycle which they need to take and hence wait no time at all to cross the second time.</p><p>The waiting time area for the Opportunist is sum of the areas of the red and grey regions; they form a triangle of width S+T.</p><h2 id="average-waiting-time">Average waiting time</h2><p>Here, we'll compute the <em>average waiting time</em> of each strategy to get a better feel for the difference.</p><p>The waiting time area for a Disregarder is S2. The waiting time area for an Opportunist depends on whether they were able to cross at the first crosswalk or not: if they were able, the waiting time area is 12(S+T)2, the area of the triangle in the previous section. If they weren't able to cross at the first crosswalk, they behave like a Disregarder would, with a waiting time area of S2.</p><p>How often will the Opportunist be able to cross at the first crosswalk? The crosswalk has a period of length 2S. S of those seconds are uncrossable because the light is in the wrong direction; T of those seconds are uncrossable because there isn't enough time to cross even though the light is in the right direction. The rest of the time, the Opportunist can cross. That's S−T out of 2S.</p><p>The average waiting time occurs when we divide the waiting-area by the period 2S. Thus the Disregarder's average waiting time is \(\)</p><p>S22S=S/2,half of a cycle. The Opportunist's average waiting time is a weighted average:12S⎡⎣⎢⎢⎢S−T2S⋅(S+T)22taken opportunity+S+T2S⋅S2missed opportunity⎤⎦⎥⎥⎥.</p><p>The difference in average waiting time for these two strategies is</p><p>Δ=12SS−T2S[S2−(S+T)22]which is positive if Opportunism is better, and negative if Disregarding is better. To simplify the expression, defineβ≡T/S, where0&lt;β&lt;1by assumption. Then the difference in average waiting time is:Δ====12SS−T2S[S2−(S+T)22]12S(1−β)S2S[S2−S2(1+β)2/2]S8(1−β)[2−(1+β)2][β3+β2−3β+1]S</p><h2 id="the-verdict">The Verdict</h2><!--kg-card-begin: html--><span style="font-size:1.5em">Answer: it depends on how quickly you walk.</span><!--kg-card-end: html--><p></p><p>In fact, the difference in waiting time varies depending on β, the fraction of the cycle time you take to cross the street.</p><p>\( \Delta = [\beta^3 + \beta^2 - 3\beta + 1]S \)</p><p>The Disregarder and Opportunist are equally efficient when this quantity is zero; that is, when β=2√−1≈41%. For shorter walking times, Opportunism is better. For longer walking times, Disregarding is better.</p><p>Intuitively, this occurs because the Opportunist can control the size of the window of opportunity by walking faster. In contrast, any advantage the Disregarder gets from walking faster is cancelled by the additional time spent waiting for the cycle to end.</p><p>This surprising result has an interesting consequence: Suppose two people walk at the same speed. One of them has to cross the street in one direction, the other has to cross in two directions. Who will take longer, on average? The answer, assuming they don't jaywalk, is that it depends on what their shared walking speed is.</p><p></p><!--kg-card-begin: html--><div class="footer"><a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="How to cross the street" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png"></a><br>♡2015
		       Dylan Holmes. My work here (including this HTML
		       file, and plotter.js) is licensed under
		       a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative
		       Commons Attribution-ShareAlike 4.0
		       International
		       License</a>. <span style="color:#888;
		       font-style:italic;">(This means that you are
		       free to use, modify, and re-distribute this
		       work—even commercially—as long as
		       you attribute the original to me and share your
		       modified versions in the same way.)</span>
      </div><!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Categorical orientations]]></title><description><![CDATA[The pan and ace orientations are optimal in a certain mathematically rigorous sense.]]></description><link>http://illuminium.org/categorical-orientations/</link><guid isPermaLink="false">600e8ea5639a6abc73f79347</guid><category><![CDATA[morsels]]></category><category><![CDATA[category-theory]]></category><category><![CDATA[queer]]></category><dc:creator><![CDATA[Dylan Holmes]]></dc:creator><pubDate>Tue, 01 Apr 2014 07:00:00 GMT</pubDate><content:encoded><![CDATA[<p>The pan and ace orientations are optimal in a certain mathematically rigorous sense. They factor out gender (in the definition, you don't need to know the person's gender or the person's model of gender), and they form what is called a categorical adjunction or Galois connection: </p><p>Consider the space of possible orientations. If we assume that each person has exactly one gender and that an orientation comprises a subset of attractive genders, then the space of possible orientations becomes a set \(G \times 2^G\). We can equip \(2^G\) with subset ordering; because genders aren't ordered, we'll equip <em>G</em> with the identity order (each gender is comparable only to itself). \(G\times 2^G\) has the induced product order. There is a <em>disorientation functor</em> \(\mathscr{U}:G\times 2^G\rightarrow G\) which forgets a person's orientation but not their gender. Observe that the left adjoint of \(\mathscr{U}\) assigns an ace orientation to each person: \(g\mapsto \langle g, \emptyset\rangle\). And the right adjoint of \(\mathscr{U}\) assigns the pan orientation to each person: \(g\mapsto \langle g, G\rangle\). Each one represents a certain optimally unassuming solution to recovering an unknown orientation</p><p>$$\mathbf{Ace} \vdash \mathbf{Disorient} \vdash \mathbf{Pan}$$ </p><p>P.S. The evaluation map \(\epsilon\) ("apply") detects same-gender attraction: In programming, evaluation sends arguments \(\langle f, x\rangle\) to \(f(x)\). Every subset of <em>G</em> is [equivalent to] a characteristic function \(G\rightarrow \{\text{true}, \text{false}\}\). So if we apply eval to an orientation in \(G\times 2^G\), we determine whether it includes same-gender attraction.</p><hr><p>Incidentally, the ace/pan functors have further adjunctions when, and only when, there are no genders. In this case, pan and ace become equivalent and the adjunctions form a cycle.</p><p> </p>]]></content:encoded></item></channel></rss>