<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.explainxkcd.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Quincunx</id>
		<title>explain xkcd - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.explainxkcd.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Quincunx"/>
		<link rel="alternate" type="text/html" href="https://www.explainxkcd.com/wiki/index.php/Special:Contributions/Quincunx"/>
		<updated>2026-04-18T03:05:49Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://www.explainxkcd.com/wiki/index.php?title=2740:_Square_Packing&amp;diff=306674</id>
		<title>2740: Square Packing</title>
		<link rel="alternate" type="text/html" href="https://www.explainxkcd.com/wiki/index.php?title=2740:_Square_Packing&amp;diff=306674"/>
				<updated>2023-02-23T05:08:26Z</updated>
		
		<summary type="html">&lt;p&gt;Quincunx: Added a line to mention that Randall really just seems to love unsolved packing problems.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{comic&lt;br /&gt;
| number    = 2740&lt;br /&gt;
| date      = February 20, 2023&lt;br /&gt;
| title     = Square Packing&lt;br /&gt;
| image     = square_packing_2x.png&lt;br /&gt;
| imagesize = 326x295px&lt;br /&gt;
| noexpand  = true&lt;br /&gt;
| titletext = I also managed to improve the solution for n=1 to s&amp;lt;0.97, and with some upgrades I think I can hit 0.96.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Explanation==&lt;br /&gt;
{{incomplete|Created by a HYDRAULIC PRESSED SQUARE - This appears to be referring to a specific puzzle that merits explanation before going into description of the comic. Do NOT delete this tag too soon.}}&lt;br /&gt;
The {{w|Square packing in a square|square packing problem}} is a type of geometry problem. The goal is to find the smallest possible &amp;quot;outer square&amp;quot; that will fit N &amp;quot;inner squares&amp;quot; that are each 1 unit wide and 1 unit tall. In the comic N=11, leading to its name of &amp;quot;The N=11 Square Packing Problem,&amp;quot; and the value 's' is the length of the outer square's sides. (For example, with 16 squares arrayed in a 4x4 square, 's' would be 4. &amp;lt;sup&amp;gt;&amp;amp;#91;''an image would be helpful here''&amp;amp;#93;&amp;lt;/sup&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
This comic spoofs a common phenomenon for some values of N: sometimes the optimal solution looks very &amp;quot;sloppy&amp;quot; to human sensibilities. The lack of a uniform grid or pattern, where some squares look to be misaligned or a lot of space looks wasted, counterintuitively leads to a smaller value for 's' than something more &amp;quot;organized&amp;quot; might be. 'N=11' is one such &amp;quot;frustrating&amp;quot; solution (though it should be noted, the solution depicted has not yet proven to be optimum).&lt;br /&gt;
&lt;br /&gt;
A few days before this comic's post, a web page [https://erich-friedman.github.io/packing/squinsqu/ ''Squares in squares''] gained interest on social media platforms such as [https://twitter.com/KangarooPhysics/status/1625436240412540928 Twitter] and [https://news.ycombinator.com/item?id=34809023 Hacker News]. For many values of N, that page depicts the best known solutions, some of them known to be optimum. The one for N=11 (best known but not proven to be optimum) is the one Randall uses for this comic; its general arrangement was found by Walter Trump in 1979 and slightly improved by Gensane et al. in 2004.&amp;lt;ref&amp;gt;Gensane, T., Ryckelynck, P. – ''Improved dense packings of congruent squares in a square''. Discrete Comput Geom 34, pages 97–109 (2005). https://doi.org/10.1007/s00454-004-1129-z&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Munroe claims to have found a more efficient solution for this N=11 case, by physically deforming the squares involved in the best-known solution with a {{w|hydraulic press}}. The size of the resulting bounding square is indeed smaller, but the &amp;quot;solution&amp;quot; isn't actually one because the inner shapes have countless wrinkles and are no longer squares. Geometrical shapes in packing problems are not conventionally assumed to be deformable in this manner.{{citation needed}}&lt;br /&gt;
&lt;br /&gt;
The title text mentions the same approach &amp;quot;improved&amp;quot; the solution for 1 unit square, whose optimum solution is obviously that unit square itself with s=1. Munroe remarks that if he had &amp;quot;some upgrades&amp;quot;, presumably a more powerful hydraulic press, he could get the resulting square to be even smaller.&lt;br /&gt;
&lt;br /&gt;
The humorous implication behind the comic and the title text is that rather than the shapes being mathematical, abstract shapes, they are actually physical squares, constructed of some extremely strong, but not completely incompressible material. It is not obvious what material that might be: even using a hydraulic press, its volume can only be reduced to 0.97 or 0.96 times its starting volume. (The fact that the squares exist in a 2D universe in the problem statement, but are being crushed presumably by a 3D hydraulic press is not addressed, either).&lt;br /&gt;
&lt;br /&gt;
This is perhaps a related joke to [[2706: Bendy]], but now with squares and compressed areas instead of triangles and extended lengths.  Unsolved packing problems also appear to be a long-standing interest of Randall, who shows himself pondering &amp;quot;the most efficient packing of round-cut diamonds of uniform size&amp;quot; in the What If? [https://what-if.xkcd.com/108/ Expensive Shoebox], with the title text &amp;quot;A Google search for unsolved+packing+problems very nearly got me just now.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
‎&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Transcript==&lt;br /&gt;
{{incomplete transcript|Do NOT delete this tag too soon.}}&lt;br /&gt;
:[11 squares optimally packed inside a square arrangement]&lt;br /&gt;
:Previous best&lt;br /&gt;
:s&amp;lt;3.877084&lt;br /&gt;
:(Gensane, 2004)&lt;br /&gt;
&lt;br /&gt;
:[11 deformed squares crushed together to pack them into a smaller square arrangement]&lt;br /&gt;
:New record &lt;br /&gt;
:s&amp;lt;3.40&lt;br /&gt;
&lt;br /&gt;
:[Caption below the panel:]&lt;br /&gt;
:I've significantly improved on the solution to the n=11 square packing problem by using a hydraulic press.&lt;br /&gt;
&lt;br /&gt;
{{comic discussion}}&lt;br /&gt;
[[Category:Math]]&lt;br /&gt;
[[Category:Geometry]]&lt;/div&gt;</summary>
		<author><name>Quincunx</name></author>	</entry>

	<entry>
		<id>https://www.explainxkcd.com/wiki/index.php?title=2690:_Cool_S&amp;diff=297682</id>
		<title>2690: Cool S</title>
		<link rel="alternate" type="text/html" href="https://www.explainxkcd.com/wiki/index.php?title=2690:_Cool_S&amp;diff=297682"/>
				<updated>2022-10-27T01:47:16Z</updated>
		
		<summary type="html">&lt;p&gt;Quincunx: Added a line to indicate that, although cool, a Cool S is in fact not a chirally accurate representation of DNA.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{comic&lt;br /&gt;
| number    = 2690&lt;br /&gt;
| date      = October 26, 2022&lt;br /&gt;
| title     = Cool S&lt;br /&gt;
| image     = cool_s_2x.png&lt;br /&gt;
| imagesize = 325x327px&lt;br /&gt;
| noexpand  = true&lt;br /&gt;
| titletext = Although I hear they were caught cheating off of Rosalind, who sat at a desk in front of them.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Explanation==&lt;br /&gt;
{{incomplete|Created by a COOL MIDDLE SCHOOL RESEARCHER - Please change this comment when editing this page. Do NOT delete this tag too soon.}}&lt;br /&gt;
The '{{w|Cool S}}' is a stylized drawing of the letter &amp;quot;S&amp;quot;. It is a popular doodle among teenagers as it can be quickly hashed out using six vertical lines which are then connected with an appropriate pattern of diagonal lines.&lt;br /&gt;
&lt;br /&gt;
Randall posits that somebody decided to chain the pattern of the Cool S, then separate the different elements, and created something that turns out to have a visual similarity to the discovered helical structure of {{w|DNA}}.  However, although the final diagram is a double helix, the chirality, or &amp;quot;handedness&amp;quot;, is backwards: an actual DNA molecule winds in the opposite direction (clockwise, if you're looking at it end-on).  (The tutorial at [http://realerthinks.com/correctly-draw-dna/ How to (correctly) draw DNA] describes this in more detail.)&lt;br /&gt;
&lt;br /&gt;
Title text is a reference to {{w|Rosalind Franklin}}, who made a material contribution to the discovery of DNA but was [https://web.archive.org/web/20160927113256/http://www.biomath.nyu.edu/index/course/hw_articles/nature4.pdf controversially not included in the subsequent Nobel Prize], although the reason was not as biased as common belief supposes. She wasn't excluded due to sexism, but because she died in 1958, five years before {{w|Francis Crick}} and {{w|James Watson}} were awarded the Prize and as such was ineligible regardless.&lt;br /&gt;
&lt;br /&gt;
The above is true as far as it goes. A third scientist, Maurice Wilkins, was also named on the prize. Wilkins was Franklin's boss at the time of the discovery and had shared some of her data with Watson, who then shared what he saw with Crick. None of the three men ever told Franklin that Watson and Crick had based their model on her data.&lt;br /&gt;
&lt;br /&gt;
==Transcript==&lt;br /&gt;
{{incomplete transcript|Do NOT delete this tag too soon.}}&lt;br /&gt;
&lt;br /&gt;
:[10 drawings evolving from simple dashes, to a &amp;quot;cool S&amp;quot; symbol, to a representation of DNA.]&lt;br /&gt;
&lt;br /&gt;
:The structure of DNA was originally discovered by a group of especially cool middle school researchers.&lt;br /&gt;
&lt;br /&gt;
{{comic discussion}}&lt;br /&gt;
[[Category:Biology]]&lt;br /&gt;
[[Category:Comics featuring real people]]&lt;/div&gt;</summary>
		<author><name>Quincunx</name></author>	</entry>

	<entry>
		<id>https://www.explainxkcd.com/wiki/index.php?title=2435:_Geothmetic_Meandian&amp;diff=207506</id>
		<title>2435: Geothmetic Meandian</title>
		<link rel="alternate" type="text/html" href="https://www.explainxkcd.com/wiki/index.php?title=2435:_Geothmetic_Meandian&amp;diff=207506"/>
				<updated>2021-03-11T03:29:59Z</updated>
		
		<summary type="html">&lt;p&gt;Quincunx: Minor edit to R code.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{comic&lt;br /&gt;
| number    = 2435&lt;br /&gt;
| date      = March 10, 2021&lt;br /&gt;
| title     = Geothmetic Meandian&lt;br /&gt;
| image     = geothmetic_meandian.png&lt;br /&gt;
| titletext = Pythagorean means are nice and all, but throwing the median in the pot is really what turns this into random forest statistics: applying every function you can think of, and then gradually dropping the ones that make the result worse.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Explanation==&lt;br /&gt;
{{incomplete|Created by an AVERAGE JOE. Please mention here why this explanation isn't complete. Do NOT delete this tag too soon.}}&lt;br /&gt;
There are a number of different ways to identify the '{{w|average}}' value of a series of values, the most common unweighted methods being the {{w|median}} (take the central value from the ordered list of values if there are an odd number - or the value half-way between the two that straddle the divide between two halves if there are an even number) and the {{w|arithmetic mean}} (add all the numbers up, divide by the number of numbers). The {{w|geometric mean}} is less well known to the layman but works with multiplication and Nth-rooting, useful for some statistical analyses.  The geometric mean, arithmetic mean and {{w|harmonic mean}} (not shown) are collectively known as the {{w|Pythagorean means}}.&lt;br /&gt;
&lt;br /&gt;
{{w|Outlier}}s and internal biases within the original sample can make boiling down a set of values into a single 'average' sometimes overly biased by flaws in the data, with your choice of which method to use perhaps resulting in a value that is misleading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Either here or after the next paragraph, demonstrate how (1,1,2,3,5) resolves in each individual method, perhaps? --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this depiction, the three named methods of averaging are embedded within a single function that produces a set of three values - one output for each of the methods. Being a series of values, Randall suggests that this is ideally suited to being ''itself'' subjected to the comparative 'averaging' method. Not just once, but as many times as it takes to narrow down to a set of three values that are very close to one another.&lt;br /&gt;
&lt;br /&gt;
The comment in the title text about suggests that this will save you the trouble of committing to the 'wrong' analysis as it gradually shaves down any 'outlier average' that is unduly affected by anomalies in the original inputs. At first sight it does appear to be a method without any danger of (permanent) divergence of values, but this may need to be proven (or disproven) to be sure.&lt;br /&gt;
&lt;br /&gt;
The title text may also be a sly reference to an actual mathematical theorem, namely that if one performs this procedure only using the arithmetic mean and the harmonic mean, the result will converge to the geometric mean. Randal suggests that the (non-Pythagorean) median, which does not have such good mathematical properties with relation to convergence, is, in fact, the secret sauce in his definition.&lt;br /&gt;
&lt;br /&gt;
There does exist an {{w|arithmetic-geometric mean}}, which is defined identically to this except with the arithmetic and geometric means, and sees some use in calculus.  In some ways it's also philosophically similar to the {{w|truncated mean}} (extremities of the value range, e.g. the highest and lowest 10%s, are ignored as not acceptable and not counted) or {{w|Winsorized mean}} (instead of ignored, the values are readjusted to be the chosen floor/ceiling values that they lay beyond, to still effectively be counted as 'edge' conditions), only with a strange dilution-and-compromise method rather than one where quantities can be culled or neutered just for being unexpectedly different from most of the other data.&lt;br /&gt;
&lt;br /&gt;
The following python code (inefficiently) implements the above algorithm:&lt;br /&gt;
&lt;br /&gt;
    def f(*args):&lt;br /&gt;
        mean = float(sum(args)) / len(args)&lt;br /&gt;
        gmean = reduce(lambda x,y: x*y, args, 1)**(1.0/len(args))&lt;br /&gt;
        args = list(args)&lt;br /&gt;
        args.sort()&lt;br /&gt;
        if len(args) % 2 == 0:&lt;br /&gt;
            median = float(args[len(args) / 2] + args[len(args) / 2 - 1]) / 2&lt;br /&gt;
        else:&lt;br /&gt;
            median = args[len(args) / 2]&lt;br /&gt;
        return mean, gmean, median&lt;br /&gt;
    &lt;br /&gt;
    l0 = [1, 1, 2, 3, 5]&lt;br /&gt;
    &lt;br /&gt;
    l = l0&lt;br /&gt;
    iterations = 0&lt;br /&gt;
    while True:&lt;br /&gt;
        fst = l[0]&lt;br /&gt;
        rest = l[1:]&lt;br /&gt;
        if all((abs(r - fst) &amp;lt; 0.000001 for r in rest)):&lt;br /&gt;
            break&lt;br /&gt;
        l = f(*l)&lt;br /&gt;
        iterations += 1&lt;br /&gt;
    &lt;br /&gt;
    print(l[0], iterations)&lt;br /&gt;
&lt;br /&gt;
And here is an implementation of the Gmdn function in R:&lt;br /&gt;
&lt;br /&gt;
    Gmdn &amp;lt;- function (..., threshold = 1E-6) {&lt;br /&gt;
      # Function F(x) as defined in comic&lt;br /&gt;
      f &amp;lt;- function (x) {&lt;br /&gt;
        n &amp;lt;- length(x)&lt;br /&gt;
        return(c(mean(x), prod(x)^(1/n), median(x)))&lt;br /&gt;
      }&lt;br /&gt;
      # Extract input vector from ... argument&lt;br /&gt;
      x &amp;lt;- c(...)&lt;br /&gt;
      # Iterate until the standard deviation of f(x) reaches a threshold&lt;br /&gt;
      while (sd(x) &amp;gt; threshold) x &amp;lt;- f(x)&lt;br /&gt;
      # Return the mean of the final triplet&lt;br /&gt;
      return(mean(x))&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The input sequence of numbers (1,1,2,3,5) chosen by Randall is also the opening of the {{w|Fibonacci sequence}}.  This may have been selected because the Fibonacci sequence also has a convergent property: the ratio of two adjacent numbers in the sequence approaches the [https://en.wikipedia.org/wiki/Golden_ratio#Relationship_to_Fibonacci_sequence golden ratio] as the length of the sequence approaches infinity.&lt;br /&gt;
&lt;br /&gt;
==Transcript==&lt;br /&gt;
{{incomplete transcript|Do NOT delete this tag too soon.}}&lt;br /&gt;
&lt;br /&gt;
F(x1,x2,...xn)=({x1+x2+...+xn/n [bracket: arithmetic mean]},{nx,x2...xn, [bracket: geometric mean]} {x n+1/2 [bracket: median]})&lt;br /&gt;
&lt;br /&gt;
Gmdn(x1,x2,...xn)={F(F(F(...F(x1,x2,...xn)...)))[bracket: geothmetic meandian]}&lt;br /&gt;
&lt;br /&gt;
Gmdn(1,1,2,3,5) [equals about sign] 2.089&lt;br /&gt;
&lt;br /&gt;
Caption: Stats tip: If you aren't sure whether to use the mean, median, or geometric mean, just calculate all three, then repeat until it converges&lt;br /&gt;
&lt;br /&gt;
{{comic discussion}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
For a start, there is a syntax error. After the first application of F, you get a 3-tuple. Subsequent iterations preserve the 3-tuple, and we need to analyze the resulting sequence.&lt;br /&gt;
Perhaps there is an implicit claim all three entries converge to the same result. In any case, lets see what we get:&lt;br /&gt;
&lt;br /&gt;
Wlog, we have three inputs (x_1,y_1,z_1), and want to understand the iterates of the map &lt;br /&gt;
F(x,y,z) = ( (x+y+z)/3, cube root of (xyz), median(x,y,z) ). Lets write F(x_n,y_n,z_n) = (x_{n+1},y_{n+1},z_{n+1}).&lt;br /&gt;
&lt;br /&gt;
The inequality of arithmetic and geometric means gives x_n \geq y_n, if n \geq 2,  and&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Math]]&lt;br /&gt;
[[Category:Statistics]]&lt;/div&gt;</summary>
		<author><name>Quincunx</name></author>	</entry>

	<entry>
		<id>https://www.explainxkcd.com/wiki/index.php?title=2435:_Geothmetic_Meandian&amp;diff=207505</id>
		<title>2435: Geothmetic Meandian</title>
		<link rel="alternate" type="text/html" href="https://www.explainxkcd.com/wiki/index.php?title=2435:_Geothmetic_Meandian&amp;diff=207505"/>
				<updated>2021-03-11T03:28:25Z</updated>
		
		<summary type="html">&lt;p&gt;Quincunx: Minor edit to clarify note about Fibonacci sequence.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{comic&lt;br /&gt;
| number    = 2435&lt;br /&gt;
| date      = March 10, 2021&lt;br /&gt;
| title     = Geothmetic Meandian&lt;br /&gt;
| image     = geothmetic_meandian.png&lt;br /&gt;
| titletext = Pythagorean means are nice and all, but throwing the median in the pot is really what turns this into random forest statistics: applying every function you can think of, and then gradually dropping the ones that make the result worse.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Explanation==&lt;br /&gt;
{{incomplete|Created by an AVERAGE JOE. Please mention here why this explanation isn't complete. Do NOT delete this tag too soon.}}&lt;br /&gt;
There are a number of different ways to identify the '{{w|average}}' value of a series of values, the most common unweighted methods being the {{w|median}} (take the central value from the ordered list of values if there are an odd number - or the value half-way between the two that straddle the divide between two halves if there are an even number) and the {{w|arithmetic mean}} (add all the numbers up, divide by the number of numbers). The {{w|geometric mean}} is less well known to the layman but works with multiplication and Nth-rooting, useful for some statistical analyses.  The geometric mean, arithmetic mean and {{w|harmonic mean}} (not shown) are collectively known as the {{w|Pythagorean means}}.&lt;br /&gt;
&lt;br /&gt;
{{w|Outlier}}s and internal biases within the original sample can make boiling down a set of values into a single 'average' sometimes overly biased by flaws in the data, with your choice of which method to use perhaps resulting in a value that is misleading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Either here or after the next paragraph, demonstrate how (1,1,2,3,5) resolves in each individual method, perhaps? --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this depiction, the three named methods of averaging are embedded within a single function that produces a set of three values - one output for each of the methods. Being a series of values, Randall suggests that this is ideally suited to being ''itself'' subjected to the comparative 'averaging' method. Not just once, but as many times as it takes to narrow down to a set of three values that are very close to one another.&lt;br /&gt;
&lt;br /&gt;
The comment in the title text about suggests that this will save you the trouble of committing to the 'wrong' analysis as it gradually shaves down any 'outlier average' that is unduly affected by anomalies in the original inputs. At first sight it does appear to be a method without any danger of (permanent) divergence of values, but this may need to be proven (or disproven) to be sure.&lt;br /&gt;
&lt;br /&gt;
The title text may also be a sly reference to an actual mathematical theorem, namely that if one performs this procedure only using the arithmetic mean and the harmonic mean, the result will converge to the geometric mean. Randal suggests that the (non-Pythagorean) median, which does not have such good mathematical properties with relation to convergence, is, in fact, the secret sauce in his definition.&lt;br /&gt;
&lt;br /&gt;
There does exist an {{w|arithmetic-geometric mean}}, which is defined identically to this except with the arithmetic and geometric means, and sees some use in calculus.  In some ways it's also philosophically similar to the {{w|truncated mean}} (extremities of the value range, e.g. the highest and lowest 10%s, are ignored as not acceptable and not counted) or {{w|Winsorized mean}} (instead of ignored, the values are readjusted to be the chosen floor/ceiling values that they lay beyond, to still effectively be counted as 'edge' conditions), only with a strange dilution-and-compromise method rather than one where quantities can be culled or neutered just for being unexpectedly different from most of the other data.&lt;br /&gt;
&lt;br /&gt;
The following python code (inefficiently) implements the above algorithm:&lt;br /&gt;
&lt;br /&gt;
    def f(*args):&lt;br /&gt;
        mean = float(sum(args)) / len(args)&lt;br /&gt;
        gmean = reduce(lambda x,y: x*y, args, 1)**(1.0/len(args))&lt;br /&gt;
        args = list(args)&lt;br /&gt;
        args.sort()&lt;br /&gt;
        if len(args) % 2 == 0:&lt;br /&gt;
            median = float(args[len(args) / 2] + args[len(args) / 2 - 1]) / 2&lt;br /&gt;
        else:&lt;br /&gt;
            median = args[len(args) / 2]&lt;br /&gt;
        return mean, gmean, median&lt;br /&gt;
    &lt;br /&gt;
    l0 = [1, 1, 2, 3, 5]&lt;br /&gt;
    &lt;br /&gt;
    l = l0&lt;br /&gt;
    iterations = 0&lt;br /&gt;
    while True:&lt;br /&gt;
        fst = l[0]&lt;br /&gt;
        rest = l[1:]&lt;br /&gt;
        if all((abs(r - fst) &amp;lt; 0.000001 for r in rest)):&lt;br /&gt;
            break&lt;br /&gt;
        l = f(*l)&lt;br /&gt;
        iterations += 1&lt;br /&gt;
    &lt;br /&gt;
    print(l[0], iterations)&lt;br /&gt;
&lt;br /&gt;
And here is an implementation of the Gmdn function in R:&lt;br /&gt;
&lt;br /&gt;
    Gmdn &amp;lt;- function (..., threshold = 1E-6) {&lt;br /&gt;
      # Function F(x) as defined in comic&lt;br /&gt;
      f &amp;lt;- function (x) {&lt;br /&gt;
        n &amp;lt;- length(x)&lt;br /&gt;
        return(c(mean(x), prod(x)^(1/n), median(x)))&lt;br /&gt;
      }&lt;br /&gt;
      # Extract vector of values from ... argument&lt;br /&gt;
      x &amp;lt;- unlist(list(...))&lt;br /&gt;
      # Iterate until the standard deviation of f(x) reaches a threshold&lt;br /&gt;
      while (sd(x) &amp;gt; threshold) x &amp;lt;- f(x)&lt;br /&gt;
      # Return the mean of the final triplet&lt;br /&gt;
      return(mean(x))&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The input sequence of numbers (1,1,2,3,5) chosen by Randall is also the opening of the {{w|Fibonacci sequence}}.  This may have been selected because the Fibonacci sequence also has a convergent property: the ratio of two adjacent numbers in the sequence approaches the [https://en.wikipedia.org/wiki/Golden_ratio#Relationship_to_Fibonacci_sequence golden ratio] as the length of the sequence approaches infinity.&lt;br /&gt;
&lt;br /&gt;
==Transcript==&lt;br /&gt;
{{incomplete transcript|Do NOT delete this tag too soon.}}&lt;br /&gt;
&lt;br /&gt;
F(x1,x2,...xn)=({x1+x2+...+xn/n [bracket: arithmetic mean]},{nx,x2...xn, [bracket: geometric mean]} {x n+1/2 [bracket: median]})&lt;br /&gt;
&lt;br /&gt;
Gmdn(x1,x2,...xn)={F(F(F(...F(x1,x2,...xn)...)))[bracket: geothmetic meandian]}&lt;br /&gt;
&lt;br /&gt;
Gmdn(1,1,2,3,5) [equals about sign] 2.089&lt;br /&gt;
&lt;br /&gt;
Caption: Stats tip: If you aren't sure whether to use the mean, median, or geometric mean, just calculate all three, then repeat until it converges&lt;br /&gt;
&lt;br /&gt;
{{comic discussion}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
For a start, there is a syntax error. After the first application of F, you get a 3-tuple. Subsequent iterations preserve the 3-tuple, and we need to analyze the resulting sequence.&lt;br /&gt;
Perhaps there is an implicit claim all three entries converge to the same result. In any case, lets see what we get:&lt;br /&gt;
&lt;br /&gt;
Wlog, we have three inputs (x_1,y_1,z_1), and want to understand the iterates of the map &lt;br /&gt;
F(x,y,z) = ( (x+y+z)/3, cube root of (xyz), median(x,y,z) ). Lets write F(x_n,y_n,z_n) = (x_{n+1},y_{n+1},z_{n+1}).&lt;br /&gt;
&lt;br /&gt;
The inequality of arithmetic and geometric means gives x_n \geq y_n, if n \geq 2,  and&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Math]]&lt;br /&gt;
[[Category:Statistics]]&lt;/div&gt;</summary>
		<author><name>Quincunx</name></author>	</entry>

	<entry>
		<id>https://www.explainxkcd.com/wiki/index.php?title=2435:_Geothmetic_Meandian&amp;diff=207501</id>
		<title>2435: Geothmetic Meandian</title>
		<link rel="alternate" type="text/html" href="https://www.explainxkcd.com/wiki/index.php?title=2435:_Geothmetic_Meandian&amp;diff=207501"/>
				<updated>2021-03-11T03:26:15Z</updated>
		
		<summary type="html">&lt;p&gt;Quincunx: Added implementation of Gmdn in R, made a slight rewrite for clarity, and added a note that (1,1,2,3,5) is the beginning of the Fibonacci sequence.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{comic&lt;br /&gt;
| number    = 2435&lt;br /&gt;
| date      = March 10, 2021&lt;br /&gt;
| title     = Geothmetic Meandian&lt;br /&gt;
| image     = geothmetic_meandian.png&lt;br /&gt;
| titletext = Pythagorean means are nice and all, but throwing the median in the pot is really what turns this into random forest statistics: applying every function you can think of, and then gradually dropping the ones that make the result worse.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Explanation==&lt;br /&gt;
{{incomplete|Created by an AVERAGE JOE. Please mention here why this explanation isn't complete. Do NOT delete this tag too soon.}}&lt;br /&gt;
There are a number of different ways to identify the '{{w|average}}' value of a series of values, the most common unweighted methods being the {{w|median}} (take the central value from the ordered list of values if there are an odd number - or the value half-way between the two that straddle the divide between two halves if there are an even number) and the {{w|arithmetic mean}} (add all the numbers up, divide by the number of numbers). The {{w|geometric mean}} is less well known to the layman but works with multiplication and Nth-rooting, useful for some statistical analyses.  The geometric mean, arithmetic mean and {{w|harmonic mean}} (not shown) are collectively known as the {{w|Pythagorean means}}.&lt;br /&gt;
&lt;br /&gt;
{{w|Outlier}}s and internal biases within the original sample can make boiling down a set of values into a single 'average' sometimes overly biased by flaws in the data, with your choice of which method to use perhaps resulting in a value that is misleading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Either here or after the next paragraph, demonstrate how (1,1,2,3,5) resolves in each individual method, perhaps? --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this depiction, the three named methods of averaging are embedded within a single function that produces a set of three values - one output for each of the methods. Being a series of values, Randall suggests that this is ideally suited to being ''itself'' subjected to the comparative 'averaging' method. Not just once, but as many times as it takes to narrow down to a set of three values that are very close to one another.&lt;br /&gt;
&lt;br /&gt;
The comment in the title text about suggests that this will save you the trouble of committing to the 'wrong' analysis as it gradually shaves down any 'outlier average' that is unduly affected by anomalies in the original inputs. At first sight it does appear to be a method without any danger of (permanent) divergence of values, but this may need to be proven (or disproven) to be sure.&lt;br /&gt;
&lt;br /&gt;
The title text may also be a sly reference to an actual mathematical theorem, namely that if one performs this procedure only using the arithmetic mean and the harmonic mean, the result will converge to the geometric mean. Randal suggests that the (non-Pythagorean) median, which does not have such good mathematical properties with relation to convergence, is, in fact, the secret sauce in his definition.&lt;br /&gt;
&lt;br /&gt;
There does exist an {{w|arithmetic-geometric mean}}, which is defined identically to this except with the arithmetic and geometric means, and sees some use in calculus.  In some ways it's also philosophically similar to the {{w|truncated mean}} (extremities of the value range, e.g. the highest and lowest 10%s, are ignored as not acceptable and not counted) or {{w|Winsorized mean}} (instead of ignored, the values are readjusted to be the chosen floor/ceiling values that they lay beyond, to still effectively be counted as 'edge' conditions), only with a strange dilution-and-compromise method rather than one where quantities can be culled or neutered just for being unexpectedly different from most of the other data.&lt;br /&gt;
&lt;br /&gt;
The following python code (inefficiently) implements the above algorithm:&lt;br /&gt;
&lt;br /&gt;
    def f(*args):&lt;br /&gt;
        mean = float(sum(args)) / len(args)&lt;br /&gt;
        gmean = reduce(lambda x,y: x*y, args, 1)**(1.0/len(args))&lt;br /&gt;
        args = list(args)&lt;br /&gt;
        args.sort()&lt;br /&gt;
        if len(args) % 2 == 0:&lt;br /&gt;
            median = float(args[len(args) / 2] + args[len(args) / 2 - 1]) / 2&lt;br /&gt;
        else:&lt;br /&gt;
            median = args[len(args) / 2]&lt;br /&gt;
        return mean, gmean, median&lt;br /&gt;
    &lt;br /&gt;
    l0 = [1, 1, 2, 3, 5]&lt;br /&gt;
    &lt;br /&gt;
    l = l0&lt;br /&gt;
    iterations = 0&lt;br /&gt;
    while True:&lt;br /&gt;
        fst = l[0]&lt;br /&gt;
        rest = l[1:]&lt;br /&gt;
        if all((abs(r - fst) &amp;lt; 0.000001 for r in rest)):&lt;br /&gt;
            break&lt;br /&gt;
        l = f(*l)&lt;br /&gt;
        iterations += 1&lt;br /&gt;
    &lt;br /&gt;
    print(l[0], iterations)&lt;br /&gt;
&lt;br /&gt;
And here is an implementation of the Gmdn function in R:&lt;br /&gt;
&lt;br /&gt;
    Gmdn &amp;lt;- function (..., threshold = 1E-6) {&lt;br /&gt;
      # Function F(x) as defined in comic&lt;br /&gt;
      f &amp;lt;- function (x) {&lt;br /&gt;
        n &amp;lt;- length(x)&lt;br /&gt;
        return(c(mean(x), prod(x)^(1/n), median(x)))&lt;br /&gt;
      }&lt;br /&gt;
      # Extract vector of values from ... argument&lt;br /&gt;
      x &amp;lt;- unlist(list(...))&lt;br /&gt;
      # Iterate until the standard deviation of f(x) reaches a threshold&lt;br /&gt;
      while (sd(x) &amp;gt; threshold) x &amp;lt;- f(x)&lt;br /&gt;
      # Return the mean of the final triplet&lt;br /&gt;
      return(mean(x))&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The input sequence of numbers (1,1,2,3,5) chosen by Randall is also the opening of the {{w|Fibonacci sequence}}.  This may have been selected because the ratio of two adjacent numbers in this sequence approaches the [https://en.wikipedia.org/wiki/Golden_ratio#Relationship_to_Fibonacci_sequence golden ratio] as the length of the sequence approaches infinity.&lt;br /&gt;
&lt;br /&gt;
==Transcript==&lt;br /&gt;
{{incomplete transcript|Do NOT delete this tag too soon.}}&lt;br /&gt;
&lt;br /&gt;
F(x1,x2,...xn)=({x1+x2+...+xn/n [bracket: arithmetic mean]},{nx,x2...xn, [bracket: geometric mean]} {x n+1/2 [bracket: median]})&lt;br /&gt;
&lt;br /&gt;
Gmdn(x1,x2,...xn)={F(F(F(...F(x1,x2,...xn)...)))[bracket: geothmetic meandian]}&lt;br /&gt;
&lt;br /&gt;
Gmdn(1,1,2,3,5) [equals about sign] 2.089&lt;br /&gt;
&lt;br /&gt;
Caption: Stats tip: If you aren't sure whether to use the mean, median, or geometric mean, just calculate all three, then repeat until it converges&lt;br /&gt;
&lt;br /&gt;
{{comic discussion}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
For a start, there is a syntax error. After the first application of F, you get a 3-tuple. Subsequent iterations preserve the 3-tuple, and we need to analyze the resulting sequence.&lt;br /&gt;
Perhaps there is an implicit claim all three entries converge to the same result. In any case, lets see what we get:&lt;br /&gt;
&lt;br /&gt;
Wlog, we have three inputs (x_1,y_1,z_1), and want to understand the iterates of the map &lt;br /&gt;
F(x,y,z) = ( (x+y+z)/3, cube root of (xyz), median(x,y,z) ). Lets write F(x_n,y_n,z_n) = (x_{n+1},y_{n+1},z_{n+1}).&lt;br /&gt;
&lt;br /&gt;
The inequality of arithmetic and geometric means gives x_n \geq y_n, if n \geq 2,  and&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Math]]&lt;br /&gt;
[[Category:Statistics]]&lt;/div&gt;</summary>
		<author><name>Quincunx</name></author>	</entry>

	</feed>