<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>maths &amp;mdash; Metamagical Themas</title>
    <link>https://writefreely.metamagical.org/tag:maths</link>
    <description>My random thoughts</description>
    <pubDate>Mon, 25 May 2026 02:45:40 +0200</pubDate>
    <item>
      <title>A Risky Visit</title>
      <link>https://writefreely.metamagical.org/a-risky-visit</link>
      <description>&lt;![CDATA[Today I tried to write about the risk of passing the coronavirus when going to visit someone. It looked nice enough and I&#39;m copying an edited version here, using KaTeX instead of the original LaTeX version I wrote. Also, I was experimenting with unicode symbol support, for which I used XeTeX.&#xA;&#xA;I didn&#39;t make up the numbers that appear, but I haven&#39;t included the references either. It is just a simple note with no big pretension.&#xA;&#xA;!--more--&#xA;&#xA;You would like to go and visit your family. But we have an ongoing pandemic ☣ and there are risks. In particular, you risk infecting them.&#xA;&#xA;Given that, is it worthwhile to go?&#xA;&#xA;What Is Reasonable?&#xA;&#xA;What is the acceptable threshold for the probability of passing the virus to your family? Is it one in a thousand? One in a million?&#xA;&#xA;We could first see what we would accept as a reasonable chance. Then, make a rough estimation of what the actual probability is, and see if it is reasonable.&#xA;&#xA;Current Conditions&#xA;&#xA;We assume some facts. You:&#xA;&#xA;Live in Madrid and have gone out / socialized very little. We know that the incidence in Madrid is less than 1%, so $\Pr(\text{infected}) \lesssim 1 \%$.&#xA;Have no symptoms. We know $\Pr(\text{no symptoms} \mid \text{infected}) \lesssim 50 \%$.&#xA;Are going to get a PCR. If the result is negative, we have to consider that it has a false negative rate $= \Pr(\text{negative result} \mid \text{infected}) \lesssim 20 \%$.&#xA;Use mask and hand sanitizer regularly, and keep interpersonal distance. In such cases $\Pr(\text{passing virus} \mid \text{infected}) \lesssim 10 \%$.&#xA;&#xA;Estimating The Probability&#xA;&#xA;Giving the current conditions, we have&#xA;&#xA;$$&#xA;\Pr(\text{infected with no symptoms &amp; PCR negative}) \approx I \times S \times F&#xA;$$&#xA;&#xA;where $I \lesssim 1 \%$ is the incidence, $S \lesssim 50 \%$ the probability of not having symptoms if infected, and $F \approx 20 \%$ the probability of a false negative in the PCR test.&#xA;&#xA;Thus, the probability of passing the virus to your family is&#xA;&#xA;$$&#xA;\begin{align}&#xA;\Pr(\text{passing virus}) &amp; = \Pr(\text{passing virus} \mid \text{infected})\Pr(\text{infected}) \\\\&#xA;&amp; = P \times I \times S \times F \\\\&#xA;&amp; \lesssim 10  \% \times 1 \% \times 50 \% \times 20 \% = 1 / 10000&#xA;\end{align}&#xA;$$&#xA;&#xA;That is, the probability is uaround one in ten thousand/u.&#xA;&#xA;Limitations&#xA;&#xA;What about the chances of you getting infected? Or of indirectly increasing the chances of infecting your family because they would go out more during your visit? And even if you don&#39;t pass the infection, what about the stress for you and your family of living under such threats? How is it going to affect all your interactions and feelings? How much frustration and worry can it all generate?&#xA;&#xA;All those are important considerations too, and they go beyond the mere estimation of the probability of infecting that we did. So this is by no means a full account of all what&#39;s going on. It is just done in the spirit of helping inform the decision by providing some insight to one of the pieces.&#xA;&#xA;And for fun ☺&#xA;&#xA;Appendices&#xA;&#xA;Notation&#xA;&#xA;We write $\Pr(A)$ to represent the probability that the event $A$ has happened, and $\Pr(A \mid B)$ to represent the probability that $A$ has happened given that $B$ has happened.&#xA;&#xA;Deriving Probabilities&#xA;&#xA;When we want to estimate numbers such as $\Pr(\text{infected with no symptoms &amp; PCR negative})$ we use Bayes&#39; theorem:&#xA;&#xA;$$&#xA;\Pr(A \mid B) = \frac{\Pr(B \mid A) \Pr(A)}{\Pr(B)}&#xA;$$&#xA;&#xA;For example, calling ☣ being infected, ⚕ being healthy, 🤒 having symptoms and ☺ having no symptoms, the probability of being infected given that we have no symptoms is&#xA;&#xA;$$&#xA;\begin{align}&#xA;\Pr(☣ \mid ☺) &amp; = \frac{\Pr(☺ \mid ☣) \Pr(☣)}{\Pr(☺)} \\\\&#xA;&amp; = \frac{\Pr(☺ \mid ☣) \Pr(☣)}{\Pr(☺ \mid ☣) \Pr(☣) + \Pr(☺ \mid ⚕) \Pr(⚕)} \\\\&#xA;&amp; \approx \frac{\Pr(☺ \mid ☣) \Pr(☣)}{1 \times \Pr(⚕)} \\\\&#xA;&amp; \approx \Pr(☺ \mid ☣) \Pr(☣)&#xA;\end{align}&#xA;$$&#xA;&#xA;where we have used that $\Pr(☺ \mid ⚕) = 1$ and $\Pr(⚕) \approx 1 \gg \Pr(☣)$.&#xA;&#xA;Finally, when we estimate the joint probability of not having symptoms (☺) and giving a negative result in the PCR, we assume they are independent:&#xA;&#xA;$$&#xA;\Pr(\text{☺ &amp; negative PCR} \mid ☣) = \Pr(☺ \mid ☣) \Pr(\text{negative PCR} \mid ☣)&#xA;$$&#xA;&#xA;#covid #maths]]&gt;</description>
      <content:encoded><![CDATA[<p>Today I tried to write about the risk of passing the coronavirus when going to visit someone. It looked nice enough and I&#39;m copying an edited version here, using KaTeX instead of the original LaTeX version I wrote. Also, I was experimenting with unicode symbol support, for which I used XeTeX.</p>

<p>I didn&#39;t make up the numbers that appear, but I haven&#39;t included the references either. It is just a simple note with no big pretension.</p>



<p>You would like to go and visit your family. But we have an ongoing pandemic ☣ and there are risks. In particular, you risk infecting them.</p>

<p>Given that, is it worthwhile to go?</p>

<h2 id="what-is-reasonable">What Is Reasonable?</h2>

<p>What is the <em>acceptable threshold</em> for the probability of passing the virus to your family? Is it one in a thousand? One in a million?</p>

<p>We could first see what we would accept as a reasonable chance. Then, make a rough estimation of what the actual probability is, and see if it is reasonable.</p>

<h2 id="current-conditions">Current Conditions</h2>

<p>We assume some facts. You:</p>
<ul><li>Live in Madrid and have gone out / socialized very little. We know that the incidence in Madrid is less than 1%, so $\Pr(\text{infected}) \lesssim 1 \%$.</li>
<li>Have no symptoms. We know $\Pr(\text{no symptoms} \mid \text{infected}) \lesssim 50 \%$.</li>
<li>Are going to get a PCR. If the result is negative, we have to consider that it has a false negative rate $= \Pr(\text{negative result} \mid \text{infected}) \lesssim 20 \%$.</li>
<li>Use mask and hand sanitizer regularly, and keep interpersonal distance. In such cases $\Pr(\text{passing virus} \mid \text{infected}) \lesssim 10 \%$.</li></ul>

<h2 id="estimating-the-probability">Estimating The Probability</h2>

<p>Giving the current conditions, we have</p>

<p>$$
\Pr(\text{infected with no symptoms &amp; PCR negative}) \approx I \times S \times F
$$</p>

<p>where $I \lesssim 1 \%$ is the incidence, $S \lesssim 50 \%$ the probability of not having symptoms if infected, and $F \approx 20 \%$ the probability of a false negative in the PCR test.</p>

<p>Thus, the probability of passing the virus to your family is</p>

<p>$$
\begin{align}
\Pr(\text{passing virus}) &amp; = \Pr(\text{passing virus} \mid \text{infected})\Pr(\text{infected}) \\
&amp; = P \times I \times S \times F \\
&amp; \lesssim 10  \% \times 1 \% \times 50 \% \times 20 \% = 1 / 10000
\end{align}
$$</p>

<p>That is, the probability is <u>around one in ten thousand</u>.</p>

<h2 id="limitations">Limitations</h2>

<p>What about the chances of <em>you</em> getting infected? Or of indirectly increasing the chances of infecting your family because they would go out more during your visit? And even if you don&#39;t pass the infection, what about the stress for you and your family of living under such threats? How is it going to affect all your interactions and feelings? How much frustration and worry can it all generate?</p>

<p>All those are important considerations too, and they go beyond the mere estimation of the probability of infecting that we did. So this is by no means a full account of all what&#39;s going on. It is just done in the spirit of helping inform the decision by providing some insight to one of the pieces.</p>

<p>And for fun ☺</p>

<h2 id="appendices">Appendices</h2>

<h3 id="notation">Notation</h3>

<p>We write $\Pr(A)$ to represent the probability that the event $A$ has happened, and $\Pr(A \mid B)$ to represent the probability that $A$ has happened <em>given that</em> $B$ has happened.</p>

<h3 id="deriving-probabilities">Deriving Probabilities</h3>

<p>When we want to estimate numbers such as $\Pr(\text{infected with no symptoms &amp; PCR negative})$ we use Bayes&#39; theorem:</p>

<p>$$
\Pr(A \mid B) = \frac{\Pr(B \mid A) \Pr(A)}{\Pr(B)}
$$</p>

<p>For example, calling ☣ being infected, ⚕ being healthy, 🤒 having symptoms and ☺ having no symptoms, the probability of being infected given that we have no symptoms is</p>

<p>$$
\begin{align}
\Pr(☣ \mid ☺) &amp; = \frac{\Pr(☺ \mid ☣) \Pr(☣)}{\Pr(☺)} \\
&amp; = \frac{\Pr(☺ \mid ☣) \Pr(☣)}{\Pr(☺ \mid ☣) \Pr(☣) + \Pr(☺ \mid ⚕) \Pr(⚕)} \\
&amp; \approx \frac{\Pr(☺ \mid ☣) \Pr(☣)}{1 \times \Pr(⚕)} \\
&amp; \approx \Pr(☺ \mid ☣) \Pr(☣)
\end{align}
$$</p>

<p>where we have used that $\Pr(☺ \mid ⚕) = 1$ and $\Pr(⚕) \approx 1 \gg \Pr(☣)$.</p>

<p>Finally, when we estimate the joint probability of not having symptoms (☺) and giving a negative result in the PCR, we assume they are independent:</p>

<p>$$
\Pr(\text{☺ &amp; negative PCR} \mid ☣) = \Pr(☺ \mid ☣) \Pr(\text{negative PCR} \mid ☣)
$$</p>

<p><a href="https://writefreely.metamagical.org/tag:covid" class="hashtag"><span>#</span><span class="p-category">covid</span></a> <a href="https://writefreely.metamagical.org/tag:maths" class="hashtag"><span>#</span><span class="p-category">maths</span></a></p>
]]></content:encoded>
      <guid>https://writefreely.metamagical.org/a-risky-visit</guid>
      <pubDate>Sun, 13 Sep 2020 00:00:00 +0200</pubDate>
    </item>
    <item>
      <title>John Conway</title>
      <link>https://writefreely.metamagical.org/john-conway</link>
      <description>&lt;![CDATA[span title=&#34;Well, it was two days ago when I began writing this post&#34;A few days ago/span John Conway died because of complications due to the coronavirus disease.&#xA;&#xA;div style=&#34;text-align: center;&#34;&#xA;img src=&#34;https://metamagical.org/blog/images/Gospersglidergun.gif&#34; /&#xA;/div&#xA;&#xA;Many thoughts come to mind related to that.&#xA;&#xA;!--more--&#xA;&#xA;I think about the crazy and broken health system in the US that is helping spread this pandemic. I don&#39;t know exactly how much of it is responsible for the eventual infection of Conway though, but it certainly seems much worse than in basically any other first-world country.&#xA;&#xA;I&#39;m also reminded of when Martin Gardner died 10 years ago. It was shocking news to me, since I had such a big appreciation for him. At the time I wanted to create a game in his honor, but never actually got to do it. And my appreciation for Conway is very similar. Unsurprisingly, they were good friends and collaborators during their lives.&#xA;&#xA;The first time that I learned about Conway was, like many did, through the Game of Life. It was amazing that such complex behavior could emerge from simple rules. It was also playful, and visual. It made you feel how complexity was emerging in front of your own eyes. Despite Conway&#39;s getting upset with it due to becoming so famous because of it, I still think about it very dearly. With time I&#39;ve come to appreciate it even more, and had fun using it as an example in arguments related to evolution -- no need for a designer/god or anything here to get emergent complex behavior!&#xA;&#xA;Of the many other things he did, I particularly like the surreal numbers. When I learned about them I was already familiarized with the hyperreals and nonstandard analysis, which I found fascinating. They felt just right and gave the satisfaction of revisiting old straitjacketed concepts in calculus with a new fresh light. The existence of the hyperreals hinted at the simplicity that can be achieved when looking at things at the right angle, or so it looked to me. After their discovery, a natural question would be, what other similar number systems are there? How far can you go on that game? The answer, by Conway: the surreals. Such beautiful numbers and with such a fitting name. And I also love the fact that his discovery/invention came by studying the game of Go.&#xA;&#xA;Another Conway-related thing I entertained myself with in the past is the doomsday algorithm. It is fun to find out quickly which day of the week any random day is, and also to see the pattern behind. Since I haven&#39;t used it for years, I have forgotten it now though.&#xA;&#xA;Conway has the amusing record of having written one of the shortest papers in history. To me it is one of the many examples that reflects the bright and playful spirit that he was.&#xA;&#xA;A few years ago I read a great article about Conway by Siobhan Roberts in The Guardian. One of the things that surprised me was to know that he had suffered depression in several occasions and that he once even attempted suicide. It is all very human, I think, but my bias told me things like, how can a person like that want to commit suicide? As if being so brilliant would make you necessarily always happy. In a way, knowing that someone of his talent and freshness can host such thoughts makes it more acceptable that one would too.&#xA;&#xA;I like the colorful description that the very Siobhan Roberts gave of him. Conway was &#34;Archimedes, Mick Jagger, Salvador Dali, and Richard Feynman all rolled into one -- a singular mathematician, with a rock star&#39;s charisma, a sly sense of humor, a polymath&#39;s promiscuous curiosity, and a burning desire to explain everything about the world to everyone in it.&#34; It&#39;s sad that such a person leaves us. But, very especially, thanks for all the fun you&#39;ve left us with.&#xA;&#xA;#life #maths]]&gt;</description>
      <content:encoded><![CDATA[<p><span title="Well, it was two days ago when I began writing this post">A few days ago</span> <a href="https://en.wikipedia.org/wiki/John_Horton_Conway">John Conway</a> died because of complications due to the <a href="https://en.wikipedia.org/wiki/Coronavirus_disease_2019">coronavirus disease</a>.</p>

<div style="text-align: center;">
<img src="https://metamagical.org/blog/images/Gospers_glider_gun.gif"/>
</div>

<p>Many thoughts come to mind related to that.</p>



<p>I think about the crazy and broken health system in the US that is helping spread this pandemic. I don&#39;t know exactly how much of it is responsible for the eventual infection of Conway though, but it certainly seems much worse than in basically any other first-world country.</p>

<p>I&#39;m also reminded of when <a href="https://en.wikipedia.org/wiki/Martin_Gardner">Martin Gardner</a> died 10 years ago. It was shocking news to me, since I had such a big appreciation for him. At the time I wanted to create a game in his honor, but never actually got to do it. And my appreciation for Conway is very similar. Unsurprisingly, they were good friends and collaborators during their lives.</p>

<p>The first time that I learned about Conway was, like many did, through the Game of Life. It was amazing that such complex behavior could emerge from simple rules. It was also playful, and visual. It made you feel how complexity was emerging in front of your own eyes. Despite Conway&#39;s getting upset with it due to becoming so famous because of it, I still think about it very dearly. With time I&#39;ve come to appreciate it even more, and had fun using it as an example in arguments related to evolution — no need for a designer/god or anything here to get emergent complex behavior!</p>

<p>Of the many other things he did, I particularly like the surreal numbers. When I learned about them I was already familiarized with the hyperreals and <a href="https://en.wikipedia.org/wiki/Nonstandard_analysis">nonstandard analysis</a>, which I found fascinating. They felt just right and gave the satisfaction of revisiting old straitjacketed concepts in calculus with a new fresh light. The existence of the hyperreals hinted at the simplicity that can be achieved when looking at things at the right angle, or so it looked to me. After their discovery, a natural question would be, what other similar number systems are there? How far can you go on that game? The answer, by Conway: the surreals. Such beautiful numbers and with such a fitting name. And I also love the fact that his discovery/invention came by <a href="https://senseis.xmp.net/?SurrealNumbers">studying the game of Go</a>.</p>

<p>Another Conway-related thing I entertained myself with in the past is the doomsday algorithm. It is fun to find out quickly which day of the week any random day is, and also to see the pattern behind. Since I haven&#39;t used it for years, I have forgotten it now though.</p>

<p>Conway has the amusing record of having written <a href="http://www.wfnmc.org/mc20101.pdf">one</a> of the <a href="https://paperpile.com/blog/shortest-papers/">shortest papers in history</a>. To me it is one of the many examples that reflects the bright and playful spirit that he was.</p>

<p>A few years ago I read a great article about Conway <a href="https://www.theguardian.com/science/2015/jul/23/john-horton-conway-the-most-charismatic-mathematician-in-the-world">by Siobhan Roberts in The Guardian</a>. One of the things that surprised me was to know that he had suffered depression in several occasions and that he once even attempted suicide. It is all very human, I think, but my bias told me things like, how can a person like that want to commit suicide? As if being so brilliant would make you necessarily always happy. In a way, knowing that someone of his talent and freshness can host such thoughts makes it more acceptable that one would too.</p>

<p>I like the colorful description that the very Siobhan Roberts gave of him. Conway was “Archimedes, Mick Jagger, Salvador Dali, and Richard Feynman all rolled into one — a singular mathematician, with a rock star&#39;s charisma, a sly sense of humor, a polymath&#39;s promiscuous curiosity, and a burning desire to explain everything about the world to everyone in it.” It&#39;s sad that such a person leaves us. But, very especially, thanks for all the fun you&#39;ve left us with.</p>

<p><a href="https://writefreely.metamagical.org/tag:life" class="hashtag"><span>#</span><span class="p-category">life</span></a> <a href="https://writefreely.metamagical.org/tag:maths" class="hashtag"><span>#</span><span class="p-category">maths</span></a></p>
]]></content:encoded>
      <guid>https://writefreely.metamagical.org/john-conway</guid>
      <pubDate>Fri, 08 May 2020 00:00:00 +0200</pubDate>
    </item>
    <item>
      <title>Entropy</title>
      <link>https://writefreely.metamagical.org/entropy</link>
      <description>&lt;![CDATA[img src=&#34;https://metamagical.org/blog/images/256px-Entropy-mutual-information-relative-entro.png&#34; height=&#34;180&#34; style=&#34;float: right; margin: 1em;&#34; /Today I was trying to see the relationships between information, entropy), cross entropy, conditional entropy, the Kullback-Leibler divergence and all that fuzz.&#xA;&#xA;As a quick reminder:&#xA;&#xA;Information content (of a random variable): $I(X) = - \log(P(X))$&#xA;Entropy (of a random variable): $H(X) = E[I(X)] = E[- \log(P(X))]$&#xA;Conditional Entropy (of a random variable on another): $H(X|Y) = E{PY}[H(X|Y=y)]$&#xA;Cross Entropy (between two probability distributions): $H(p, q) = Ep[- \log q] = H(p) + D{KL}(p \| q)$&#xA;Kullback-Leibler divergence (from probability distribution $q$ to $p$): $D{KL}(p \| q) = H(p, q) - H(p)$&#xA;&#xA;The Kullback-Leibler divergence is surprisingly useful in many places. For example, it can be something to maximize (its expected value), as a criterion for experimental design. I wish I had known more about it during the time of writing my thesis.&#xA;&#xA;I wish I&#39;d write about the interpretation of $D{KL}$ as a measure of the information gained when one changes from using the probability distribution $q$ to $p$. But if I do, I&#39;ll never click the &#34;Publish&#34; button :) &#xA;&#xA;#diary #maths]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://metamagical.org/blog/images/256px-Entropy-mutual-information-relative-entro.png" height="180" style="float: right; margin: 1em;"/>Today I was trying to see the relationships between <a href="https://en.wikipedia.org/wiki/Information_theory">information</a>, <a href="https://en.wikipedia.org/wiki/Entropy_(information_theory)">entropy</a>, <a href="https://en.wikipedia.org/wiki/Cross_entropy">cross entropy</a>, <a href="https://en.wikipedia.org/wiki/Conditional_entropy">conditional entropy</a>, the <a href="https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence">Kullback-Leibler divergence</a> and all that fuzz.</p>

<p>As a quick reminder:</p>
<ul><li>Information content (of a random variable): $I(X) = – \log(P(X))$</li>
<li>Entropy (of a random variable): $H(X) = E[I(X)] = E[– \log(P(X))]$</li>
<li>Conditional Entropy (of a random variable on another): $H(X|Y) = E<em>{P</em>Y}[H(X|Y=y)]$</li>
<li>Cross Entropy (between two probability distributions): $H(p, q) = E<em>p[– \log q] = H(p) + D</em>{KL}(p | q)$</li>
<li>Kullback-Leibler divergence (from probability distribution $q$ to $p$): $D_{KL}(p | q) = H(p, q) – H(p)$</li></ul>

<p>The Kullback-Leibler divergence is surprisingly useful in many places. For example, it can be something to maximize (its expected value), as a <a href="https://en.wikipedia.org/wiki/Bayesian_experimental_design">criterion for experimental design</a>. I wish I had known more about it during the time of writing <a href="https://metamagical.org/publications/thesis.pdf">my thesis</a>.</p>

<p>I wish I&#39;d write about the interpretation of $D_{KL}$ as a measure of the information gained when one changes from using the probability distribution $q$ to $p$. But if I do, I&#39;ll never click the “Publish” button :)</p>

<p><a href="https://writefreely.metamagical.org/tag:diary" class="hashtag"><span>#</span><span class="p-category">diary</span></a> <a href="https://writefreely.metamagical.org/tag:maths" class="hashtag"><span>#</span><span class="p-category">maths</span></a></p>
]]></content:encoded>
      <guid>https://writefreely.metamagical.org/entropy</guid>
      <pubDate>Sat, 19 Aug 2017 00:00:00 +0200</pubDate>
    </item>
  </channel>
</rss>