<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[John D. Cook Consulting Substack]]></title><description><![CDATA[Highlights from blog posts]]></description><link>https://johndcookconsulting.substack.com</link><image><url>https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png</url><title>John D. Cook Consulting Substack</title><link>https://johndcookconsulting.substack.com</link></image><generator>Substack</generator><lastBuildDate>Mon, 22 Jun 2026 06:41:48 GMT</lastBuildDate><atom:link href="https://johndcookconsulting.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[John D. Cook]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[johndcookconsulting@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[johndcookconsulting@substack.com]]></itunes:email><itunes:name><![CDATA[John Cook]]></itunes:name></itunes:owner><itunes:author><![CDATA[John Cook]]></itunes:author><googleplay:owner><![CDATA[johndcookconsulting@substack.com]]></googleplay:owner><googleplay:email><![CDATA[johndcookconsulting@substack.com]]></googleplay:email><googleplay:author><![CDATA[John Cook]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Partial Fractions and Chess Pieces]]></title><description><![CDATA[Using Lean, Z3, Python, and Claude]]></description><link>https://johndcookconsulting.substack.com/p/partial-fractions-and-chess-pieces</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/partial-fractions-and-chess-pieces</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Sat, 20 Jun 2026 22:24:53 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Cqav!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Partial fractions go by in a blur in a calculus class. They&#8217;re presented as an integration technique, which is entirely appropriate: it&#8217;s good pedagogy to introduce things in the context of an application. But there&#8217;s <a href="https://www.johndcook.com/blog/2026/06/16/partial-fraction-decomposition/">more to partial fractions</a> than integration. </p><p>The theorem that lets you decompose rational functions can be generalized to an abstract setting, then specialized to a theorem about integer fractions. That also is good pedagogy: specific, general, specific.</p><div><hr></div><p>I tried to <a href="https://www.johndcook.com/blog/2026/06/17/rings-with-lean-claude/">formalize</a> a proof of the abstract partial fraction decomposition theorem using Claude. It was a partial success. I managed to get a proof that builds, but it has some sections marked as &#8220;sorry,&#8221; which means the proof is valid modulo a few specific unproven assertions. </p><div><hr></div><p>I&#8217;ve written a couple posts lately about getting an LLM to write Prolog code to solve a chess puzzle. This afternoon I wrote a post generating <a href="https://www.johndcook.com/blog/2026/06/20/z3-python-claude/">Z3/Python</a> code to solve another chess puzzle.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Cqav!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Cqav!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png 424w, https://substackcdn.com/image/fetch/$s_!Cqav!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png 848w, https://substackcdn.com/image/fetch/$s_!Cqav!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png 1272w, https://substackcdn.com/image/fetch/$s_!Cqav!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Cqav!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png" width="400" height="389" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:389,&quot;width&quot;:400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10220,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://johndcookconsulting.substack.com/i/202892599?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Cqav!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png 424w, https://substackcdn.com/image/fetch/$s_!Cqav!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png 848w, https://substackcdn.com/image/fetch/$s_!Cqav!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png 1272w, https://substackcdn.com/image/fetch/$s_!Cqav!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23e95d8b-fe4b-4b7b-a40a-71fd509a9a20_400x389.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p>]]></content:encoded></item><item><title><![CDATA[Pentagonal Numbers]]></title><description><![CDATA[Inspiration from bug fixes]]></description><link>https://johndcookconsulting.substack.com/p/pentagonal-numbers</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/pentagonal-numbers</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Tue, 16 Jun 2026 11:38:10 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>My latest couple posts are ostensibly about pentagonal numbers, but they&#8217;re also about more.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HNGO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HNGO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png 424w, https://substackcdn.com/image/fetch/$s_!HNGO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png 848w, https://substackcdn.com/image/fetch/$s_!HNGO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png 1272w, https://substackcdn.com/image/fetch/$s_!HNGO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HNGO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png" width="500" height="179" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:179,&quot;width&quot;:500,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:27688,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://johndcookconsulting.substack.com/i/202267940?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HNGO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png 424w, https://substackcdn.com/image/fetch/$s_!HNGO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png 848w, https://substackcdn.com/image/fetch/$s_!HNGO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png 1272w, https://substackcdn.com/image/fetch/$s_!HNGO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d0cea1c-d2d0-41d5-89bc-667c0876f94f_500x179.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><p><a href="https://www.johndcook.com/blog/2026/06/15/testing-pentagonal-numbers/">Last night</a> I posted an article about testing whether a number <em>x</em> is a pentagonal number <em>P<sub>n</sub></em>, and if so, how to find the value of <em>n</em>. It&#8217;s not likely anyone will ask you to validate a pentagonal number, but you might learn something useful from the derivation of the algorithm and its implementation.</p><p><a href="https://www.johndcook.com/blog/2026/06/16/three-examples-suffice/">This morning</a> I posted an article about how pentagonal numbers are the difference between two triangular numbers. This isn&#8217;t the most useful observation, but the post illustrates a proof technique that is more generally useful.</p><div><hr></div><p>I got to thinking about pentagonal numbers because someone let me know about an error in an older post. Fixing the error gave me the idea for the posts above.</p><p>Similarly, a typo report led to my post yesterday about formally verifying the equations for converting between quaternion and matrix representations of a rotation.</p>]]></content:encoded></item><item><title><![CDATA[Generating Lean and Prolog with AI]]></title><description><![CDATA[Today I wrote a couple more posts along similar lines as those mentioned in the previous newsletter.]]></description><link>https://johndcookconsulting.substack.com/p/generating-lean-and-prolog-with-ai</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/generating-lean-and-prolog-with-ai</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Mon, 15 Jun 2026 19:49:40 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Today I wrote a couple more posts along similar lines as those mentioned in the previous newsletter.</p><p>I solved another chess puzzle in <a href="https://www.johndcook.com/blog/2026/06/15/writing-prolog-with-chatgpt/">Prolog</a>, this time having ChatGPT generate the code.</p><p>Someone reported a typo in a post I wrote about converting between two representations of a rotation: quaternions and matrices. I used Claude to confirm the typo and generate Lean code to prove that the equations in the updated post are <a href="https://www.johndcook.com/blog/2026/06/15/quaternions-claude-lean/">correct</a>. </p>]]></content:encoded></item><item><title><![CDATA[AI-generated proofs and illegal T-shirts]]></title><description><![CDATA[I did a couple experiments recently seeing how well Claude could general Lean or Prolog proofs.]]></description><link>https://johndcookconsulting.substack.com/p/ai-generated-proofs-and-illegal-t</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/ai-generated-proofs-and-illegal-t</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Sat, 13 Jun 2026 21:09:57 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!RZex!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I did a couple experiments recently seeing how well Claude could general Lean or Prolog proofs. </p><p>I asked Claude to formalize in Lean a calculation from an earlier post computing a sine series coefficient and wrote up the results <a href="http://Formally proving a calculation with Claude and Lean">here</a>. I also asked Claude to generate Prolog to solve a chess puzzle I&#8217;d written about before. Results <a href="https://www.johndcook.com/blog/2026/06/11/prolog-claude/">here</a>.</p><div><hr></div><p>The ongoing brouhaha between Anthropic and the US government over Fable and Mythos is reminiscent of a time when strong encryption was classified as a munition. <a href="https://www.johndcook.com/blog/">This post</a> looks back at the famous &#8220;munitions T-shirt&#8221; containing Perl code for implementing RSA encryption. </p><p>Turning Fable or Mythos into a Perl one-liner would be quite impressive, especially if the result could fit on a T-shirt.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RZex!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RZex!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg 424w, https://substackcdn.com/image/fetch/$s_!RZex!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg 848w, https://substackcdn.com/image/fetch/$s_!RZex!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!RZex!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RZex!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg" width="499" height="574" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:574,&quot;width&quot;:499,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:58869,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://johndcookconsulting.substack.com/i/201915372?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RZex!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg 424w, https://substackcdn.com/image/fetch/$s_!RZex!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg 848w, https://substackcdn.com/image/fetch/$s_!RZex!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!RZex!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c1eb01d-bbf4-4a19-bd36-f98a70da879c_499x574.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p>]]></content:encoded></item><item><title><![CDATA[Pulling on a thread]]></title><description><![CDATA[Gauss, Kepler, Claude, and Lean]]></description><link>https://johndcookconsulting.substack.com/p/pulling-on-a-thread</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/pulling-on-a-thread</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Wed, 10 Jun 2026 23:33:40 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!vbt8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A couple weeks ago I ran across an approximation for the Gaussian function and that turned into a series of nine posts. Or ten. Or eleven, depending on how you count it.</p><p>This morning I wrote the post <a href="https://www.johndcook.com/blog/2026/06/10/pulling-on-a-thread/">Pulling on a thread</a> that explains how a series of nine posts were connected. You could count that post as the 10th in the series.</p><p>This evening I wrote a post on <a href="https://www.johndcook.com/blog/2026/06/10/claude-and-lean/">formally proving</a> a calculation by having Claude generate Lean code. The calculation came from one of the posts alluded to above, so you could count the latest post as the 11th in the series.</p><p>&#8220;Pulling on a thread&#8221; made me think of Arachne from Greek mythology.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vbt8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vbt8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg 424w, https://substackcdn.com/image/fetch/$s_!vbt8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg 848w, https://substackcdn.com/image/fetch/$s_!vbt8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!vbt8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vbt8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg" width="400" height="596" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:596,&quot;width&quot;:400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:132868,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://johndcookconsulting.substack.com/i/201526603?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vbt8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg 424w, https://substackcdn.com/image/fetch/$s_!vbt8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg 848w, https://substackcdn.com/image/fetch/$s_!vbt8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!vbt8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443592b9-9e21-4d83-af18-805591970e20_400x596.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p>]]></content:encoded></item><item><title><![CDATA[Two more ways of solving Kepler's equation]]></title><description><![CDATA[The previous newsletter mentioned solving Kepler&#8217;s equation]]></description><link>https://johndcookconsulting.substack.com/p/two-more-ways-of-solving-keplers</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/two-more-ways-of-solving-keplers</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Sun, 07 Jun 2026 21:49:35 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The previous newsletter mentioned solving Kepler&#8217;s equation </p><p><em>          M</em> = <em>E</em> &#8722; <em>e</em> sin(<em>E</em>)</p><p>using a sine series in <em>M</em>, whose coefficients depend on <em>E</em>. Another way of solving the equation is to find a power series in <em>e</em>, whose coefficients depend on <em>M</em>. The latter approach, due to Lagrange, came first. </p><p>Lagrange&#8217;s method is only good for values of eccentricity <em>e</em> less than about 2/3. For no apparent reason, Lagrange&#8217;s series diverges for larger values of <em>e</em>. This means the solution might work for the orbit of one asteroid but not another. The radius of convergence for Lagrange&#8217;s series is known as the <a href="https://www.johndcook.com/blog/2026/06/07/the-laplace-limit/">Laplace limit</a>.</p><div><hr></div><p>A simpler method of solving Kepler&#8217;s equation, going back to Kepler himself, is to guess a solution, plug it in, take the output as the next guess, and iterate. Kepler said doing this a couple times would be enough, and it is enough, if you don&#8217;t need much accuracy and you&#8217;re not working with highly eccentric orbits. Otherwise you might need a lot of iterations.</p><p>Someone came up with a way of reducing the number of iterations needed, foreshadowing Aitken&#8217;s acceleration method. More on that <a href="https://www.johndcook.com/blog/2026/06/07/aitkin-acceleration-kepler/">here</a>.</p><p>The post ends with links to three series acceleration methods, due to Aitken, Euler, and Cohen.</p><div><hr></div><p>Have a good week.</p><p></p>]]></content:encoded></item><item><title><![CDATA[Kepler, Bessel, and Ed]]></title><description><![CDATA[I&#8217;ve written several posts that were all about the function cos(sin x + x), going off in different directions.]]></description><link>https://johndcookconsulting.substack.com/p/kepler-bessel-and-ed</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/kepler-bessel-and-ed</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Sat, 06 Jun 2026 19:39:02 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I&#8217;ve written several posts that were all about the function cos(sin <em>x</em> + <em>x</em>), going off in different directions. The integral of this function doesn&#8217;t have a closed form in terms of elementary functions, but it can be expressed <a href="https://www.johndcook.com/blog/2026/06/05/mr-bessels-eponymous-functions/">very simply</a> in terms of a Bessel function.</p><p>Bessel functions look completely unmotivated if you start from just the definition. And yet they come up routinely in mechanical engineering, signal processing, combinatorics, etc. </p><p>Mr. Bessel was led to study his eponymous functions because they came up in his work in celestial mechanics. One way they came up was in solving Kepler&#8217;s equation. I mentions this very briefly <a href="https://www.johndcook.com/blog/2026/06/05/mr-bessels-eponymous-functions/">here</a> and go into the detailed calculation <a href="https://www.johndcook.com/blog/2026/06/06/from-kepler-to-bessel/">here</a>.</p><div><hr></div><p>The &#8220;ed&#8221; in the title of the post is not short for Edward. It&#8217;s the ed editor.</p><p>In the early days of computing, computers didn&#8217;t have monitors; they had printers. The commands you typed and the output the computer returned both went to the printer. You could only edit a file one line at a time. </p><p>The line editor ed would let you specify a line number, or a pattern describing several lines, and an action to carry out on the line(s). It would have been challenging to use since you had to hold the context in your head, not look at it on a screen.</p><p>A lot of patterns in command line tools and programming languages go back to ed. This makes ed <a href="https://www.johndcook.com/blog/2026/06/04/the-latin-of-linux/">analogous to Latin</a>, a dead language that gives insight into features in living languages. You could object that ed isn&#8217;t dead, but by that same reasoning you could object that Latin isn&#8217;t dead either. There may be more people who speak Latin today than who edit files with ed.</p><p>The Unix ecosystem may seem cryptic, but it&#8217;s not arbitrary. There are consistent patterns in across tools and languages, and many of these go back to ed or even further. For example, it&#8217;s common for $ to represent the end of a line or the end of a file. Once this was an arbitrary choice, but it wasn&#8217;t arbitrary for subsequent software to follow this convention.</p>]]></content:encoded></item><item><title><![CDATA[Partitions, Permutations, and Trapezoids]]></title><description><![CDATA[I&#8217;ve written a few times lately about the cosine approximation to the Gaussian function.]]></description><link>https://johndcookconsulting.substack.com/p/partitions-permutations-and-trapezoids</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/partitions-permutations-and-trapezoids</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Thu, 04 Jun 2026 19:44:06 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I&#8217;ve written a few times lately about the cosine approximation to the Gaussian function. Today I wrote two more posts that were spinoffs of that approximation.</p><p>The approximation fits well on real axis but the error along the imaginary axis grows doubly exponentially, like exp( exp(<em>x</em>) ). When I looked up the power series for the double exponential function I was surprised that the terms in the series count <a href="https://www.johndcook.com/blog/2026/06/04/partitions-over-permutations/">partitions and permutations</a>.</p><p>The cosine approximation cos(sin(<em>x</em>) + <em>x</em>) is just the kind of function for which the least accurate numerical integration method, the trapezoid rule, actually works <a href="https://www.johndcook.com/blog/2026/06/04/integrating-smooth-periodic-functions/">incredibly well</a>. </p><p>Enjoy.</p><p></p>]]></content:encoded></item><item><title><![CDATA[Online algorithms, PIT, and a Gaussian approximation`]]></title><description><![CDATA[The term &#8220;online&#8221; meant something different before the Internet.]]></description><link>https://johndcookconsulting.substack.com/p/online-algorithms-pit-and-a-gaussian</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/online-algorithms-pit-and-a-gaussian</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Sun, 31 May 2026 17:37:56 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The term &#8220;online&#8221; meant something different before the Internet. In the 1960s, the term &#8220;on-line&#8221; was contrasted to &#8220;off-line&#8221;, meaning that inputs were processed as they were entered. </p><p>The term &#8220;online&#8221; is still used in computer science literature to refer to algorithms that process data in one pass. <a href="https://www.johndcook.com/blog/2026/05/29/online-one-pass-algorithms/">This post</a> looks at online algorithms for computing moments of data and for computing regression coefficients.</p><div><hr></div><p>PIT stands for polynomial identity testing. PIT is useful for far more than checking algebra homework. General computations can be expressed as algebraic circuits, and so proving a polynomial identity can validate a computation. This is widely used in zero-knowledge proofs.</p><p>The Schwartz-Zippel lemma says that if a polynomial identity holds for a set of variables chosen at random from a large finite field, the identity holds with high probability. <a href="https://www.johndcook.com/blog/2026/05/30/schwartz-zippel/">This post</a> fills in the details around that statement.</p><div><hr></div><p>It is sometimes useful to approximate the Gaussian function exp(&#8722;<em>x</em>&#178;) with (1 + cos(<em>x</em>))/2. It&#8217;s a mediocre approximation, and only useful for a small range of <em>x</em>. But if you replace <em>x</em> with <em>x</em> + sin(<em>x</em>) the approximation gets <a href="https://www.johndcook.com/blog/2026/05/31/another-gaussian-approximation/">much better</a>. </p><p>You can see part of the story by comparing power series terms. This shows that the error in the approximation is on the order of the sixth power of <em>x</em>. And yet this isn&#8217;t the full story. The approximation is good over the interval [&#8722;4, 4]. The error at the ends of the interval is a few orders of magnitude smaller than you might expect from looking at the power series. </p><div><hr></div><p>Have fun reading and have a good week.</p>]]></content:encoded></item><item><title><![CDATA[Meta Logo and Metrics]]></title><description><![CDATA[This morning I wrote a post about how to fit a Besace curve, such as the Meta logo.]]></description><link>https://johndcookconsulting.substack.com/p/meta-logo-and-metrics</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/meta-logo-and-metrics</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Thu, 28 May 2026 01:56:11 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This morning I wrote a post about how to fit a Besace curve, such as the <a href="https://www.johndcook.com/blog/2026/05/27/the-meta-logo-and-fitting-besace-curves/">Meta logo</a>. </p><p>Besace curves have two parameters. I show how to find the two parameters given the height and width of the curve, then apply this to the Meta logo.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1Ddo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1Ddo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png 424w, https://substackcdn.com/image/fetch/$s_!1Ddo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png 848w, https://substackcdn.com/image/fetch/$s_!1Ddo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png 1272w, https://substackcdn.com/image/fetch/$s_!1Ddo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1Ddo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png" width="400" height="225" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:225,&quot;width&quot;:400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:48369,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://johndcookconsulting.substack.com/i/199544324?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1Ddo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png 424w, https://substackcdn.com/image/fetch/$s_!1Ddo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png 848w, https://substackcdn.com/image/fetch/$s_!1Ddo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png 1272w, https://substackcdn.com/image/fetch/$s_!1Ddo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78d7d9a5-d810-4de0-8f5f-36815682738e_400x225.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><p>This evening I wrote a post about how to turn Kullback-Leibler divergence into a <a href="https://www.johndcook.com/blog/2026/05/27/jensen-shannon/">metric</a>. In a nutshell, K-L divergence has 2 out of 4 properties of a metric. Symmetrized K-L divergence has 3 out of 4. Jensen-Shannon distance has 4 out of 4.</p><p>Includes an example showing that symmetrized K-L does not satisfy the triangle inequality. The triangle inequality is the rock that every metric wannabe washes up on.</p>]]></content:encoded></item><item><title><![CDATA[IQ spread, real and imaginary parts]]></title><description><![CDATA[Of juries and complex functions]]></description><link>https://johndcookconsulting.substack.com/p/iq-spread-real-and-imaginary-parts</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/iq-spread-real-and-imaginary-parts</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Tue, 26 May 2026 18:12:32 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Today I wrote about the <a href="https://www.johndcook.com/blog/2026/05/26/expected-iq-spread-on-a-jury/">average IQ range</a> on a jury and about <a href="https://www.johndcook.com/blog/2026/05/26/calculating-expected-normal-range/">computing the expected range</a> of normal samples in general.</p><p>Before that I wrote a couple posts on the real and complex parts of an analytic function. The first was about <a href="https://www.johndcook.com/blog/2026/05/23/real-and-imaginary-parts/">harmonic functions and harmonic conjugates</a>. The second was about the <a href="https://www.johndcook.com/blog/2026/05/23/hilbert-transform-as-an-infinite-matrix/">Hilbert transform</a>.</p><p>Enjoy.</p><p></p>]]></content:encoded></item><item><title><![CDATA[Cleaning under the rug]]></title><description><![CDATA[I&#8217;ve written several posts lately about how basic functions are defined.]]></description><link>https://johndcookconsulting.substack.com/p/cleaning-under-the-rug</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/cleaning-under-the-rug</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Sat, 23 May 2026 12:44:54 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I&#8217;ve written several posts lately about how basic functions are defined. My <a href="https://www.johndcook.com/blog/2026/05/22/complex-functions-real-parts/">latest post</a> may be the end of that thread. I just updated the post with some words about how I fell into this rabbit hole and why a find it interesting. Here&#8217;s the concluding paragraph.</p><blockquote><p>I find all this interesting because it&#8217;s an advanced perspective on a questions that are latent in a intro calculus class. What <em>exactly</em> do functions like arccos mean and why where they defined as they were? These are fairly deep and interesting questions that are swept under the rug, and swept there for good reason. A calculus class has to cover an enormous amount of material and there&#8217;s no time to dwell on fine points. Some of my favorite posts look back leisurely on things that go by in a blur when you&#8217;re a student.</p></blockquote><p></p>]]></content:encoded></item><item><title><![CDATA[Couth and Uncouth Functions]]></title><description><![CDATA[In a nutshell, a pair of functions is couth if inversion works like you&#8217;d expect.]]></description><link>https://johndcookconsulting.substack.com/p/couth-and-uncouth-functions</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/couth-and-uncouth-functions</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Thu, 21 May 2026 17:45:18 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In a nutshell, a pair of functions is couth if inversion works like you&#8217;d expect. More specifically, we&#8217;re talking about circular and hyperbolic functions, and a particular expectation.</p><p>The <a href="https://www.johndcook.com/blog/2026/05/21/circular-hyperbolic-rotations/">first post</a> I wrote today was a warmup, giving the connection between circular and hyperbolic functions that establishes the expectation alluded to above. This post is interesting on its own, giving a perspective on functions like sine and hyperbolic sine that you may not have seen before.</p><p>The <a href="https://www.johndcook.com/blog/2026/05/21/couth-and-uncouth-function-pairs/">second post</a> defines what it means for a pair of functions to be couth or uncouth. For example, in both Mathematica and Python (i.e. NumPy) the pair (sin, sinh) is couth and the pair (cos, cosh) is uncouth. </p><p>There are circular and hyperbolic functions that are not defined in NumPy, and whether these functions form couth pairs depends on how to choose to define their inverses.</p>]]></content:encoded></item><item><title><![CDATA[Complex branches]]></title><description><![CDATA[Adding and eliminating complexity]]></description><link>https://johndcookconsulting.substack.com/p/complex-branches</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/complex-branches</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Wed, 20 May 2026 01:24:09 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The function that takes a number <em>x</em> and squares it is not invertible, and yet we often want to invert it anyway. And we can, though we have to make certain choices when we do so. </p><p>For real numbers this is simple: the square root function &#8730;<em>x</em> returns the positive number whose square is <em>x</em>. But things are more complex for complex numbers.</p><p>My <a href="https://www.johndcook.com/blog/2026/05/19/square-root-of-x-squared-minus-one/">latest post</a> looks at two ways of defining the function &#8730;(<em>z</em>&#178; &#8722; 1). The less obvious choice is better. </p><p>The post on &#8730;(<em>z</em>&#178; &#8722; 1) was motivated by <a href="https://www.johndcook.com/blog/2026/05/19/closer-look-at-an-identity/">looking more carefully</a> at an identity from this morning&#8217;s blog post. Extending the identity to all real numbers, let alone to complex numbers, is complicated. But the right definition of &#8730;(<em>z</em>&#178; &#8722; 1) simplifies everything.</p><p>Looking more critically at the identity alluded to above exposes complexity, which leads to more careful choices, which eliminates complexity. This reminds me of the quote attributed to Oliver Wendell Holmes Jr. </p><p>&#8220;I would not give a fig for the simplicity this side of complexity, but I would give my life for the simplicity on the other side of complexity.&#8221;</p><p></p>]]></content:encoded></item><item><title><![CDATA[Hacking an RNG. Hacking an equation.]]></title><description><![CDATA[I&#8217;ve written a couple posts lately about inferring the internal state of an insecure random number generator, letting you predict its future output.]]></description><link>https://johndcookconsulting.substack.com/p/hacking-an-rng-hacking-an-equation</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/hacking-an-rng-hacking-an-equation</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Tue, 19 May 2026 12:29:50 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I&#8217;ve written a <a href="https://www.johndcook.com/blog/2026/05/10/reverse-mersenne-twister/">couple</a> <a href="https://www.johndcook.com/blog/2026/05/12/hacking-the-lehmer64-rng/">posts</a> lately about inferring the internal state of an insecure random number generator, letting you predict its future output. The latest post along these lines looks at the <a href="https://www.johndcook.com/blog/2026/05/15/xorshift128-state/">xorshift128</a> generator, one that is particularly easy to reverse.</p><div><hr></div><p>This morning I wrote a post about Don Zagier&#8217;s <a href="https://www.johndcook.com/blog/2026/05/19/zagiers-equation/">variation</a> on Markov&#8217;s equation. By changing the equation slightly Zagier was able to design an equation he could solve conveniently and use it to estimate the number of solutions to the original equation.</p><p>What I find interesting about Zagier&#8217;s approximation is that it has two forms that are not obviously equivalent:</p><p style="text-align: center;"><em>x</em>&#178; + <em>y</em>&#178; + <em>z</em>&#178; = 3<em>xyz</em> + 4/9</p><p>and </p><p style="text-align: center;"><em>f</em>(<em>x</em>) + <em>f</em>(<em>y</em>) = <em>f</em>(<em>z</em>)</p><p>where <em>f</em>(<em>t</em>) = arccosh(3<em>t</em>/2). I show that they are indeed equivalent, and pull out <a href="https://www.johndcook.com/blog/2024/08/20/osborn-rule/">Osborn&#8217;s rule</a> along the way.</p>]]></content:encoded></item><item><title><![CDATA[Euler function, Lehmer RNG, and C hacks]]></title><description><![CDATA[There&#8217;s often a tread through my posts, though I don&#8217;t know whether the thread is apparent to anyone but me.]]></description><link>https://johndcookconsulting.substack.com/p/euler-function-lehmer-rng-and-c-hacks</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/euler-function-lehmer-rng-and-c-hacks</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Tue, 12 May 2026 12:29:23 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>There&#8217;s often a tread through my posts, though I don&#8217;t know whether the thread is apparent to anyone but me.</p><p>The recent series of posts started with showing that the Mersenne Twister RNG can be hacked. You can infer its internal state from its outputs. This lead to several posts on how bit operations correspond to matrix operations. </p><p>That lead to a post on the probability that a binary matrix is invertible, which lead to a a post on <a href="https://www.johndcook.com/blog/2026/05/11/euler-function/">Euler&#8217;s function</a> and how easily it can be computed numerically. (There are several functions known as Euler&#8217;s function. I&#8217;m referring here to the one related to partitions and <em>q</em>-series.)</p><p>Returning to the theme of hacking RNGs, I wrote a post on inferring the internal state of the <a href="https://www.johndcook.com/blog/2026/05/12/hacking-the-lehmer64-rng/">lehmer64</a> RNG. And that lead to a post on how to <a href="https://www.johndcook.com/blog/2026/05/12/c-128-bit-int/">initialize and print</a> 128-bit unsigned integers in C.</p>]]></content:encoded></item><item><title><![CDATA[Inverses and pseudoinverses]]></title><description><![CDATA[If you fill a square matrix randomly with zeros and ones, what is the probability that the matrix is invertible?]]></description><link>https://johndcookconsulting.substack.com/p/inverses-and-pseudoinverses</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/inverses-and-pseudoinverses</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Mon, 11 May 2026 15:40:20 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you fill a square matrix randomly with zeros and ones, what is the probability that the matrix is invertible? The answer depends on what you mean by invertible. <a href="https://www.johndcook.com/blog/2026/05/11/random-binary-matrices/">This post</a> addresses two notions of invertibility and computes the probability of easy.</p><p>Continuing with the theme of bit twiddling and linear algebra, the inverse of a right shift is a left shift. Except a shift always loses some information because bits fall off one end or the other. So the corresponding matrices cannot be inverses. But they are <a href="https://www.johndcook.com/blog/2026/05/11/inverse-shift/">pseudoinverses</a>.</p><p>Have a great week. </p><p></p>]]></content:encoded></item><item><title><![CDATA[Curvature, Bit Twiddling, and Linear Algebra]]></title><description><![CDATA[As a sort of follow on to my posts on rounded triangles, I wrote about calculating curvature. I attempted to find the ratio of maximum to minimum curvature numerically, at it was an awful mess. It turned out the analytic calculation was actually easier than the numerical calculation in this case.]]></description><link>https://johndcookconsulting.substack.com/p/curvature-bit-twiddling-and-linear</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/curvature-bit-twiddling-and-linear</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Sun, 10 May 2026 19:21:37 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Lza-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>As a sort of follow on to my posts on rounded triangles, I wrote about <a href="https://www.johndcook.com/blog/2026/05/08/calculating-curvature/">calculating curvature</a>. I attempted to find the ratio of maximum to minimum curvature numerically, at it was an awful mess. It turned out the analytic calculation was actually easier than the numerical calculation in this case.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Lza-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Lza-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png 424w, https://substackcdn.com/image/fetch/$s_!Lza-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png 848w, https://substackcdn.com/image/fetch/$s_!Lza-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png 1272w, https://substackcdn.com/image/fetch/$s_!Lza-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Lza-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png" width="900" height="550" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:550,&quot;width&quot;:900,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:90083,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://johndcookconsulting.substack.com/i/197134125?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Lza-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png 424w, https://substackcdn.com/image/fetch/$s_!Lza-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png 848w, https://substackcdn.com/image/fetch/$s_!Lza-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png 1272w, https://substackcdn.com/image/fetch/$s_!Lza-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7008844a-1bbe-46d2-9f1c-fdb5e79fea8a_900x550.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><p>The Mersenne Twister is the prime example of the principle that a random number generator can have excellent statistical properties but bad cryptographic properties. <a href="https://www.johndcook.com/blog/2026/05/10/reverse-mersenne-twister/">This post</a> describes how to reverse engineer the internal state of the MT from its output. </p><p>The most interesting part of the post is that it reverses the MT, not by the usual bit twiddling, but using linear algebra mod 2.</p><div><hr></div><p>The MT post shows how the tempering process as a whole can be seen as multiplication by a matrix. The <a href="https://www.johndcook.com/blog/2026/05/10/the-linear-algebra-of-bit-twiddling/">follow up post</a> backs up and shows how the individual <em>components</em> of the MT can be represented as matrix multiplication. These operations correspond to upper- or lower-triangular matrices with 1s on the diagonal, and so they are invertible. </p><p>The tempering process corresponds to multiplication by four invertible matrices, so the whole process is invertible. </p>]]></content:encoded></item><item><title><![CDATA[Smoothed triangles]]></title><description><![CDATA[My two latest posts look at ways to approximate a triangle, or a more general polygon, by smooth curves.]]></description><link>https://johndcookconsulting.substack.com/p/smoothed-triangles</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/smoothed-triangles</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Thu, 07 May 2026 18:36:01 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!0sH3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>My two latest posts look at ways to approximate a triangle, or a more general polygon, by smooth curves. Here I mean smooth in the technical sense of having lots of derivatives, in particular at least two derivatives.</p><p>If you replace the corner of a square with a quarter of a circle, the resulting figure has one derivative where the curves patch together, but not two. The slopes match but the curvatures to not. If you tried to drive on a track with this shape, you&#8217;d have to jerk your steering wheel at the patch points.</p><p>The &#8220;squircle&#8221; is a kind of rounded square with continuous curvature. <a href="https://www.johndcook.com/blog/2026/05/06/triangular-analog-of-the-squircle/">This post</a> derives generalizes a squircle using an approach from real analysis.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0sH3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0sH3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png 424w, https://substackcdn.com/image/fetch/$s_!0sH3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png 848w, https://substackcdn.com/image/fetch/$s_!0sH3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png 1272w, https://substackcdn.com/image/fetch/$s_!0sH3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0sH3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png" width="600" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:600,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:27159,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://johndcookconsulting.substack.com/i/196812747?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0sH3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png 424w, https://substackcdn.com/image/fetch/$s_!0sH3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png 848w, https://substackcdn.com/image/fetch/$s_!0sH3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png 1272w, https://substackcdn.com/image/fetch/$s_!0sH3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9c9923c-8411-4189-ad2e-dd87bd026603_600x600.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><a href="https://www.johndcook.com/blog/2026/05/07/smoothed-polygons/">This post</a> derives a generalization using an approach from algebraic geometry.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!t8hI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F431e34af-777f-417d-907d-613c8f77c7cf_600x320.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!t8hI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F431e34af-777f-417d-907d-613c8f77c7cf_600x320.png 424w, https://substackcdn.com/image/fetch/$s_!t8hI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F431e34af-777f-417d-907d-613c8f77c7cf_600x320.png 848w, https://substackcdn.com/image/fetch/$s_!t8hI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F431e34af-777f-417d-907d-613c8f77c7cf_600x320.png 1272w, https://substackcdn.com/image/fetch/$s_!t8hI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F431e34af-777f-417d-907d-613c8f77c7cf_600x320.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!t8hI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F431e34af-777f-417d-907d-613c8f77c7cf_600x320.png" width="600" height="320" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/431e34af-777f-417d-907d-613c8f77c7cf_600x320.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:320,&quot;width&quot;:600,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34181,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://johndcookconsulting.substack.com/i/196812747?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F431e34af-777f-417d-907d-613c8f77c7cf_600x320.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!t8hI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F431e34af-777f-417d-907d-613c8f77c7cf_600x320.png 424w, https://substackcdn.com/image/fetch/$s_!t8hI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F431e34af-777f-417d-907d-613c8f77c7cf_600x320.png 848w, https://substackcdn.com/image/fetch/$s_!t8hI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F431e34af-777f-417d-907d-613c8f77c7cf_600x320.png 1272w, https://substackcdn.com/image/fetch/$s_!t8hI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F431e34af-777f-417d-907d-613c8f77c7cf_600x320.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Thanks for reading. Have a good week.</p>]]></content:encoded></item><item><title><![CDATA[Categories and Config Files]]></title><description><![CDATA[I wrote a couple brief articles this morning.]]></description><link>https://johndcookconsulting.substack.com/p/categories-and-config-files</link><guid isPermaLink="false">https://johndcookconsulting.substack.com/p/categories-and-config-files</guid><dc:creator><![CDATA[John Cook]]></dc:creator><pubDate>Wed, 06 May 2026 16:51:19 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JdnG!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea7ea6aa-5f48-4a71-a3f0-8b999b1fd664_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I wrote a couple brief articles this morning. </p><p><a href="https://www.johndcook.com/blog/2026/05/06/category-mythology/">First</a>, a note on separating the realistic and unrealistic aspects of category theory.</p><p><a href="https://www.johndcook.com/blog/2026/05/06/unified-config-files/">Second</a>, some suggestions for keeping config files in sync across computers.</p><p>Enjoy!</p><p></p>]]></content:encoded></item></channel></rss>