<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>John D. Cook</title>
	<atom:link href="http://www.johndcook.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.johndcook.com/blog</link>
	<description>Applied Mathematics Consulting</description>
	<lastBuildDate>Sun, 25 Oct 2026 10:16:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://www.johndcook.com/wp-content/uploads/2020/01/cropped-favicon_512-32x32.png</url>
	<title>John D. Cook</title>
	<link>https://www.johndcook.com/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Computing polar triangles with linear algebra</title>
		<link>https://www.johndcook.com/blog/2026/10/24/computing-polar-triangles/</link>
					<comments>https://www.johndcook.com/blog/2026/10/24/computing-polar-triangles/#respond</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sun, 25 Oct 2026 01:01:55 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Geometry]]></category>
		<category><![CDATA[Linear algebra]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248109</guid>

					<description><![CDATA[<p>The previous post defined the polar triangle of a spherical triangle in terms of its sides and angles, but it doesn&#8217;t construct the triangle. It only specifies one of a family of triangles located anywhere on the sphere. How do we know that polar triangles exist? There is a geometric construction that starts with a [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/24/computing-polar-triangles/">Computing polar triangles with linear algebra</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>The <a href="https://www.johndcook.com/blog/2026/10/24/polar-triangle/">previous post</a> defined the polar triangle of a spherical triangle in terms of its sides and angles, but it doesn&#8217;t construct the triangle. It only specifies one of a family of triangles located anywhere on the sphere.</p>
<p>How do we know that polar triangles exist? There is a geometric construction that starts with a spherical triangle and constructs a unique new spherical triangle, and one can show that this new triangle has the angles and sides described in the previous post.</p>
<p>There is also a linear algebraic construction of polar triangles, and that&#8217;s the topic of this post. In a nutshell, take your sphere to be the unit sphere in 3D. Write the coordinates of each vertex as the columns of a matrix. Invert that matrix and normalize each row. Then the rows are the coordinates of the polar vertices.</p>
<p>This process is an involution: the polar of the polar of a triangle is the original triangle.</p>
<p>The following Python code illustrates the process described above. It begins with a triangle on the globe with vertices <em>A</em>, <em>B</em>, and <em>C</em> at Chicago, Quito, and Paris respectively. It computes the polar triangle, then computes the polar of that, and shows that the result is the original triangle.</p>
<pre>import numpy as np

def latlon_to_cartesian(lat_deg, lon_deg):
    lat = np.radians(lat_deg)
    lon = np.radians(lon_deg)
    x = np.cos(lat) * np.cos(lon)
    y = np.cos(lat) * np.sin(lon)
    z = np.sin(lat)
    return np.array([x, y, z])

def cartesian_to_latlon(v):
    v = v / np.linalg.norm(v)
    lat = np.degrees(np.arcsin(np.clip(v[2], -1, 1)))
    lon = np.degrees(np.arctan2(v[1], v[0]))
    return lat, lon

def polar_triangle(M):
    """
    Polar triangle via matrix inversion.
    M: 3×3 matrix with columns = unit vectors of the original vertices.
    Returns 3×3 matrix whose columns are the polar unit vectors.
    """
    Minv = np.linalg.inv(M)
    # Normalize each row of the inverse (rows are parallel to the polar directions)
    polar_rows = Minv / np.linalg.norm(Minv, axis=1, keepdims=True)
    return polar_rows.T          # columns = polar vertices

# Original vertices (Chicago, Quito, Paris)
A = latlon_to_cartesian(41.85003, -87.65005)
B = latlon_to_cartesian(-0.22985, -78.52495)
C = latlon_to_cartesian(48.85341,  2.3488)

M = np.column_stack([A, B, C])
print("M (columns = original vertices):\n", M)
print("det(M) =", np.linalg.det(M))

# Polar triangle
M_prime = polar_triangle(M)
print("\nM' (columns = polar vertices):\n", M_prime)

print("\nPolar geographic coordinates (lat, lon):")
for name, col in zip(["A'", "B'", "C'"], range(3)):
    print(name, cartesian_to_latlon(M_prime[:, col]))

# Polar of the polar
M_double = polar_triangle(M_prime)
print("\nPolar-of-polar matrix:\n", M_double)
print("max |difference from original M| =",
      np.max(np.abs(M_double - M)))
</pre>The post <a href="https://www.johndcook.com/blog/2026/10/24/computing-polar-triangles/">Computing polar triangles with linear algebra</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/24/computing-polar-triangles/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Duality in spherical trigonometry</title>
		<link>https://www.johndcook.com/blog/2026/10/24/polar-triangle/</link>
					<comments>https://www.johndcook.com/blog/2026/10/24/polar-triangle/#respond</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sun, 25 Oct 2026 00:28:20 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Differential geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248107</guid>

					<description><![CDATA[<p>I&#8217;ve written before about the law of cosines on a sphere: cos(c) = cos(a) cos(b) + sin(a) sin(b) cos(C). But that&#8217;s just one of two laws of cosines on a sphere. The equation above is the law of cosines for sides. The law of cosines for angles is typographically very similar, just inverting the case of [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/24/polar-triangle/">Duality in spherical trigonometry</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve written before about the <a href="https://www.johndcook.com/blog/2022/08/24/law-of-cosines-on-a-sphere/">law of cosines on a sphere</a>:</p>
<p style="padding-left: 40px;">cos(<em>c</em>) = cos(<em>a</em>) cos(<em>b</em>) + sin(<em>a</em>) sin(<em>b</em>) cos(<em>C</em>).</p>
<p>But that&#8217;s just one of two laws of cosines on a sphere. The equation above is the law of cosines <strong>for sides</strong>. The law of cosines <strong>for angles</strong> is typographically very similar, just inverting the case of the letters used as arguments.</p>
<p style="padding-left: 40px;">cos(<em>C</em>) = cos(<em>A</em>) cos(<em>B</em>) + sin(<em>A</em>) sin(<em>B</em>) cos(<em>c</em>).</p>
<p>Incidentally, the law of cosines for sides shows how the sides of a spherical triangle determine the angles. The law of cosines for angles shows how, unlike in the case of plane geometry, angles determine the sides.</p>
<h2>Two kinds of angles</h2>
<p>Let&#8217;s back up and say what the letters refer to. As is conventional in plane geometry, the sides of a triangle are <em>a</em>, <em>b</em>, and <em>c</em>, and the angles are <em>A</em>, <em>B</em>, and <em>C</em>, with <em>a</em> being the side opposite the angle <em>A</em>, and similarly for the other letters.</p>
<p>However, unlike plane geometry, the sides are also angles, but of a different sort. The sides <em>a</em>, <em>b</em>, and <em>c</em> are <strong>central angles</strong>, and the &#8220;angles&#8221; <em>A</em>, <em>B</em>, and <em>C</em> are <strong>dihedral angles</strong>.</p>
<p>The sides are arcs of a great circle. The side <em>a</em>, for example, is a portion of a great circle, running between the vertices at <em>B</em> and <em>C</em> [1]. Think of a plane that contains the center of the sphere <em>O</em> and the vertices <em>B</em> and <em>C</em>. The length of <em>a</em> is the angle at <em>O</em>.</p>
<p>The angles <em>A</em>, <em>B</em>, and <em>C</em> are the angles at which great circles meet. In the formalism of differential geometry, these angles exist in the tangent plane at the vertices. These angles are <strong>intrinsic</strong>, measured along the (tangent plane of) the surface of the sphere. The central angles are <strong>extrinsic</strong>, measured in a plane that cuts through the sphere to its center.</p>
<h2>Polar triangles</h2>
<p>Now because sides are angles and vertices are angles, we can interchange the two kinds of angles to form the <strong>polar triangle</strong> of the original triangle. This is a new triangle whose central angles are the complements of the original dihedral angles, and whose dihedral angles are the complements of the original central angles. In symbols,</p>
<p style="padding-left: 40px;"><em>a</em>′ = π − <em>A</em><br />
<em>b</em>′ = π − <em>B</em><br />
<em>c</em>′ = π − <em>C</em><br />
<em>A</em>′ = π − <em>a</em><br />
<em>B</em>′ = π − <em>b</em><br />
<em>C</em>′ = π − <em>c</em></p>
<p>Now we return to the laws of cosines at the top of the post: the law of cosines for angles is the law of cosines for sides applied to the polar triangle. Every equation in spherical trigonometry has a polar counterpart.</p>
<p>&nbsp;</p>
<p>[1] There&#8217;s some overloaded terminology here, just as in plane geometry. The symbol <em>a</em> is used to denote a side of a triangle and also the length of that side. The symbol <em>A</em> is used to denote both a vertex and the dihedral angle at that vertex.</p>The post <a href="https://www.johndcook.com/blog/2026/10/24/polar-triangle/">Duality in spherical trigonometry</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/24/polar-triangle/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Working around a strange Python problem</title>
		<link>https://www.johndcook.com/blog/2026/10/22/pep-723/</link>
					<comments>https://www.johndcook.com/blog/2026/10/22/pep-723/#respond</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Thu, 22 Oct 2026 15:12:10 +0000</pubDate>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248104</guid>

					<description><![CDATA[<p>A Python script that worked a few days ago wouldn&#8217;t work today. I suspect it might have something to do with my updating everything I could think of in response to recent security breaches. I got an error message that said error: The script contains multiple PEP 723 metadata blocks I searched on what that [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/22/pep-723/">Working around a strange Python problem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>A Python script that worked a few days ago wouldn&#8217;t work today. I suspect it might have something to do with my updating everything I could think of in response to recent security breaches.</p>
<p>I got an error message that said</p>
<pre>error: The script contains multiple PEP 723 metadata blocks</pre>
<p>I searched on what that means, then took out the blank line in my header</p>
<pre>#!/usr/bin/env -S uv run --script

# /// script
# dependencies = ["pyperclip"]
# ///
</pre>
<p>but I still got the same error message.</p>
<p>The script in question copies miscellaneous snippets of text to the clipboard for me. One of those snippets is the header block that uv requires. The script contains the header block marker <code># ///</code>, and that was the source of the problem.</p>
<p>According to Grok</p>
<blockquote><p>The PEP 723 parser is purely textual (it uses a regex that scans the whole file). It does not understand Python syntax, so the <code># ///</code> sequences inside your triple-quoted string are treated as a second metadata block.</p></blockquote>
<p>It suggested changing my quoted string to use <code># / / /</code> and then take out the extra spaces:</p>
<pre>"""#!/usr/bin/env -S uv run --script
# / / / script
# dependencies = ["numpy", "matplotlib"]
# / / /
import numpy as np
import matplotlib.pyplot as plt
""".replace("# / / /", "# ///")
</pre>
<p>This is a dirty hack, but it works.</p>The post <a href="https://www.johndcook.com/blog/2026/10/22/pep-723/">Working around a strange Python problem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/22/pep-723/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How the eMudrha certificate debacle might have happened</title>
		<link>https://www.johndcook.com/blog/2026/10/22/certificate-debacle/</link>
					<comments>https://www.johndcook.com/blog/2026/10/22/certificate-debacle/#respond</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Thu, 22 Oct 2026 14:01:55 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Cryptography]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248100</guid>

					<description><![CDATA[<p>You may have seen references to a password being the number 4. There are countless allusions to this online, but they don&#8217;t give the context. As I mentioned in an earlier post, eMudrha was using the numbers 4, 56, 115, 155, 156, 230, and 237 as secret keys. I haven&#8217;t seen details of how this [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/22/certificate-debacle/">How the eMudrha certificate debacle might have happened</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>You may have seen references to a password being the number 4. There are countless allusions to this online, but they don&#8217;t give the context.</p>
<p>As I mentioned in an <a href="https://www.johndcook.com/blog/2026/10/21/emudhra/">earlier post</a>, eMudrha was using the numbers 4, 56, 115, 155, 156, 230, and 237 as secret keys. I haven&#8217;t seen details of how this happened, but in this post I&#8217;ll give a plausible account of how it <strong>might</strong> have happened, what someone could have done to produce those results. I&#8217;m not trying to do forensic analysis on this specific incident, just exploring what someone might do.</p>
<p>eMudrha was using the NIST elliptic curve P-384, and a secret key should be a random number chosen between 1 and 2<sup>384</sup>. That upper bound isn&#8217;t exactly correct, but it&#8217;s close. See <a href="https://www.johndcook.com/blog/2026/10/22/the-number-of-points-on-an-elliptic-curve/">this post</a> if you want to know the exact number.</p>
<p>Someone might have chosen numbers up to 384 rather than 2<sup>384</sup> out of ignorance. Or they might done so by a typo. Maybe they generated a random value that might have been larger than 2<sup>384</sup> and then intended to reduce the number mod 2<sup>384</sup>, but instead of typing </p>
<pre>% 2**384</pre>
<p>they typed </p>
<pre>% 384</pre>
<p>It seems more likely, however, that somehow someone took one byte of a random value because all the keys are less than 2<sup>8</sup> = 256.</p>
<p>The probability of choosing seven numbers from 1 to 384 and all being less than or equal to 237 is around 0.034. But the same probability for numbers chosen between 1 and 256 is about 0.60.</p>The post <a href="https://www.johndcook.com/blog/2026/10/22/certificate-debacle/">How the eMudrha certificate debacle might have happened</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/22/certificate-debacle/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The number of points on an elliptic curve</title>
		<link>https://www.johndcook.com/blog/2026/10/22/the-number-of-points-on-an-elliptic-curve/</link>
					<comments>https://www.johndcook.com/blog/2026/10/22/the-number-of-points-on-an-elliptic-curve/#respond</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Thu, 22 Oct 2026 11:08:51 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Elliptic curves]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248094</guid>

					<description><![CDATA[<p>An elliptic curve E over a finite field F consists of the set of points (x, y) satisfying the equation y² = x³ + ax + b with x and y in F. Typically in cryptography the field F is the integers mod p where p is a very large prime number. The number of points on E is roughly the number [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/22/the-number-of-points-on-an-elliptic-curve/">The number of points on an elliptic curve</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>An elliptic curve <em>E</em> over a finite field <em>F</em> consists of the set of points (<em>x</em>, <em>y</em>) satisfying the equation</p>
<p style="padding-left: 40px;"><em>y</em>² = <em>x</em>³ + <em>ax</em> + <em>b</em></p>
<p>with <em>x</em> and <em>y</em> in <em>F</em>. Typically in cryptography the field <em>F</em> is the integers mod <em>p</em> where <em>p</em> is a very large prime number.</p>
<p>The number of points on <em>E</em> is roughly the number of elements in <em>F</em>. So for a curve over the integers mod <em>p</em>, the curve has roughly <em>p</em> points.</p>
<p>The next section will give an intuitive argument for why the number of points on <em>E</em> should be roughly the number of elements in <em>F</em>. Then the next section will give a rigorous bound. Then after that we&#8217;ll work through an example.</p>
<h2>Hand-wavy estimate</h2>
<p>For a prime <em>p</em>, half the non-zero integers mod <em>p</em> have a square root and half do not. The ones that do have a square root have two square roots. For example, look at the integers mod 7. The numbers 1, 2, and 4 have square roots but the numbers 3, 5, and 6 do not. Here&#8217;s a little bit of Python to verify this.</p>
<pre>&gt;&gt;&gt; [x**2 % 7 for x in range(1,7)]
[1, 4, 2, 2, 4, 1]
</pre>
<p>Now if we wanted to count the number of solutions to</p>
<p style="padding-left: 40px;"><em>y</em>² = <em>x</em> (mod <em>p</em>)</p>
<p>we&#8217;d find it equals <em>p</em>. That&#8217;s because (0, 0) is a point on the curve, and for (<em>p</em> − 1)/2 values of <em>x</em> there are two values of <em>y</em>, and for the remaining values of <em>x</em> there are no values of <em>y</em>.</p>
<p>To put it another way, if we pick a value of <em>x</em> at random, it will have two square roots or no square roots with roughly equal probability.</p>
<p>Now suppose we pick an <em>x</em> at random and compute <em>x</em>³ + <em>ax</em> + <em>b</em>. We might guess that this process scatters <em>x</em> values in an unbiased way, being no more likely to produce a square than a non-square. Our guess turns out to be approximately correct, though there may be a small bias in favor of squares or non-squares.</p>
<h2>Precise bound</h2>
<p>Hasse&#8217;s theorem gives a precise bound on the number of points on an elliptic curve <em>E</em>. It says</p>
<p style="padding-left: 40px;">#<em>E</em> = <em>p</em> + 1 − <em>t</em></p>
<p>where</p>
<p style="padding-left: 40px;">|<em>t</em>| ≤ 2√<em>p</em>.</p>
<p>So if <em>p</em> is on the order of 2<sup><em>n</em></sup>, the number of points on <em>E</em> is also on the order of 2<sup><em>n</em></sup> because √<em>p</em> is far smaller than <em>p</em>. That&#8217;s all you need to know at a high level. The rest of this post will look at a particular example in full detail.</p>
<h2>Detailed example</h2>
<p>The NIST curve <a href="https://www.johndcook.com/blog/2019/05/11/elliptic-curve-p-384/">P-384</a> has been <a href="https://www.johndcook.com/blog/2026/10/21/emudhra/">in the news</a> lately. For this curve, the based field is integers modulo a 384-bit prime <em>p</em> and so the number of points on the curve is also 384-bit number. Specifically</p>
<p style="padding-left: 40px;"><em>p</em> = 2<sup>384</sup> − 2<sup>128</sup> − 2<sup>96</sup> + 2<sup>32</sup> − 1,</p>
<p>and so we know <em>a priori</em> that the number of points on the curve equals 2<sup>384</sup> plus or minus a factor less than 2<sup>193</sup>.</p>
<p>The number of points on the elliptic curve P-384 is known to be</p>
<p style="padding-left: 40px;"> <em>n</em> = 39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643</p>
<p>See NIST SP 800-186, §3.2.1.4⁠.</p>
<p>We can calculate <em>t</em> at a Python REPL.</p>
<pre>&gt;&gt;&gt; n = 39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643
&gt;&gt;&gt;  p = 2**384 - 2**128 - 2**96 + 2**32 - 1
&gt;&gt;&gt; t = p + 1 - n
&gt;&gt;&gt; t
1388124618062372383606759648309780106643088307173319169677</pre>
<p>The fact that <em>t</em> is positive means the number of points <em>n</em> on our curve is slightly less than <em>p</em>. Here &#8220;slightly&#8221; is relative. The value of <em>p</em> − <em>n</em> is a huge number, but it&#8217;s small relative to <em>p</em>.</p>
<p>We can verify that |<em>t</em>| is less than our <em>a priori</em> bound of 2√<em>p</em>.</p>
<pre>&gt;&gt;&gt; from math import sqrt
&gt;&gt;&gt; t/(2*sqrt(p))
0.11057050503394951
</pre>
<p>So the actual value of <em>t</em> is about nine times smaller than its bound.</p>The post <a href="https://www.johndcook.com/blog/2026/10/22/the-number-of-points-on-an-elliptic-curve/">The number of points on an elliptic curve</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/22/the-number-of-points-on-an-elliptic-curve/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Backdoors, Incompetence, and Elliptic Curves</title>
		<link>https://www.johndcook.com/blog/2026/10/21/emudhra/</link>
					<comments>https://www.johndcook.com/blog/2026/10/21/emudhra/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 21 Oct 2026 15:16:51 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Elliptic curves]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248087</guid>

					<description><![CDATA[<p>The NIST elliptic curves have been in the news twice lately. A few days ago Anthropic posted a paper on the NIST curve seeds that I wrote about here. Now the curves are in the news again, this time over broken certificates. My post a few days ago was about the possibility that the NSA [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/21/emudhra/">Backdoors, Incompetence, and Elliptic Curves</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>The NIST elliptic curves have been in the news twice lately. A few days ago Anthropic posted a paper on the NIST curve seeds that I wrote about <a href="https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/">here</a>. Now the curves are in the news again, this time over broken certificates.</p>
<p>My post a few days ago was about the possibility that the NSA had added a backdoor to the NIST curves. Anthropic researchers showed that this wasn&#8217;t the case. The NSA had not been able to defend how the curve seeds were chosen because they forgot, but researchers from Anthropic were able to reverse engineer the source of the seeds.</p>
<p>So apparently the NIST curves do not have a backdoor, but as with all encryption, the Achilles heel is human error. eMudrha was using the NIST curve <a href="https://www.johndcook.com/blog/2019/05/11/elliptic-curve-p-384/">P-384</a>  with extremely small keys: 4, 56, 115, 155, 156, 230, and 237. To understand why this is a problem, I&#8217;ll briefly describe how elliptic curve cryptography works.</p>
<p>P-384 is an elliptic curve designed by NIST, with input from the NSA, for use in cryptography. The curve has on the order of 2<sup>384</sup> points because the base field is the integers mod</p>
<p style="padding-left: 40px;"><em>p</em> = 2<sup>384</sup> − 2<sup>128</sup> − 2<sup>96</sup> + 2<sup>32</sup> − 1,</p>
<p>a 384-bit prime number. Given a basepoint <em>b</em> on the curve and an exponent <em>e</em>, it is practically impossible to recover <em>e</em> from <em>b</em><sup><em>e</em></sup>. That&#8217;s the discrete logarithm problem [1], the basis for the security of elliptic curve cryptography. If and when cryptographically relevant quantum computers arrive, the discrete logarithm problem will be solvable and elliptic curve cryptography will be broken.</p>
<p>Until the advent of quantum computing, elliptic curve cryptography is presumably safe, unless someone does something negligent, such as using a tiny value of <em>e</em> like 4.</p>
<p>If <em>e</em> is chosen at random from a group with on the order of 2<sup>384</sup> elements, you cannot recover <em>e</em> from <em>b</em><sup><em>e</em></sup> without brute force. But apparently someone said</p>
<p style="padding-left: 40px;">Let&#8217;s see. Is <em>e</em> = 1? Is it 2? Is it 3? Is it 4? Why yes: <em>e</em> = 4.</p>
<p>Ordinarily this would be hopeless. You can&#8217;t just try 2<sup>384</sup> exponents. But someone thought to test whether the keys were horrifically bad, and they were right.</p>
<p>&nbsp;</p>
<p>[1] The exponentiation here is not over the integers, or over the integers mod <em>p</em>. It&#8217;s over the group structure of the elliptic curve, and that is what makes it hard to compute the discrete logarithm.</p>The post <a href="https://www.johndcook.com/blog/2026/10/21/emudhra/">Backdoors, Incompetence, and Elliptic Curves</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/21/emudhra/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Deliberate imperfection</title>
		<link>https://www.johndcook.com/blog/2026/10/21/deliberate-imperfection/</link>
					<comments>https://www.johndcook.com/blog/2026/10/21/deliberate-imperfection/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 21 Oct 2026 12:04:06 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248082</guid>

					<description><![CDATA[<p>I was watching a video by John Higgins this morning about the poem in Ecclesiastes 3, one of the most famous passages in the Bible. There is a time for everything, and a season for every activity under the heavens: a time to be born and a time to die, a time to plant and [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/21/deliberate-imperfection/">Deliberate imperfection</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>I was watching a <a href="https://www.youtube.com/watch?v=Nlj5P-uJu-k">video</a> by John Higgins this morning about the poem in Ecclesiastes 3, one of the most famous passages in the Bible.</p>
<blockquote><p>There is a time for everything,<br />
and a season for every activity under the heavens:</p>
<p>a time to be born and a time to die,<br />
a time to plant and a time to uproot,<br />
a time to kill and a time to heal,<br />
a time to tear down and a time to build,<br />
a time to weep and a time to laugh,<br />
a time to mourn and a time to dance,<br />
a time to scatter stones and a time to gather them,<br />
a time to embrace and a time to refrain from embracing,<br />
a time to search and a time to give up,<br />
a time to keep and a time to throw away,<br />
a time to tear and a time to mend,<br />
a time to be silent and a time to speak,<br />
a time to love and a time to hate,<br />
a time for war and a time for peace.</p></blockquote>
<p>The poem has a great deal of symmetry, from birth and death to war and peace. It has seven couplets, and the number seven in the Bible is symbolic of perfection. </p>
<p>There is a repeated pattern of groups of four words: a time for X, a time for Y. The rhythm reminds me of Beethoven&#8217;s fifth symphony, especially the third movement [1]. </p>
<p>Higgins points out that there&#8217;s something odd in the middle couplet:</p>
<blockquote><p>a time to scatter stones and a time to gather them,<br />
a time to embrace and a time to refrain from embracing,</p></blockquote>
<p>It breaks the rhythm, at least in English translation, and presumably in the original language. The poem goes from intransitive adjectival infinitives &mdash;to plant, to uproot, etc.&mdash;to transitive&mdash;to gather <em>stones</em>. Also, the two parts of the couplet do not obviously fit together. There&#8217;s a similarity between birth and planting, between killing and tearing down, etc. But what&#8217;s the connection between casting stones and embracing?</p>
<p>Higgins explains that this deliberate symmetry breaking fits the theme of the Ecclesiastes as a whole. There is order to the world, and yet we don&#8217;t have it all figured out. Even when everything mostly makes sense, there&#8217;s something we don&#8217;t understand, like the middle couplet.</p>
<p>[1] This has been called the fate motif. There is an apocryphal story that Beethoven described it as such to his secretary and biographer Anton Schindler. Regardless of whether the story is true, the name stuck. Here&#8217;s the particular part I had in mind.</p>
<p><img decoding="async" src="https://www.johndcook.com/fate_motif_horns.svg" width="506" height="61" alt="Sheet music for Beethoven: Symphony No. 5, Op. 67. Third Movement Horn Theme" class="aligncenter size-medium" /></p>The post <a href="https://www.johndcook.com/blog/2026/10/21/deliberate-imperfection/">Deliberate imperfection</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/21/deliberate-imperfection/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Refactoring factorials</title>
		<link>https://www.johndcook.com/blog/2026/10/19/refactoring-factorials/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 19 Oct 2026 14:55:22 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Number theory]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248079</guid>

					<description><![CDATA[<p>Splitting N! into N factors is trivial. It&#8217;s defined as the product of N integers, the integers 1 through N. Can you still split N! into N factors if you put a minimum size requirement on the factors? You can&#8217;t split 3! into three factors unless one of the factors is 1, but you can split 4! into factors ≥ 2: 4! [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/19/refactoring-factorials/">Refactoring factorials</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>Splitting <em>N</em>! into <em>N</em> factors is trivial. It&#8217;s <em>defined</em> as the product of <em>N</em> integers, the integers 1 through <em>N</em>.</p>
<p>Can you still split <em>N</em>! into <em>N</em> factors if you put a minimum size requirement on the factors?</p>
<p>You can&#8217;t split 3! into three factors unless one of the factors is 1, but you can split 4! into factors ≥ 2:</p>
<p style="padding-left: 40px;">4! = 24 = 2 × 2 × 2 × 3</p>
<p>Define <em>t</em>(<em>N</em>) as the largest number such that <em>N</em>! can be expressed as the product of integers greater than or equal to <em>t</em>(<em>N</em>). So based on the discussion above, <em>t</em>(<em>N</em>) ≥ 1 for all <em>N</em>, <em>t</em>(3) = 1 and <em>t</em>(4) = 2. The <em>t</em>(<em>N</em>) are given in OEIS sequence <a href="https://oeis.org/A034258">A034258</a>.</p>
<p>Last Thursday an <a href="https://pubs.ams.org/MCOM/0000-000-00/S0025-5718-2026-04249-8">article</a> came out proving an asymptotic estimate for <em>t</em>(<em>N</em>). You can find a <a href="https://arxiv.org/abs/2503.20170v4">preprint</a> on arXiv.</p>
<p>An upper bound on <em>t</em>(<em>N</em>) would be the <em>N</em>th root of <em>N</em>! because that would correspond to splitting <em>N</em>! into <em>N</em> factors of equal size. But the <em>N</em>th root of <em>N</em>! will not be an integer for <em>N</em> &gt; 1, so the bound would not be tight.</p>
<p>If we apply Stirling&#8217;s approximation for factorial we get</p>
<p style="padding-left: 40px;"><em>t</em>(<em>N</em>) / <em>N</em> ≤ 1/<em>e</em> + <em>O</em>(log(<em>N</em>) / <em>N</em>).</p>
<p>It was conjectured that for large <em>N</em></p>
<p style="padding-left: 40px;"><em>t</em>(<em>N</em>) / <em>N</em> ∼ 1/<em>e</em> − <em>c</em><sub>0</sub> / log(<em>N</em>)</p>
<p>and the new paper proves</p>
<p style="padding-left: 40px;"><em>t</em>(<em>N</em>) / <em>N</em> ∼ 1/<em>e</em> − <em>c</em><sub>0</sub> / log(<em>N</em>) + <em>O</em>(1 / log<sup>1 + <em>c</em></sup> <em>N</em>).</p>
<p>.</p>The post <a href="https://www.johndcook.com/blog/2026/10/19/refactoring-factorials/">Refactoring factorials</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>A frivolous problem with a deeper lesson</title>
		<link>https://www.johndcook.com/blog/2026/10/19/regex-backtracking/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 19 Oct 2026 12:00:43 +0000</pubDate>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Regular expressions]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248073</guid>

					<description><![CDATA[<p>About 14% of English words can be spelled by stringing together chemical symbols. For example, sarcasm can be written S Ar Ca Sm using the symbols for sulfur, argon, calcium, and samarium. How would you write a program to determine whether a word can be written by stringing together chemical element abbreviations ignoring case? Obviously [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/19/regex-backtracking/">A frivolous problem with a deeper lesson</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>About 14% of English words can be spelled by stringing together chemical symbols. For example, <em>sarcasm</em> can be written</p>
<p style="padding-left: 40px;">S Ar Ca Sm</p>
<p>using the symbols for sulfur, argon, calcium, and samarium.</p>
<p>How would you write a program to determine whether a word can be written by stringing together chemical element abbreviations ignoring case? Obviously this isn&#8217;t a practical problem, but it illustrates a practical problem.</p>
<p>You could solve the problem with a regular expression:</p>
<pre>(h|he|li|be|b|c|n|o|f|ne|na|mg|al|si| … |og)+</pre>
<p>This solution could either be very efficient or very inefficient, depending on the inner workings of the software used to match the regular expression.</p>
<p>A DFA (deterministic finite automata) regular expression engine would find a match, or report failure, linear time, i.e. the execution time would be proportional to the length of the string being matched. A NFA (nondeterministic finite automata) engine that uses backtracking could take exponential time.</p>
<p>The root of the problem is the ambiguity in dividing words into single letters or pairs of letters.</p>
<p>Many two-letter chemical symbols are made of letters that are themselves chemical symbols. For example, the symbol for cobalt, Co, consists of the symbols for carbon, C, and oxygen, O. A traditional NFA regular expression engine uses backtracking and could take exponentially long to test whether the word</p>
<pre>cococo…j</pre>
<p>matches a regular expression for concatenated chemical symbols. If there are <em>n</em> copies of <code>co</code>, the engine would try all 2<sup><em>n</em></sup> possibilities of treating each pair as either <code>co</code> (cobalt) or <code>c o</code> (carbon oxygen).</p>
<p>A DFA regular expression engine always runs in <em>O</em>(<em>n</em>) time, but a (traditional) NFA can take exponential time. So why ever use an NFA engine? Because it can match more advanced patterns such as Perl regular expressions (which are not &#8220;regular&#8221; expressions in the original meaning of the term). Newer NFA engines have added safeguards to eliminate or at least reduce the chance of running into catastrophic backtracking.</p>The post <a href="https://www.johndcook.com/blog/2026/10/19/regex-backtracking/">A frivolous problem with a deeper lesson</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Cloud of suspicion lifted from NIST curves</title>
		<link>https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/</link>
					<comments>https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sat, 17 Oct 2026 15:39:06 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cryptography]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248067</guid>

					<description><![CDATA[<p>NIST published a set of elliptic curves for cryptography in 2000. The seeds for the curves were supplied by the NSA, and cryptographers suspected the agency may have installed backdoors in the curves. And not without reason: the NSA did insert a backdoor in the Dual_EC_DRBG random number generator. Two days ago researchers at Anthropic [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/">Cloud of suspicion lifted from NIST curves</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>NIST published a set of elliptic curves for cryptography in 2000. The seeds for the curves were supplied by the NSA, and cryptographers suspected the agency may have installed backdoors in the curves. And not without reason: the NSA did insert a backdoor in the Dual_EC_DRBG random number generator.</p>
<p>Two days ago researchers at <a href="https://www.anthropic.com/research/ecdsa-curve-origins">Anthropic</a> [1] showed that the NIST curves were not seeded with a backdoor. The rest of this post will give the background necessary to appreciate this result.</p>
<hr />
<p>The security of elliptic curve cryptography depends on the difficult of solving the discrete logarithm problem. In the context of elliptic curve arithmetic, the analog of exponentiation is easy but the analog of taking logarithms is hard.</p>
<p><strong>In general</strong> it&#8217;s not practical to compute discrete logarithms over large elliptic curves. But it could be easy for someone with inside information to compute discrete logarithms if something about the curve was not &#8220;general.&#8221;</p>
<p>Specifically, the NIST curves have the form</p>
<p style="padding-left: 40px;"><em>y</em>² = <em>x</em>³ − 3<em>x</em> + <em>b</em> (mod <em>p</em>)</p>
<p>for various values of <em>p</em> [2], and the suspicion regards the choice of <em>b</em>. For nearly all values of <em>b</em> encryption over the elliptic curve should be secure, as far as we know, but in principle someone could engineer values of <em>b</em> to weaken the encryption.</p>
<p>So where did the <em>b</em>&#8216;s come from? Were they chosen in <a href="https://www.johndcook.com/blog/2019/08/14/good-faith/">good faith</a>?</p>
<p>Concern over the choice of seeds, the <em>b</em>&#8216;s, grew following the Snowden revelations. Daniel J. Bernstein emailed Jerry Solinas of the NSA on September 6, 2014 asking where the seeds had come from. Solinas replied in subsequent emails. He said the seeds were generated by hashing the ASCII representation of a humorous English message, but he could no longer remember the exact message or the precise hashing procedure.</p>
<p>On October 5, 2023 Philippo Valsorda announced a <a href="https://words.filippo.io/seeds-bounty/">bounty</a> for reverse engineering the origin of the NIST elliptic curve seeds. Two days ago researchers from Anthropic claimed the bounty. Valsorda verified the results and awarded the prize. It turns out Solinas found the curve seeds in good faith, but his memory had faded over the years since the curves were published. We now know he used a date, not a phrase, as part of the process of constructing the seeds.</p>
<p>The NIST curves have some nice properties, such as enabling some <a href="https://www.johndcook.com/blog/2019/05/12/nist-primes/">clever tricks</a> for arithmetic in their base fields. But adoption of the curves has been held back over suspicion regarding their origin. Now the curves have been exhonorated. As Valdorda notes</p>
<blockquote><p>… this nicely completes the “rehabilitation arc” of NIST elliptic curve cryptography, which I would now personally recommend over Curve25519/Ed25519/X25519. Just in time for them to be retired in favor of post-quantum signatures.</p></blockquote>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2019/02/21/what-is-an-elliptic-curve/">What is an elliptic curve?</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2025/07/27/moneros-elliptic-curve/">Monero&#8217;s elliptic curve</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2025/08/01/jubjub/">Lewis Carroll and zero knowledge proofs</a></li>
</ul>
<p>[1] This does not imply that LLMs are necessarily a threat to encryption. The search for the NIST seeds required a lot of brute force. Some cleverness was required in order to come up with possibilities to check by brute force, but even that is sorta brute force at a higher level of abstraction. There has been speculation that labs are looking for weaknesses in cryptographic primitives and protocols, but that&#8217;s a different matter than searching for seeds.</p>
<p>[2] The curves P-192, P-224, P-256, P-384, and P-521 are built over the field of integers mod <em>p</em>, where the number of bits in <em>p</em> corresponds to the number in the name. The P-192 curve, for example, has as its base field the integers mod 2<sup>192</sup> − 2<sup>64</sup> − 1, a 192-bit prime.</p>The post <a href="https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/">Cloud of suspicion lifted from NIST curves</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Monoliths and Lagrange Points</title>
		<link>https://www.johndcook.com/blog/2026/10/16/monoliths-and-lagrange-points/</link>
					<comments>https://www.johndcook.com/blog/2026/10/16/monoliths-and-lagrange-points/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Fri, 16 Oct 2026 14:37:07 +0000</pubDate>
				<category><![CDATA[Science]]></category>
		<category><![CDATA[Orbital mechanics]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248050</guid>

					<description><![CDATA[<p>This post began as a thread on X last night. I&#8217;ve edited the thread to turn it into a blog post, making some additions and corrections. I&#8217;m watching 2010: The Year We Make Contact. The movie opens saying the monolith is located at the Lagrange point between Jupiter and Io. I got nerd sniped and [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/16/monoliths-and-lagrange-points/">Monoliths and Lagrange Points</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>This post began as a <a href="https://x.com/JohnDCook/status/2110920086449975499?s=20">thread</a> on X last night. I&#8217;ve edited the thread to turn it into a blog post, making some additions and corrections.</p>
<hr />
<p>I&#8217;m watching <em>2010: The Year We Make Contact</em>. The movie opens saying the monolith is located at the Lagrange point between Jupiter and Io. I got nerd sniped and wondered where that was.</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/2010.jpeg" alt="MISSION ANALYSIS: COMPOSITION OF SECOND MONOLITY ... UNKNOWN. POSITION OF SECOND MONOLITH ... LA GRANGE POINT BETWEEN JUPITER AND IO. POSSITION OF U.S.S. DISCOVERY ... ORBIT AROUND IO. CONDITION OF U.S.S. DISCOVERY ... UNKNOWN." width="500" height="252" /></p>
<p>There are five Lagrange points, but presumably the movie refers to L1 or L2 because these are near Io. Lagrange points L3, L4, and L5 are essentially in the orbit of Io, but 60, 180, and 300 degrees out of phase, all far from Io. (The book says the monolith is at L1.)</p>
<p>Lagrange points L1 and L2 are unstable. Maybe this is a plot hole in the movie, unless there&#8217;s an explanation coming.</p>
<p>(In general L1, L2, and L3 are unstable. If the ratio of the masses is large enough, L4 and L5 will be stable. More on that <a href="https://www.johndcook.com/blog/2021/12/30/stable-lagrange-points/">here</a>. The Lagrange points L4 and L5 are indeed stable for the Jupiter-Io system. For the Sun-Earth system L1 is moderately stable over a short time span, but L1 is far less stable for the Jupiter-Io system.)</p>
<p>Here&#8217;s a plot of the Lagrange points.</p>
<p><img decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/jupiter_io_lagrange.png" width="1000" height="800" /></p>
<p>Note that L1 and L2 are very close to Io, about 10,000 km from the moon. The L1 and L2 Lagrange points for the Earth-Sun system are not so close to Earth.</p>
<p>(That&#8217;s half true. Yes, Io&#8217;s L1 point is closer to it than Earth&#8217;s L1 point, in absolute distance. But in relative terms, Io&#8217;s L1 point is actually further away. I had been misled by seeing an illustration that exaggerated the distance from Earth to L1.)</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2021/12/28/lagrange-points-l1-and-l2/">Finding L1 and L2</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2021/12/30/stable-lagrange-points/">When do two-body systems have stable Lagrange points?</a></li>
</ul>The post <a href="https://www.johndcook.com/blog/2026/10/16/monoliths-and-lagrange-points/">Monoliths and Lagrange Points</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/16/monoliths-and-lagrange-points/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>LaTeX package for Pascal-like triangles</title>
		<link>https://www.johndcook.com/blog/2026/10/14/latex-package-for-pascal-like-triangles/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 14 Oct 2026 17:58:07 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[LaTeX]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248044</guid>

					<description><![CDATA[<p>When I wrote about the harmonic triangle yesterday, I displayed the triangle left-aligned using fixed-width text because that was easier than producing the format you usually see for Pascal&#8217;s triangle and related triangles. 1 1/2 1/2 1/3 1/6 1/3 1/4 1/12 1/12 1/4 1/5 1/20 1/30 1/20 1/5 … I asked Claude to write a [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/14/latex-package-for-pascal-like-triangles/">LaTeX package for Pascal-like triangles</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>When I wrote about the <a href="https://www.johndcook.com/blog/2026/10/13/harmonic-triangle/">harmonic triangle</a> yesterday, I displayed the triangle left-aligned using fixed-width text because that was easier than producing the format you usually see for Pascal&#8217;s triangle and related triangles.</p>
<pre>    1
    1/2  1/2
    1/3  1/6   1/3
    1/4  1/12  1/12  1/4
    1/5  1/20  1/30  1/20  1/5
    …
</pre>
<p>I asked Claude to write a LaTeX package to make it easier to create Pascal-like triangles and it did a great job, including handy features I didn&#8217;t think to ask for. You can download it here: <a href="https://www.johndcook.com/numtriangle.sty">numtriangle.sty</a>.</p>
<p>I used this package to create the more attractive display below.</p>
<p><img decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/leibniz_harmonic_triangle3.svg" width="250" /></p>
<p>Here&#8217;s the LaTeX code that produced the image above.</p>
<pre>\documentclass[border=4pt]{standalone}
\usepackage{numtriangle}
\NewTriangle{\Leibniz}{start=1, edges=1/\n, rule=\L - \P, fractions,
  format=\displaystyle, xsep=2.8em, ysep=2.8em}
\begin{document}
\Leibniz[rows=5]
\end{document}
</pre>
<p>I then compiled the code to an SVG file with the following.</p>
<pre>pdflatex leibniz.pdf
pdftocairo -svg leibniz.pdf leibniz.svg
</pre>
<p><a href="https://www.johndcook.com/blog/2025/04/16/bell-numbers-2/">Bell&#8217;s triangle</a> is not defined in a way that the LaTeX package supports, but I can produce the triangle by listing the content. I made the triangle left-aligned rather than centered just to show that this can be done.</p>
<p><img decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/bell_triangle.svg" width="200" /></p>
<p>The LaTeX code was the following:</p>
<pre>\ListTriangle[shape=left]{
    1; 1, 2; 2, 3, 5; 5, 7, 10, 15; 15, 20, 27, 37, 52}</pre>
<p>Here&#8217;s a particularly photogenic image, Pascal&#8217;s triangle with odd numbers highlighted, showing the <a href="https://www.johndcook.com/blog/2020/06/28/the-ubiquitous-sierpinski/">Sierpiński triangle</a> pattern.</p>
<p><img decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/penski.svg" width="480" /></p>
<p>The code to produce the image:</p>
<pre>\PascalTriangle[rows=16, mod=2, xsep=1.9em, ysep=1.3em,
  cell style={font=\tiny, minimum size=1.2em},
  highlight style={fill=orange!40}]
</pre>The post <a href="https://www.johndcook.com/blog/2026/10/14/latex-package-for-pascal-like-triangles/">LaTeX package for Pascal-like triangles</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>A generalization of the Pythagorean theorem</title>
		<link>https://www.johndcook.com/blog/2026/10/14/pythagorean-variation/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 14 Oct 2026 11:11:11 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248041</guid>

					<description><![CDATA[<p>G. D. Chakerian [1] discovered the following generalization of the Pythagorean theorem. Take any triangle and attach squares to each side. From each triangle vertex, extend a line perpendicular to the opposite side and extend the line through the square, as shown in the figure below. Then the areas of the rectangles with the same [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/14/pythagorean-variation/">A generalization of the Pythagorean theorem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>G. D. Chakerian [1] discovered the following generalization of the Pythagorean theorem.</p>
<p>Take any triangle and attach squares to each side. From each triangle vertex, extend a line perpendicular to the opposite side and extend the line through the square, as shown in the figure below. Then the areas of the rectangles with the same labels are equal.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/chakerian1.png" width="400" height="400" /></p>
<p>It&#8217;s not clear at first why this is a generalization of the Pythagorean theorem, but if we make our triangle closer to a right triangle it&#8217;s easier to see the connection.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/chakerian2.png" width="400" height="400" /></p>
<p>As the angle at B becomes closer to a right angle, the area of the orange triangles labeled II goes to zero. In the limit we&#8217;re left a theorem saying that the areas of the blue and green squares add up to the area of the square attached to the hypotenuse.</p>
<p><strong>Update</strong>: Kirill Osenkov made an interactive version of the figure above <a href="http://livegeometry.com/s/6qtyzrqz">here</a>.</p>
<p>The paper [1] caught my eye because it gives a connection between a geometry problem and a circuit problem, much like <a href="https://www.johndcook.com/blog/2023/07/06/lehmans-inequality-circuits-and-latex/">this post</a>. However, I find the theorem itself more interesting than the connection to circuits.</p>
<p>The first diagram is my reproduction of the first figure from the paper, with color added. I then moved the vertex A to make the connection to the Pythagorean theorem easier to see.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2025/11/13/pythagorean-generalizations/">Four generalizations of the Pythagorean theorem</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2025/02/11/binary-triples/">Sparse binary Pythagorean triples</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2022/11/30/napoleons-theorem/">Napoleon’s theorem</a></li>
</ul>
<p>[1] G. D. Chakerian and M. S. Klamkin. A Generalization of the Pythagorean Theorem Seen as a Problem of Equivalent Resistances. Mathematics Magazine, Vol. 59, No. 3 (Jun., 1986), pp. 149–153.</p>
<p>The first line of the paper is &#8220;The following result (observed several years ago by the first author) may be viewed as a generalization of the Pythagorean Theorem.&#8221; The paper also gives two other sources of the theorem. Presumably Chakerian independently discovered a theorem that was already known.</p>The post <a href="https://www.johndcook.com/blog/2026/10/14/pythagorean-variation/">A generalization of the Pythagorean theorem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Poe, Bessel, and Drones</title>
		<link>https://www.johndcook.com/blog/2026/10/14/poe-bessel-and-drones/</link>
					<comments>https://www.johndcook.com/blog/2026/10/14/poe-bessel-and-drones/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 14 Oct 2026 10:00:22 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Differential equations]]></category>
		<category><![CDATA[Special functions]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248036</guid>

					<description><![CDATA[<p>What&#8217;s a connection between Edgar Allan Poe and Friedrich Wilhelm Bessel? Poe&#8217;s story The Pit and the Pendulum describes a pendulum with a semicircular blade being lowered on a cable. This is an interesting variation on the usual harmonic oscillator because the length L of the pendulum is not constant but rather an increasing function [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/14/poe-bessel-and-drones/">Poe, Bessel, and Drones</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>What&#8217;s a connection between Edgar Allan Poe and Friedrich Wilhelm Bessel?</p>
<p>Poe&#8217;s story The Pit and the Pendulum describes a pendulum with a semicircular blade being lowered on a cable. This is an interesting variation on the usual harmonic oscillator because the length <em>L</em> of the pendulum is not constant but rather an increasing function of time <em>L</em>(<em>t</em>).</p>
<p>Using the <a href="https://www.johndcook.com/blog/2010/07/27/sine-approximation-for-small-x/">small angle</a> approximation sin(θ) ≈ θ, the equation of motion is</p>
<p style="padding-left: 40px;"><em>L</em> θ″ + <em>L</em>′ θ′ + <em>g</em> θ = 0.</p>
<p>If we assume the length is increasing at a constant rate, then with a change of variables described in [1], this differential equation becomes Bessel&#8217;s equation and its solutions are Bessel functions.</p>
<p>The authors of [1] state that their primary interest is whether a pendulum can have the motion that Poe describes. But as they indicate in their opening sentence,</p>
<p style="padding-left: 40px;">The study of the motion of a steadily descending pendulum has practical applications (e.g., to the oscillations of a load being lowered by a crane).</p>
<p>A more recent application would be describing the motion of a package being delivered by a Zipline drone.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2014/07/03/pi-and-the-raven/">Pi and The Raven</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2026/04/25/exact-solution-nonlinear-pendulum/">The nonlinear pendulum equation</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2026/06/06/from-kepler-to-bessel/">From Kepler to Bessel</a></li>
</ul>
<p>[1] Robert L. Borrelli, Courtney S. Coleman, and Dana D. Hobson. Poe&#8217;s Pendulum. Mathematics Magazine, Vol. 58, No. 2 (Mar., 1985), pp. 78–83</p>The post <a href="https://www.johndcook.com/blog/2026/10/14/poe-bessel-and-drones/">Poe, Bessel, and Drones</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/14/poe-bessel-and-drones/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Harmonic triangle</title>
		<link>https://www.johndcook.com/blog/2026/10/13/harmonic-triangle/</link>
					<comments>https://www.johndcook.com/blog/2026/10/13/harmonic-triangle/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Tue, 13 Oct 2026 13:45:18 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Combinatorics]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248028</guid>

					<description><![CDATA[<p>Pascal&#8217;s triangle is the most famous triangular arrangement of numbers. I&#8217;ve written about other numerical triangles, such as Bell&#8217;s triangle and the trinomial triangle. There&#8217;s another well-known triangle that somehow I never heard of until recently: the harmonic triangle, first explored by Leibniz around 1700. To create the harmonic triangle, start with the harmonic series [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/13/harmonic-triangle/">Harmonic triangle</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>Pascal&#8217;s triangle is the most famous triangular arrangement of numbers. I&#8217;ve written about other numerical triangles, such as <a href="https://www.johndcook.com/blog/2025/04/16/bell-numbers-2/">Bell&#8217;s triangle</a> and the <a href="https://www.johndcook.com/blog/2025/05/16/trinomial-coefficients-and-kings/">trinomial triangle</a>. There&#8217;s another well-known triangle that somehow I never heard of until recently: the harmonic triangle, first explored by Leibniz around 1700.</p>
<p>To create the harmonic triangle, start with the harmonic series</p>
<p style="padding-left: 40px;">1, 1/2, 1/3, 1/4, 1/5, …</p>
<p>This is the first column of the triangle. Next take the differences of the terms:</p>
<p style="padding-left: 40px;">(1 − 1/2), (1/2 − 1/3), (1/3 − 1/4), … = 1/2, 1/6, 1/12, …</p>
<p>This, shifted down one space, is the second column of the triangle. Taking differences again gives the third column, and so forth. Column <em>c</em> of the triangle consists of the <em>c</em>th differences of the harmonic series.</p>
<pre>    1
    1/2  1/2
    1/3  1/6   1/3
    1/4  1/12  1/12  1/4
    1/5  1/20  1/30  1/20  1/5
    …
</pre>
<p>Each entry is the difference of the entries to its west and northwest. If we let <em>L</em>(<em>r</em>, <em>c</em>) be the element in the <em>r</em>th row and <em>c</em>th column, then</p>
<p><img loading="lazy" decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/liebniz_harmonic_triangle1.svg" alt="L(r,c) = L(r-1, c-1) - L(r, c - 1)" width="316" height="23" /></p>
<p>Every numerator is 1, though it&#8217;s not immediately obvious why this should be the case. And every number is a value of the beta function, the function that gives the normalizing constant for the beta distribution [1].</p>
<p><img loading="lazy" decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/liebniz_harmonic_triangle2.svg" alt="L(r,c) = \frac{1}{r\binom{r-1}{c-1}} = \beta(c, r-c+1)" width="282" height="59" /></p>
<h2>Related posts</h2>
<ul>
<li class='link'><a href='https://www.johndcook.com/blog/2025/05/31/pascals-ellipse/'>The ellipse hidden inside Pascal’s triangle</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2025/07/24/analogs-of-binomial-coefficients/'>Analogs of binomial coefficients</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2020/02/04/odd-numbers-in-pascals-triangle/'>Odd numbers in Pascal&#8217;s triangle</a></li>
</ul>
<p>[1] Ayoub B. Ayoub. The Harmonic Triangle and the Beta Function. Mathematics Magazine, Vol. 60, No. 4 (Oct., 1987), pp. 223-225</p>The post <a href="https://www.johndcook.com/blog/2026/10/13/harmonic-triangle/">Harmonic triangle</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/13/harmonic-triangle/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Categorical models of logics</title>
		<link>https://www.johndcook.com/blog/2026/10/12/categorical-models-of-logics/</link>
					<comments>https://www.johndcook.com/blog/2026/10/12/categorical-models-of-logics/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 12 Oct 2026 13:04:09 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Category theory]]></category>
		<category><![CDATA[Logic]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248025</guid>

					<description><![CDATA[<p>A few days ago I wrote about topological models of modal logic. If you find general topology more familiar than modal logic, this correspondence could be helpful. If you think the motivation for general topology is evident but the motivation for modal logic is suspect, the correspondence between the two fields might relieve some of [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/12/categorical-models-of-logics/">Categorical models of logics</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>A few days ago I wrote about <a href="https://www.johndcook.com/blog/2026/10/04/topological-models-of-modal-logic/">topological models of modal logic</a>. If you find general topology more familiar than modal logic, this correspondence could be helpful. If you think the motivation for general topology is evident but the motivation for modal logic is suspect, the correspondence between the two fields might relieve some of your suspicion of the latter.</p>
<p>Topological models, however, are quite limited. You can&#8217;t model <a href="https://www.johndcook.com/blog/2026/10/06/godel-lob/">provability logic</a>, for example, by the usual approach to constructing topological models, though there is an alternative construction.</p>
<p>Categorical models are less limited. You can model a wide variety of logics using categories via the Curry-Howard-Lambek correspondence. This may be cold comfort if you find category theory and logic equally mysterious. Even so, there&#8217;s something intriguing about a correspondence between two things you find mysterious.</p>
<p>Categorical semantics is deep and broad, but I&#8217;ll keep this post brief. The correspondence between logic [1] and categories [2] is summarized in the table below.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/curry_howard_lambek.svg" alt="\begin{tabular}{ll} \hline \textbf{Logic} &amp; \textbf{Category theory} \\ \hline Proposition / formula &amp; Object \\ Proof of \(A\) from \(\Gamma\) &amp; Morphism \(\Gamma\to A\) \\ Truth \(\top\) &amp; Terminal object \(1\) \\ Falsehood \(\bot\) &amp; Initial object \(0\) \\ Conjunction \(A\land B\) &amp; Product \(A\times B\) \\ Disjunction \(A\lor B\) &amp; Coproduct \(A+B\) \\ Implication \(A\to B\) &amp; Exponential \(B^A\) \\ Negation \(\neg A\) &amp; Exponential \(0^A\) \\ \hline \end{tabular} " width="355" height="219" /></p>
<p>It&#8217;s interesting how model logic fits into this picture. Axiom K, required by normal modal logics, says</p>
<p><img class='aligncenter' src='https://www.johndcook.com/axiomk.svg' alt='\Box(A\to B)\;\longrightarrow\;(\Box A\to\Box B)' style='background-color:white' height='18' width='234' /></p>
<p>In categorial semantics, this says this says the box operator □ is a functor, mapping objects representing propositions to objects representing propositions, and mapping morphisms representing proofs to mapping morphisms representing proofs.</p>
<h2>Related posts</h2>
<ul>
<li class='link'><a href='https://www.johndcook.com/blog/2026/10/08/privacy-policies-and-modal-logic/'>Modeling policies in modal logic</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2026/05/06/category-mythology/'>The mythology of category theory</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2023/05/22/category-theory-without-categories/'>Category theory without categories</a></li>
</ul>
<p>[1] More precisely, intuitionistic propositional calculus.</p>
<p>[2] More precisely, bicartesian closed categories.</p>The post <a href="https://www.johndcook.com/blog/2026/10/12/categorical-models-of-logics/">Categorical models of logics</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/12/categorical-models-of-logics/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Privacy policies and modal logic</title>
		<link>https://www.johndcook.com/blog/2026/10/08/privacy-policies-and-modal-logic/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Thu, 08 Oct 2026 13:43:02 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Logic]]></category>
		<category><![CDATA[Privacy]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248022</guid>

					<description><![CDATA[<p>If you&#8217;ve followed this blog for a while, you may know that I do a lot of work with data privacy and that I have an interest in modal logic. Recently these two worlds collided: I became aware of work that uses modal logic to reason about data privacy. The story begins with Helen Nissenbaum&#8217;s [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/08/privacy-policies-and-modal-logic/">Privacy policies and modal logic</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>If you&#8217;ve followed this blog for a while, you may know that I do a lot of work with data privacy and that I have an interest in modal logic. Recently these two worlds collided: I became aware of work that uses modal logic to reason about data privacy.</p>
<p>The story begins with Helen Nissenbaum&#8217;s paper <em>Privacy as Contextual Integrity</em> [1]. Rather than simply classifying data as public or private, Nissenbaum looks at norms around the context in which data exists and moves.</p>
<blockquote><p>… the benchmark of privacy is contextual integrity; that in any given situation, a complaint that privacy has been violated is sound in the event that one or the other types of the informational norms has been transgressed.</p></blockquote>
<p>A couple years later Nissenbaum coauthored a paper [2] with three Stanford computer scientists using modal logic, specifically <strong>linear temporal logic</strong> (<strong>LTL</strong>), to reason about contextual integrity. The paper uses four modal operators: the usual box and diamond, plus past tense versions with a minus sign across the middle.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/ltl_operators.png" alt="box, diamond, box minus, diamond minus" width="270" height="92" /></p>
<p>These four operators can be read as &#8220;henceforth&#8221;, &#8220;eventually&#8221;, &#8220;historically&#8221;, and &#8220;once.&#8221;</p>
<p>Henceforth means something will always be true into the future; historically means something was always true in the past.</p>
<p>Eventually means something will happen at some time in the future; once means something occurred at some time in the past.</p>
<p>You could imagine using these operators to formalize statements such as data sharing in some context is permissible (henceforth) if the data subject has (once) signed a consent form.</p>
<p>Understanding simple stand-alone policies does not require the machinery of formal logic, but analyzing large collections of interacting policies may. It may be, for example, that a collection of policies cannot all be satisfied, though this is not obvious from looking at the individual policies. Formalizing policies in the language modal logic makes their analysis amenable to well established algorithms.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2018/10/30/modal-logic-security/">Temporal logic for cybersecurity</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2022/01/21/modal-logic-and-sf/">Modal logic and science fiction</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/data-privacy/">Data privacy consulting</a></li>
</ul>
<p>[1] H. Nissenbaum. Privacy as contextual integrity. Washington Law Review, 79(1):119–158, 2004.</p>
<p>[2] A. Barth, A. Datta, J. C. Mitchell, and H. Nissenbaum, &#8220;Privacy and contextual integrity: Framework and applications,&#8221; in Proc. 2006 IEEE Symp. Security and Privacy (S&amp;P&#8217;06), Berkeley/Oakland, CA, USA, 2006, pp. 184–198, doi: 10.1109/SP.2006.32.</p>The post <a href="https://www.johndcook.com/blog/2026/10/08/privacy-policies-and-modal-logic/">Privacy policies and modal logic</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Consequences of progress toward the Riemann Hypothesis</title>
		<link>https://www.johndcook.com/blog/2026/10/07/consequences-of-qrh/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 07 Oct 2026 22:29:28 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Number theory]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248019</guid>

					<description><![CDATA[<p>The Riemann Hypothesis (RH) is the conjecture that all the zeros of the Riemann zeta function ζ(s) in the critical strip, i.e. the region of the complex plane with real part between 0 and 1, have real part equal to ½. The Quasi Riemann Hypothesis (QRH) says that there exists a constant θ &#60; 1 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/07/consequences-of-qrh/">Consequences of progress toward the Riemann Hypothesis</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>The Riemann Hypothesis (RH) is the conjecture that all the zeros of the Riemann zeta function ζ(<em>s</em>) in the critical strip, i.e. the region of the complex plane with real part between 0 and 1, have real part equal to ½.</p>
<p>The Quasi Riemann Hypothesis (QRH) says that there exists a constant θ &lt; 1 such that no zeros of ζ(<em>s</em>) have real part greater than θ. <a href="https://github.com/openai/math/blob/main/preprints/The-Quasi-Riemann-Hypothesis-September-30-2026/paper.pdf">OpenAI</a> has published a paper claiming QRH with θ = 7/8.</p>
<p>The RH is so important to number theory that even partial results can have big consequences. This post will focus on one consequence: the error term in the Prime Number Theorem.</p>
<p>The Prime Number Theorem says that π(<em>x</em>), the number of primes less than <em>x</em>, is asymptotically equal to Li(<em>x</em>). We&#8217;d like to know more specifically at what rate π(<em>x</em>) approaches Li(<em>x</em>).</p>
<p>The best known result before the QRH announcement was</p>
<p><img loading="lazy" decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/pnt_pre_qrh.svg" alt="\pi(x) = \operatorname{Li}(x) + {\cal O} \left(x \exp\!\left(-c\,\frac{(\log x)^{3/5}}{(\log\log x)^{1/5}}\right)\right) " width="360" height="50" /></p>
<p>If the QRH holds for some θ, such as OpenAI&#8217;s assertion that θ = 7/8,</p>
<p><img loading="lazy" decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/pnt_qrh.svg" alt="\pi(x) = \operatorname{Li}(x) + {\cal O} \left(x^\theta\,\log x\right). " width="238" height="36" /><br />
If RH holds, θ = ½.</p>
<p>Incidentally, you may have seen the Prime Number Theorem stated with <em>x</em>/log(<em>x</em>) rather than Li(<em>x</em>). These two functions are asymptotically equal, so they give the same theorem, if you&#8217;re not interested in quantifying the rate of convergence. The function Li(<em>x</em>) gives better error bounds.</p>The post <a href="https://www.johndcook.com/blog/2026/10/07/consequences-of-qrh/">Consequences of progress toward the Riemann Hypothesis</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Faster Fourier Transform</title>
		<link>https://www.johndcook.com/blog/2026/10/07/faster-fourier-transform/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 07 Oct 2026 21:41:47 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Fourier analysis]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248015</guid>

					<description><![CDATA[<p>The Fast Fourier Transform (FFT) algorithm can compute the discrete Fourier transform of a sequence of length n in time O(n log n). OpenAI recently posted a paper saying there is an algorithm that could compute the discrete Fourier transform in O(n (log n)1 − ε) time for ε = 10−13. This result is amazing. It seemed that [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/07/faster-fourier-transform/">Faster Fourier Transform</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>The Fast Fourier Transform (FFT) algorithm can compute the discrete Fourier transform of a sequence of length <em>n</em> in time</p>
<p style="padding-left: 40px;"><em>O</em>(<em>n</em> log <em>n</em>).</p>
<p><a href="https://github.com/openai/math/blob/main/preprints/An-explicit-power-saving-for-the-exact-discrete-Fourier-transform-September-25-2026/main.pdf">OpenAI</a> recently posted a paper saying there is an algorithm that could compute the discrete Fourier transform in</p>
<p style="padding-left: 40px;"><em>O</em>(<em>n</em> (log <em>n</em>)<sup>1 − ε</sup>)</p>
<p>time for ε = 10<sup>−13</sup>.</p>
<p>This result is amazing. It seemed that <em>O</em>(<em>n</em> log <em>n</em>) was as good as you could do, which it provably is for sorting algorithms.</p>
<p>The result is also of absolutely no practical value, for now. But since the theorem shows that our assumptions were wrong, however slightly, about what is possible, maybe we&#8217;re in for further surprises. Maybe the ε crack will grow. It wouldn&#8217;t be the first time.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2015/09/08/fft-big-data/">The FFT and big data</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2024/02/03/fft-reciprocity/">FFT and quadratic reciprocity</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2023/09/03/dft-numpy-mathematica/">DFT conventions</a></li>
</ul>The post <a href="https://www.johndcook.com/blog/2026/10/07/faster-fourier-transform/">Faster Fourier Transform</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Irrationality exponent of π</title>
		<link>https://www.johndcook.com/blog/2026/10/07/irrationality-exponent-of-pi/</link>
					<comments>https://www.johndcook.com/blog/2026/10/07/irrationality-exponent-of-pi/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 07 Oct 2026 21:19:20 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Number theory]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248013</guid>

					<description><![CDATA[<p>For a real number x, the irrationality index μ(x) is a way of measuring how well x can be approximated by rational numbers. If x is rational, μ(x) = 1. If x is irrational, μ(x) ≥ 2. OpenAI recently published a proof that μ(π) = 2. Almost all real numbers have irrationality exponent 2, so the new result says [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/07/irrationality-exponent-of-pi/">Irrationality exponent of π</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>For a real number <em>x</em>, the irrationality index μ(<em>x</em>) is a way of measuring how well <em>x</em> can be approximated by rational numbers. If <em>x</em> is rational, μ(<em>x</em>) = 1. If <em>x</em> is irrational, μ(<em>x</em>) ≥ 2.</p>
<p><a href="https://github.com/openai/math/tree/main/preprints/The-irrationality-exponent-of-pi-is-2-September-24-2026">OpenAI</a> recently published a proof that μ(π) = 2. Almost all real numbers have irrationality exponent 2, so the new result says π is typical in this regard. There are numbers proven to have irrationality index greater than 2 (more on that below), but π isn&#8217;t one of them.</p>
<p>The irrationality exponent μ(<em>x</em>) is defined as the supremum of the set of values ν such that</p>
<p><img loading="lazy" decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/irrational_exponent.svg" alt="0 &lt; \left| x - \frac{p}{q} \right| &lt; \frac{1}{q^\nu}" width="135" height="48" /></p>
<p>for infinitely many coprime integers <em>p</em> and <em>q</em> with <em>q</em> &gt; 0.</p>
<p>This means that the approximation error for approximating π with a rational number <em>p</em>/<em>q</em> is typically on the order of 1/<em>q</em>², just like most irrational numbers.</p>
<p>There are numbers with higher irrationality exponents. For example, Cahen&#8217;s constant <em>C</em> has irrationality exponent 3. This means <em>C</em> is an irrational number that has infinitely many rational approximations <em>p</em>/<em>q</em> with error less than 1/<em>q</em>³.</p>The post <a href="https://www.johndcook.com/blog/2026/10/07/irrationality-exponent-of-pi/">Irrationality exponent of π</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/07/irrationality-exponent-of-pi/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Lissajous and Bowditch</title>
		<link>https://www.johndcook.com/blog/2026/10/06/lissajous-and-bowditch/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 07 Oct 2026 00:21:52 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[History]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248010</guid>

					<description><![CDATA[<p>I was skimming through David Well&#8217;s book The Penguin Dictionary of Curious and Interesting Geometry and was surprised by this entry: Lissajous figures or Bowditch curves First discussed by Nathaniel Bowditch in 1815, and later by Jules Antoine Lissajous in 1857 … I wrote a couple posts about Lissajous curves years ago, and recently I wrote [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/06/lissajous-and-bowditch/">Lissajous and Bowditch</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>I was skimming through David Well&#8217;s book The Penguin Dictionary of Curious and Interesting Geometry and was surprised by this entry:</p>
<blockquote><p><strong>Lissajous figures</strong> or <strong>Bowditch curves</strong> First discussed by Nathaniel Bowditch in 1815, and later by Jules Antoine Lissajous in 1857 …</p></blockquote>
<p>I wrote a <a href="https://www.johndcook.com/blog/2019/10/08/lissajous-curves-and-knots/">couple</a> <a href="https://www.johndcook.com/blog/2019/10/08/harmonographs/">posts</a> about Lissajous curves years ago, and recently I wrote a <a href="https://www.johndcook.com/blog/2026/09/22/nathaniel-bowditch/">couple</a> <a href="https://www.johndcook.com/blog/2026/09/23/navigation-minimum/">posts</a> about Nathan Bowditch, but I didn&#8217;t realize there was a connection between them.</p>
<p>I asked Claude to pin down Bowditch&#8217;s publication to see whether the curves came up in the course of his work on navigation. Here&#8217;s the answer I got.</p>
<blockquote><p>Bowditch&#8217;s paper was &#8220;On the Motion of a Pendulum Suspended from Two Points,&#8221; published in the Memoirs of the American Academy of Arts and Sciences (Vol. 3, Part 2) in 1815.</p>
<p>He studied a compound pendulum hung from two points (a Y-shaped suspension, sometimes called a Blackburn pendulum). This lets the bob swing at different frequencies in two perpendicular directions, and he worked out mathematically the curves the bob traces. Those curves are what we now call Lissajous figures. Jules Antoine Lissajous studied them independently and much more visibly in 1857, using light beams reflected off vibrating tuning forks, and his name stuck. Because of Bowditch&#8217;s priority, the curves are sometimes called Bowditch curves.</p></blockquote>The post <a href="https://www.johndcook.com/blog/2026/10/06/lissajous-and-bowditch/">Lissajous and Bowditch</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>A topological model for provability logic</title>
		<link>https://www.johndcook.com/blog/2026/10/06/godel-lob/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Tue, 06 Oct 2026 19:46:28 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248000</guid>

					<description><![CDATA[<p>Gödel&#8217;s incompleteness theorem illustrated the need to distinguish between what is true and what is provable. There are true statements that cannot be proven. Let □p denote the assertion that p is provable in Peano arithmetic. The logic with this interpretation for the □ operator is the Gödel-Löb logic, also called provability logic. This is a [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/06/godel-lob/">A topological model for provability logic</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>Gödel&#8217;s incompleteness theorem illustrated the need to distinguish between what is true and what is provable. There are true statements that cannot be proven.</p>
<p>Let □<em>p</em> denote the assertion that <em>p</em> is provable in Peano arithmetic. The logic with this interpretation for the □ operator is the Gödel-Löb logic, also called provability logic. This is a normal modal logic with the additional axiom</p>
<p style="padding-left: 40px;"><span style="font-family: 'STIX Two Math', 'Cambria Math', 'Segoe UI Symbol', 'Noto Sans Math', 'DejaVu Sans', serif; font-style: normal;">□(□<i>p</i> → <i>p</i>) → □<i>p</i>,</span></p>
<p>known as Löb&#8217;s axiom.</p>
<p>A couple days ago I wrote about <a href="https://www.johndcook.com/blog/2026/10/04/topological-models-of-modal-logic/">topological models</a> for modal logic. Is there a topological model for Gödel-Löb logic? There is, but it&#8217;s not quite the same construction as in the previous post.</p>
<p>A topological model of Gödel-Löb logic associates <em>p</em> with a set <em>P</em> and ◇<i>p</i> with the <strong>derived set</strong> of <em>P</em> rather than its closure.</p>
<p>The difference between the closure of <em>P</em> and the derived set of <em>P</em> is subtle, but important to this discussion. The closure of a set <em>P</em> is the union of <em>P</em> and all of its limit points. The derived set of <em>P</em> is the set of limit points of <em>P</em>. The distinction is that not every point of <em>P</em> is necessarily a limit point of <em>P</em>. A point <em>x</em> is a limit point of <em>P</em> if every open set containing <em>x</em> contains a point of <em>P</em> <em>in addition to x itself</em>.</p>
<p>A topological space <em>X</em> that models Gödel-Löb logic must be <strong>scattered</strong>, meaning that every open set must contain an isolated point, a point with no limit points. For example, consider</p>
<p style="padding-left: 40px;"><em>X</em> = {0} ∪ {1, ½, ⅓, ¼, …}</p>
<p>with the topology inherited from the ordinary topology on the real line. Then every point except 0 is isolated, and every open set contains isolated points.</p>
<p>A statement in Gödel-Löb logic is true if its topological interpretation holds for <strong>all</strong> scattered spaces.</p>The post <a href="https://www.johndcook.com/blog/2026/10/06/godel-lob/">A topological model for provability logic</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Miquel&#8217;s pentagon theorem</title>
		<link>https://www.johndcook.com/blog/2026/10/04/miquels-pentagon-theorem/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sun, 04 Oct 2026 12:34:22 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=247975</guid>

					<description><![CDATA[<p>An earlier post presented an elegant plane geometry theorem discovered by the 19th century school teacher Auguste Miquel. This post presents his pentagon theorem. Start with a pentagon. It may be irregular, but it needs to be convex. Extend each of the sides of the pentagon to form a star, then draw give circles, one [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/04/miquels-pentagon-theorem/">Miquel’s pentagon theorem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>An <a href="https://www.johndcook.com/blog/2026/10/03/miquels-pivot-theorem/">earlier post</a> presented an elegant plane geometry theorem discovered by the 19th century school teacher Auguste Miquel. This post presents his pentagon theorem.</p>
<p>Start with a pentagon. It may be irregular, but it needs to be convex.</p>
<p>Extend each of the sides of the pentagon to form a star, then draw give circles, one through each of the triangles formed by a side of the pentagon and a vertex of the star.</p>
<p>The five circles intersect in pairs at ten points: the five vertices of the pentagon and five new points. The five new points lie on a circle.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/miquel_pentagon.png" width="480" height="553" /></p>
<p>The converse of this theorem is known as the five circles theorem.</p>The post <a href="https://www.johndcook.com/blog/2026/10/04/miquels-pentagon-theorem/">Miquel’s pentagon theorem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Topological models of modal logic</title>
		<link>https://www.johndcook.com/blog/2026/10/04/topological-models-of-modal-logic/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sun, 04 Oct 2026 12:25:19 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=247985</guid>

					<description><![CDATA[<p>The previous post discussed a superficial connection between modal logic and topology, that both use the terms regular and normal to indicate added sets of axioms. McKinsey and Tarski developed a deeper connection between modal logic and topology that we&#8217;ll discuss here. Starting with a topological space X and a proposition p, define [[p]] as the set [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/04/topological-models-of-modal-logic/">Topological models of modal logic</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>The <a href="https://www.johndcook.com/blog/2026/10/04/modal-topology/">previous post</a> discussed a superficial connection between modal logic and topology, that both use the terms <em>regular</em> and <em>normal</em> to indicate added sets of axioms. McKinsey and Tarski developed a deeper connection between modal logic and topology that we&#8217;ll discuss here.</p>
<p>Starting with a topological space <em>X</em> and a proposition <em>p</em>, define [[<em>p</em>]] as the set of points in <em>X</em> at which <em>p</em> is true. Define □<em>p</em> to be true at points in the interior of [[<em>p</em>]] and define ◇<em>p</em> to be true on the closure of [[<em>p</em>]].</p>
<p>You could think of □<em>p</em> as the points where <em>p</em> is robustly true. Not only is <em>p</em> true at <em>x</em>, there&#8217;s some wiggle room around <em>x</em>, i.e. an open set, in which <em>p</em> remains true.</p>
<p>You could think of ◇<em>p</em> as the points where we cannot rule out the possibility of <em>p</em> being true using open sets. If ◇<em>p</em> includes <em>x</em>, any open set containing <em>x</em> also contains part of ◇<em>p</em>, though it may also contain points outside of ◇<em>p.</em></p>
<h2>Regularity</h2>
<p>For any topology on <em>X</em>, the logic constructed above is normal. The axiom</p>
<p><img class='aligncenter' src='https://www.johndcook.com/topmodal1.svg' alt='\Diamond p \Leftrightarrow \lnot (\Box \lnot p)' style='background-color:white' height='18' width='121' /></p>
<p>holds because the closure of a set is the complement of the interior of its complement [1].</p>
<p>Note that this is a regularity result for the modal logic, not the topology. The topology could be arbitrary, and not necessarily regular or normal in the topological sense.</p>
<h2>S4</h2>
<p>The logic constructed above also satisfies a couple more axioms. We have</p>
<p><img class='aligncenter' src='https://www.johndcook.com/topmodal2.svg' alt='\Box p \to p' style='background-color:white' height='14' width='64' /></p>
<p>because the interior of a set is a subset of the set, and</p>
<p><img class='aligncenter' src='https://www.johndcook.com/topmodal3.svg' alt='\Box p \to \Box\Box p' style='background-color:white' height='14' width='90' /></p>
<p>because the interior of the interior of a set is simply the interior. This means the modal logic corresponding to a topology satisfies the S4 axioms. You could say S4 is the logic that corresponds to the McKinsey and Tarski logic of all topological spaces.</p>
<h2>More logics and more topologies</h2>
<p>So S4 is the logic that corresponds to <em>all</em> topologies. We could look at more restricted topologies and ask what are their corresponding logics. Or we could start with a modal logic and ask whether there&#8217;s a topology that models that logic.</p>
<p>Interesting logics correspond to badly behaved topological spaces. Familiar topological spaces like the real line correspond to S4.</p>
<h3>Trivial modal logic</h3>
<p>The discrete topology corresponds to the trivial modal logic. All sets are open, and closed, so any set is the same as its interior and its closure. So □<em>p</em> and ◇<em>p</em> reduce to just <em>p</em>.</p>
<h3>S5</h3>
<p>For the indiscrete topology, □<em>p</em> corresponds to a proposition holding everywhere and ◇<em>p</em> corresponds to it holding somewhere. If the topological space has infinitely many points, the corresponding modal logic is S5. [2]</p>
<h3>Between S4 and S5</h3>
<p>The cofinite topology on an infinite set <em>X</em> defines a set <em>U</em> to be open if the complement of <em>U</em> is finite. The McKinsey-Tarski logic of the cofinite topology is somewhere between S4 and S5. You can show that the formula</p>
<p><img class='aligncenter' src='https://www.johndcook.com/topmodal4.svg' alt='p \land \Diamond\Box p \to \Box p' style='background-color:white' height='17' width='126' /></p>
<p>holds, which doesn&#8217;t hold in S4, and the formula</p>
<p><img class='aligncenter' src='https://www.johndcook.com/topmodal5.svg' alt='\Diamond p \to \Box\Diamond p' style='background-color:white' height='17' width='95' /></p>
<p>does not hold, though it must hold in S5.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2022/01/21/modal-logic-and-sf/">Modal logic and science fiction</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2021/12/30/modal-axioms/">Naming and numbering modal logics</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2018/10/30/modal-logic-security/">Modal logic and cybersecurity</a></li>
</ul>
<p>[1] We should also verify that if <em>A</em> ∩ <em>B</em> ⊂ <em>C</em>, then Interior(<em>A</em>) ∩ Interior(<em>B</em>) ⊂ Interior(<em>C</em>).</p>
<p>[2] Propositions can only have a finite number of terms. Having infinite points in the topological space prevents the corresponding logic from proving theorems that don&#8217;t necessarily hold in S5.</p>The post <a href="https://www.johndcook.com/blog/2026/10/04/topological-models-of-modal-logic/">Topological models of modal logic</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Modal logic and topology</title>
		<link>https://www.johndcook.com/blog/2026/10/04/modal-topology/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sun, 04 Oct 2026 12:24:33 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Logic]]></category>
		<category><![CDATA[Topology]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=247977</guid>

					<description><![CDATA[<p>You can&#8217;t say much about modal logic in general. You have to be more specific to get anywhere. You have to choose some axioms. Ideally the axioms you need for your application correspond to a named set of axioms that has been studied before. The situation is similar in point-set topology. You can&#8217;t say very [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/04/modal-topology/">Modal logic and topology</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>You can&#8217;t say much about modal logic in general. You have to be more specific to get anywhere. You have to choose some axioms. Ideally the axioms you need for your application correspond to a named set of axioms that has been studied before.</p>
<p>The situation is similar in point-set topology. You can&#8217;t say very much about a general topological space. You have to specify some separation axioms to get going.</p>
<h2>Bare bones</h2>
<h3>Modal logic</h3>
<p>A modal logic is any set of formulas in the modal language that:</p>
<ol>
<li>contains all propositional tautologies,</li>
<li>is closed under modus ponens, and</li>
<li>is closed under uniform substitution.</li>
</ol>
<p>In particular, this definition requires <em>nothing</em> of the modal operator □ (“box”). You just have propositional logic with a funny symbol added that could mean anything.</p>
<h3>Topology</h3>
<p>A topological space is a set <em>X</em> along with a set of subsets of <em>X</em> called open sets. The empty set and the full space <em>X</em> are open sets. Furthermore, the set of open sets is closed under finite intersections and arbitrary unions.</p>
<p>There&#8217;s not much you can say about topological spaces in general because, for example, the definition includes extreme cases such as the discrete topology (every subset of <em>X</em> is open) and the indiscrete topology (only the empty set and <em>X</em> are open).</p>
<h2>Regular and normal</h2>
<p>Like many areas of mathematics, logic and topology use the terms &#8220;regular&#8221; and &#8220;normal&#8221; to refer to systems with common choices of extra structure.</p>
<h3>Modal logic</h3>
<p>A regular modal logic is a normal modal logic with a second modal operator ◇ (&#8220;diamond&#8221;) that satisfies</p>
<p style="padding-left: 40px;">◇ <em>p</em> ⇔ ¬ (□ ¬ <em>p</em>)</p>
<p>and has the inference rule (<em>p</em> ∧ <em>q</em>) → <em>r</em> implies (□<em>p</em> ∧ □<em>q</em>) → □<em>r.</em></p>
<p>A modal logic is normal if it satisfies the axiom</p>
<p style="padding-left: 40px;">□ (<em>p</em> → <em>q</em>) → (□ <em>p</em> → □ <em>q</em>)</p>
<p>and the inference rule that if <em>p</em> is a theorem, □<em>p</em> is also a theorem.</p>
<h3>Topology</h3>
<p>Topology also uses <em>regular</em> and <em>normal</em> to refer to adding a few axioms.</p>
<p>A regular topological space is one in which you can separate points from closed sets. Given a point <em>x</em> and a closed set <em>F</em> not containing <em>x</em>, there exist disjoint open sets <em>U</em> and <em>V</em> such that <em>x</em> is contained in <em>U</em> and <em>F</em> is contained in <em>V</em>. [1]</p>
<p>A normal topological space is one in which you can separate disjoint closed sets.</p>
<p>For many mathematicians, a metric space is the weakest topology they&#8217;re interested in, and metric spaces are normal. But weaker topologies come up. The Zariski topology in algebraic geometry is not regular, and the weak topology on an infinite dimensional Banach space is regular but not normal.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2022/01/21/modal-logic-and-sf/">Modal logic and science fiction</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2021/12/30/modal-axioms/">Naming and numbering modal logics</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2018/10/30/modal-logic-security/">Modal logic and cybersecurity</a></li>
</ul>
<p>[1] Why do we use <em>F</em> to denote a closed set? It&#8217;s a convention that goes back to the French word <em lang="fr">fermé</em> for &#8220;closed.&#8221;</p>
<p>&nbsp;</p>The post <a href="https://www.johndcook.com/blog/2026/10/04/modal-topology/">Modal logic and topology</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Miquel&#8217;s pivot theorem</title>
		<link>https://www.johndcook.com/blog/2026/10/03/miquels-pivot-theorem/</link>
					<comments>https://www.johndcook.com/blog/2026/10/03/miquels-pivot-theorem/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sat, 03 Oct 2026 22:53:41 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=247973</guid>

					<description><![CDATA[<p>Euclidean geometry dates back at least to Euclid (circa 300 BC), and so you might think it&#8217;s been pretty well picked over by now. And yet people still occasionally discover new plane geometry theorems. Some of these new theorems are complicated, asking question that the ancients would not have asked. But once in a while [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/03/miquels-pivot-theorem/">Miquel’s pivot theorem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>Euclidean geometry dates back at least to Euclid (circa 300 BC), and so you might think it&#8217;s been pretty well picked over by now. And yet people still occasionally discover new plane geometry theorems.</p>
<p>Some of these new theorems are complicated, asking question that the ancients would not have asked. But once in a while someone discovers a gem that the ancients could have appreciated but didn&#8217;t find.</p>
<p>One example is Miquel’s pivot theorem [1]. The theorem was discovered in 1838, which relative to the timeline of Euclidean geometry makes it a recent discovery.</p>
<p>Choose a point on each side of a triangle. Then for each vertex draw a circle through it and the chosen points on the adjacent sides. Miquel&#8217;s theorem says the three circles meet in one point.</p>
<p>Here&#8217;s an example. For a trangle <em>ABC</em>, choose points <em>D</em>, <em>E</em>, and <em>F</em> on each side. The three circles described in the theorem intersect at <em>M</em>.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/miquel1.png" width="480" height="440" /></p>
<p>Now the three points <em>D</em>, <em>E</em>, and <em>F</em> don&#8217;t have to be limited to the sides of the triangle; they can be on the line segment containing the side. Here&#8217;s an example where <em>D</em> is outside the triangle.</p>
<p><img loading="lazy" decoding="async" class="size-medium aligncenter" src="https://www.johndcook.com/miquel2.png" width="480" height="438" /></p>
<p>And here&#8217;s an example where two of the chosen points, <em>D</em> and <em>F</em>, are outside the triangle. The three circles still intersect at one point <em>M</em>.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/miquel3.png" width="480" height="527" /></p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2023/06/18/circle-through-three-points/">Equation of a circle through three points</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2023/01/23/van-aubels-theorem/">Van Aubel&#8217;s theorem</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2026/08/18/big-little-hexagon/">Big little hexagon</a></li>
</ul>
<p>[1] Miquel, Auguste (1838), <span lang="fr">&#8220;Mémoire de Géométrie&#8221;</span>, <span lang="fr">Journal de Mathématiques Pures et Appliquées</span>, 1: 485–487</p>The post <a href="https://www.johndcook.com/blog/2026/10/03/miquels-pivot-theorem/">Miquel’s pivot theorem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/03/miquels-pivot-theorem/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Servers in dawn-dusk orbit</title>
		<link>https://www.johndcook.com/blog/2026/09/25/dawn-dusk-orbit/</link>
					<comments>https://www.johndcook.com/blog/2026/09/25/dawn-dusk-orbit/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Fri, 25 Sep 2026 11:45:31 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Orbital mechanics]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=247956</guid>

					<description><![CDATA[<p>Despite the predictions that no one would ever put build data centers in space, Google is starting on Thursday. Google&#8217;s prototype satellite will be one of 130 payloads on SpaceX&#8217;s Transporter 18 mission on October 1. The server will follow a dawn-dusk orbit, a special case of a sun-synchronous orbit (SSO), following the terminator line [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/09/25/dawn-dusk-orbit/">Servers in dawn-dusk orbit</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>Despite the predictions that no one would ever put build data centers in space, Google is starting on Thursday. Google&#8217;s prototype satellite will be one of 130 payloads on SpaceX&#8217;s Transporter 18 mission on October 1.</p>
<p>The server will follow a dawn-dusk orbit, a special case of a sun-synchronous orbit (SSO), following the terminator line between daylight on dark on the earth below. A dawn-dusk orbit allows the satellite&#8217;s solar panels to stay in nearly continuous daylight, while also being in a relatively inexpensive low earth orbit (LEO). Geostationary orbit (GEO) would allow solar panels to always receive sunlight, but launching a satellite into GEO requires more fuel and so is more expensive.</p>
<p>Another advantage of LEO is that radiation levels are a couple orders of magnitude less than at GEO. Lower radiation means electronics do not need to be as hardened against radiation.</p>
<p>A dawn-dusk orbit would not be possible if the earth were perfectly spherical. The earth&#8217;s equatorial bulge makes it possible to design an orbit that precesses once per year. David Hammen explains this in an answer to a <a href="https://space.stackexchange.com/questions/60763/how-to-better-understand-how-dawn-dusk-orbits-work">question</a> on the Space Exploration Stack Exchange site.</p>
<blockquote><p>If the Earth had a spherically distributed gravitational field, a satellite&#8217;s right ascension of ascending node would be constant. … Fortunately, the Earth&#8217;s gravitational field is not spherical. The Earth&#8217;s rotation results in an equatorial bulge. This equatorial bulge causes RAAN to precess (or recess). …</p>
<p>Sun synchronous orbits are chosen so that RAAN precesses by 360 degrees per year, or a bit less than one degree per day. …</p>
<p>A dawn-dusk satellite is a special case of a sun synchronous orbit. … A dawn-dusk orbit typically does not quite follow the terminator. Following the terminator would require a rather high orbit.</p></blockquote>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2026/02/02/satellites-have-a-lot-of-room/">Satellites have a lot of room</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2025/02/28/max-min-orbital-speed/">Max and min orbital speed</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2024/12/23/starlink-configurations/">Starlink configurations</a></li>
</ul>The post <a href="https://www.johndcook.com/blog/2026/09/25/dawn-dusk-orbit/">Servers in dawn-dusk orbit</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/09/25/dawn-dusk-orbit/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Navigation with only addition, subtraction, and tables</title>
		<link>https://www.johndcook.com/blog/2026/09/23/navigation-minimum/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 23 Sep 2026 14:11:52 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=247950</guid>

					<description><![CDATA[<p>In the novel Carry On, Mr. Bowditch, a sailor asked Nathaniel Bowditch to teach him how to do navigational calculations, but the man only knows how to add and subtract by counting on his fingers. He had not heard of multiplication. Bowditch is surprised, but realizes if he made tables of logs of trig functions, [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/09/23/navigation-minimum/">Navigation with only addition, subtraction, and tables</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>In the novel <em>Carry On, Mr. Bowditch</em>, a sailor asked Nathaniel Bowditch to teach him how to do navigational calculations, but the man only knows how to add and subtract by counting on his fingers. He had not heard of multiplication. Bowditch is surprised, but realizes if he made tables of logs of trig functions, then it would be possible for barely numerate sailors to calculate their position.</p>
<p><em>Carry On, Mr. Bowditch</em> is fiction, but it&#8217;s essentially factual, and so I imagine something like the conversation above did happen. I thought about how this might work, and it would be difficult.</p>
<p>It is true that if someone can add, subtract, and look-up numbers in a table of logarithms, they can effectively multiply. To find the product <em>xy</em>, they would look up the logarithms of <em>x</em> and <em>y</em>, add the results, then use the table in reverse to find what number has a logarithm equal to the sum.</p>
<h2>Difficulties</h2>
<p>But there are a couple difficulties in this imagined scheme. First, every calculation would require a lot of steps, including looking up numbers in multiple tables. It&#8217;s likely someone who cannot multiply also cannot read, so writing down instructions might not be viable. Second, carrying out calculations using tables is usually not simply a matter of looking up numbers; there are other things someone would need to know, such as <a href="https://www.johndcook.com/blog/2024/06/25/trig-tables/">interpolation and range reduction</a>. </p>
<p>Bowditch was trying to train innumerate sailors to do specific calculations, not general mathematics, and so there would be ways to mitigate the problems above. Maybe he could create diagrams that would allow a semi-literate person to carry out an algorithm. The sailor wouldn&#8217;t need to be able to read <em>per se</em>. The instructions could be aids to help him recall memorized steps. The specialized nature of the calculations might also eliminate the need for range reduction and interpolation.</p>
<h2>Tables</h2>
<p>How many tables would be necessary? Someone who understands trigonometry doesn&#8217;t need separate tables for sine and cosines. And they wouldn&#8217;t need a table with entries for all angles. A table of sines for angles between 0 and 45° would be enough. But someone who doesn&#8217;t know multiplication would need more tables and bigger tables. Or they would need instruction in how to get by with less. It would be an interesting trade-off.</p>
<p>The novel mentioned tabulating logs of trig functions. For example, if you need to calculate</p>
<p style="padding-left: 40px;">cos(<em>a</em>) cos(<em>b</em>)</p>
<p>it would be convenient to be able to look up log(cos(<em>a</em>)) and log(cos(<em>b</em>)) rather than look up the cosines and then look up their logs. But you&#8217;d still need to be able to convert</p>
<p style="padding-left: 40px;">log( cos(<em>a</em>) cos(<em>b</em>) )</p>
<p>into</p>
<p style="padding-left: 40px;">cos(<em>a</em>) cos(<em>b</em>).</p>
<p>This would require a table of logarithms, if the user is able to infer exponentials by reading a table in reverse. Otherwise you&#8217;d need a table of exponentials.</p>
<p>In general, you can assume less sophistication from a user by increasing the number of tables. But this also complicates the instructions the user must follow.</p>
<p>To give a specific example, suppose a sailor wanted to calculate his position using the <a href="https://www.johndcook.com/blog/2026/09/21/haversine-law/">law of haversines</a>:</p>
<p style="padding-left: 40px;">hav(<em>c</em>) = hav(<em>a</em> − <em>b</em>) + sin(<em>a</em>) sin(<em>b</em>) hav(<em>C</em>).</p>
<p>A mathematically sophisticated sailor would only need a table of sines to infer <em>c</em> from <em>a</em>, <em>b</em>, and <em>C</em>. He could calculate haversine via</p>
<p style="padding-left: 40px;">hav(θ) = sin²(θ/2),</p>
<p>though inverting hav(<em>c</em>) to solve for <em>c</em> would require calculating a square root, either directly or via a table.</p>
<p>If one were to minimize the amount of sophistication needed by maximizing the use of tables, the algorithm for finding <em>c</em> would be</p>
<ol>
<li>Subtract <em>b</em> from <em>a</em> and look up the haversine of the difference.</li>
<li>Look up log(sin(<em>a</em>)) and log(sin(<em>b</em>)) from one table and log(hav(<em>C</em>)) from another and add the results.</li>
<li>Take the exponential of the result in the previous step using a table of exponentials.</li>
<li>Add the results of steps 1 and 3, and look up the result in a table of inverse haversine values.</li>
</ol>
<p>This would require five tables: sine, log sine, log haversine, exponential, and inverse haversine.</p>
<h2>Condescension</h2>
<p>Bowditch&#8217;s effort to make navigation accessible to the uneducated is an example of condescension in its literal and positive sense. If we say a person is condescending, we imagine an arrogant person who belittles those around him. But condescension literally means coming down to be with someone. Theologians use the word to describe the incarnation of Christ.</p>
<p>Like all scholars, Bowditch wrote for his peers, notably in his English edition of Laplace&#8217;s magnum opus on celestial mechanics. But unlike most scholars, he also devoted years of his life to a making knowledge accessible to uneducated men, culminating in his book <em>The New American Practical Navigator</em>, still in print <a href="https://msi.nga.mil/Publications/APN">here</a> [1].</p>
<h2>Related posts</h2>
<ul>
<li class='link'><a href='https://www.johndcook.com/blog/2024/06/03/using-a-table-of-logarithms/'>Using a table of logarithms</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2024/06/25/trig-tables/'>Using a table of trig functions</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2022/04/10/why-a-slide-rule-works/'>Why a slide rule works</a></li>
</ul>
<p>[1] The book has been updated over the last couple centuries. Obviously the section on GPS, for example, does not date back to Bowditch.</p>The post <a href="https://www.johndcook.com/blog/2026/09/23/navigation-minimum/">Navigation with only addition, subtraction, and tables</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Nathaniel Bowditch</title>
		<link>https://www.johndcook.com/blog/2026/09/22/nathaniel-bowditch/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Tue, 22 Sep 2026 14:01:30 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[History]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[Orbital mechanics]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=247946</guid>

					<description><![CDATA[<p>A couple days ago a friend told me about the book Carry On, Mr. Bowditch, a fictional account of the life of Nathaniel Bowditch (1773–1838). I&#8217;ve been listening to the book on Audible, and apparently it&#8217;s only lightly fictionalized. Bowditch was a self-educated mathematician and astronomer, best known for his book The American Practical Navigator, [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/09/22/nathaniel-bowditch/">Nathaniel Bowditch</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>A couple days ago a friend told me about the book <em>Carry On, Mr. Bowditch</em>, a fictional account of the life of Nathaniel Bowditch (1773–1838). I&#8217;ve been listening to the book on Audible, and apparently it&#8217;s only lightly fictionalized.</p>
<p>Bowditch was a self-educated mathematician and astronomer, best known for his book <em>The American Practical Navigator</em>, first published in 1801. The book has been continually revised over the last two centuries and is still in print, available for <a href="https://msi.nga.mil/Publications/APN">download</a> from the National Geospatial-Intelligence Agency. The latest edition begins with a brief account of Bowditch&#8217;s life, confirming the essential details of the fictional biography.</p>
<p>Two things stand out about Bowditch: his attention to detail and his desire to make ideas accessible. He taught himself Latin in order to read Newton&#8217;s <em>Principia</em> and followed the text so closely that he found a number of errors.</p>
<p>Bowditch&#8217;s navigation book grew out of the numerous corrections he made to error he found in John Hamilton Moore’s <em>The Practical Navigator</em>, the leading navigation text of the time.</p>
<p>At the beginning of the 19th century it was theoretically possible to determine time, and hence longitude, from lunar observation. However, the method required ideal observation conditions and laborious calculation. Bowditch developed a way to make the necessary measurements under more general conditions, and simplified the necessary calculations. According to the biographical preface mentioned above,</p>
<blockquote><p>Bowditch vowed while writing this edition [of his navigation text] to “put down in the book nothing I can’t teach the crew,” and it is said that every member of his crew including the cook could take a lunar observation and plot the ship’s position.</p></blockquote>
<p>After completing <em>The American Practical Navigator</em>, Bowditch began an English translation of Pierre Laplace&#8217;s encyclopedic <em lang="fr">Mecanique Celeste</em>, filling in details to make the work accessible to a wider audience. He was able to translate four out of the five volumes by the end of his life.</p>
<h2>Related posts</h2>
<ul>
<li class='link'><a href='https://www.johndcook.com/blog/2025/12/04/the-navigational-triangle/'>The navigational triangle</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2025/12/04/line-of-position/'>Line of position</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2026/04/14/intersecting-spheres-and-gps/'>Intersecting spheres and GPS</a></li>
</ul>The post <a href="https://www.johndcook.com/blog/2026/09/22/nathaniel-bowditch/">Nathaniel Bowditch</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Haversine law</title>
		<link>https://www.johndcook.com/blog/2026/09/21/haversine-law/</link>
					<comments>https://www.johndcook.com/blog/2026/09/21/haversine-law/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 21 Sep 2026 23:13:22 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Geometry]]></category>
		<category><![CDATA[Navigation]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=247940</guid>

					<description><![CDATA[<p>Suppose you want to solve a triangle. You know two sides and the angle between them. Then you can solve for the third side using the law of cosines. Now suppose you want to solve a big triangle, a triangle on the surface of the earth so large that the curvature of the earth matters. You [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/09/21/haversine-law/">Haversine law</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>Suppose you want to solve a triangle. You know two sides and the angle between them. Then you can solve for the third side using the law of cosines.</p>
<p>Now suppose you want to solve a <strong>big</strong> triangle, a triangle on the surface of the earth so large that the curvature of the earth matters. You can still use the law of cosines, but you&#8217;ll need <a href="https://www.johndcook.com/blog/2022/08/24/law-of-cosines-on-a-sphere/">the spherical law of cosines</a>:</p>
<p style="padding-left: 40px;">cos(<em>c</em>) = cos(<em>a</em>) cos(<em>b</em>) + sin(<em>a</em>) sin(<em>b</em>) cos(<em>C</em>).</p>
<p>If you know the (angular) lengths of sides <em>a</em> and <em>b</em>, and (tangential) angle <em>C</em> between the two sides, you can solve for <em>c</em> by taking the inverse cosine of the right hand side above.</p>
<p>Now suppose you want to solve this big triangle because you&#8217;re a <strong>navigator</strong> on a ship a couple centuries ago, doing calculations by looking up trig functions and inverse trig functions in a table. You&#8217;re interested in triangles that are so big that you have to account for the fact that you&#8217;re living on a sphere. But at the same time, your triangles are still fairly small relative to the size of the globe.</p>
<h2>The problem with the law of cosines</h2>
<p>The numbers <em>a</em> and <em>b</em> will often be fairly small, and so their cosines will be near 1 and their sines are near zero. So the calculation</p>
<p style="padding-left: 40px;">cos(<em>a</em>) cos(<em>b</em>) + sin(<em>a</em>) sin(<em>b</em>) cos(<em>C</em>)</p>
<p>will add a number near 1 and a number near zero. That&#8217;s a problem.</p>
<p>Say you&#8217;re working with five decimal place arithmetic. Then if the second term above is less than 10<sup>−5</sup>, its contribution to the sum gets completely lost in the addition to the first term. If the second term is larger than 10<sup>−5</sup> but still small, its contribution to the sum will be partially lost.</p>
<h2>Law of haversines</h2>
<p>Enter the <a href="https://www.johndcook.com/blog/2009/09/25/how-many-trig-functions/">haversine</a>, defined by</p>
<p style="padding-left: 40px;">hav(θ) = (1 − cos(θ))/2.</p>
<p>The expression 1 − cos θ was called the versine, and so half of the versine is the haversine.</p>
<p>In terms of the haversine, the law of cosines above becomes the law of haversines:</p>
<p style="padding-left: 40px;">hav(<em>c</em>) = hav(<em>a</em> − <em>b</em>) + sin(<em>a</em>) sin(<em>b</em>) hav(<em>C</em>).</p>
<p>Now suppose you have a table of haversines and inverse haversines. The law of haversines requires a little less work: you have one less table lookup, and you trade a product for a subtraction.</p>
<p>But the primary advantage is numerical accuracy: the terms on the right side have roughly the same size.</p>
<h2>Tables</h2>
<p>Note that we&#8217;re assuming the values in your table of haversines have been calculated correctly to the given precision. If you calculated your own values of haversines from the definition above, you&#8217;d lose precision in the subtraction 1 − cos θ, defeating the advantage of the law of haversines [1].</p>
<h2>History</h2>
<p>According to <a href="https://en.wikipedia.org/wiki/Haversine_formula">Wikipedia</a>.</p>
<blockquote><p>The first table of haversines in English was published by James Andrew in 1805, but Florian Cajori credits an earlier use by José de Mendoza y Ríos in 1801. The term <em>haversine</em> was coined in 1835 by James Inman.</p></blockquote>
<h2>Experiments</h2>
<p>I ran some experiments that carried out arithmetic in float16 (11 bits of precision) to approximate what someone might have done by hand. When the difference between <em>a</em> and <em>b</em> was on the order of 1° or 0.1°, the law of cosine method often overflowed: the right-hand side evaluated to something larger than 1 even though theoretically it should be less than 1. The haversine method never overflowed.</p>
<p>The median error for the haversine method was a couple orders of magnitude less than that of the cosine method.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2025/12/01/lewis-clark-geolocation/">Lews &amp; Clark navigation</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2009/09/25/how-many-trig-functions/">How many trig functions are there?</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2025/11/08/heron-on-a-sphere/">Analog of Heron&#8217;s formula for a sphere</a></li>
</ul>
<p>[1] hav(θ) = (1 − cos(θ))/2 = sin²(θ/2). If you calculated hav θ by looking up sin(θ/2) and squaring it, you&#8217;d be doing extra work, but you wouldn&#8217;t have numerical problems.</p>The post <a href="https://www.johndcook.com/blog/2026/09/21/haversine-law/">Haversine law</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/09/21/haversine-law/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
