[{"id":247572,"date":"2026-08-07T10:11:10","date_gmt":"2026-08-07T15:11:10","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247572"},"modified":"2026-08-07T10:11:25","modified_gmt":"2026-08-07T15:11:25","slug":"how-not-to-calculate-cos","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/how-not-to-calculate-cos\/","title":{"rendered":"How not to calculate cosine"},"content":{"rendered":"<p>Calculus professors with no experience in numerical computing will tell students that computers calculate trig functions with power series. They don&#8217;t. I worked on the implementation of trig functions in hardware, and I can assure you we didn&#8217;t just use power series.<\/p>\n<p>Power series are an excellent way calculate functions <em>near the center of the series<\/em>, such as computing <a href=\"https:\/\/www.johndcook.com\/blog\/2010\/07\/27\/sine-approximation-for-small-x\/\">sine for small angles<\/a>. But the further you get from the center, the less useful power series are.<\/p>\n<p>Let&#8217;s suppose you want to calculate cos(200) using the power series for cosine. The\u00a0<em>n<\/em>th term of that series is<\/p>\n<p style=\"padding-left: 40px;\">(\u22121)<sup><em>n<\/em><\/sup> <em>x<\/em><sup>2<em>n<\/em><\/sup> \/ (2<em>n<\/em>)!<\/p>\n<p>This is an alternating series, and so the error in truncating the series after <em>n<\/em> terms is bounded by the size of the <em>n<\/em>+1 term, <em>if<\/em> you&#8217;ve gone far enough out in the series that the terms are monotonically decreasing in absolute value.<\/p>\n<p>To calculate cos(200) to machine precision, i.e. with an error of less than 2<sup>\u221252<\/sup>, we&#8217;d need to sum the series up to <em>n<\/em> where<\/p>\n<p style=\"padding-left: 40px;\">| 200<sup>2<em>n<\/em>+2<\/sup> \/ (2<em>n<\/em> + 2)! | &lt; 2<sup>\u221252<\/sup><\/p>\n<p>Actually, that will insure that the <em>absolute<\/em> error is small enough, but not that the <em>relative<\/em> error is small enough; if the value of cos(200) is small, we&#8217;d need more terms. Let&#8217;s ignore that and assume we&#8217;re only concerned with absolute error.<\/p>\n<p>Turns out we&#8217;d need 287 terms. That&#8217;s a lot of terms. But you might say &#8220;That&#8217;s fine. I&#8217;m not in a hurry, and it&#8217;s just more work for the computer, not for me.&#8221; OK, so let&#8217;s try.<\/p>\n<pre>from math import *\r\n\r\ns = 0\r\nfor n in range(288):\r\n    s += (-1)**n * 200**(2*n) \/ factorial(2*n)\r\nprint(s)\r\n<\/pre>\n<p>This prints -3.6840358571084123e+67. You may suspect the answer is incorrect since values of cosine are on the order of 1, not on the order of 10<sup>67<\/sup>. Something went spectacularly bad. On closer inspection, it&#8217;s remarkable the code didn&#8217;t crash.<\/p>\n<p>If you changed <code>200<\/code> to <code>200.0<\/code> above, the code would crash. Calculating <code>200.0**(2*n)<\/code> overflows when <em>n<\/em> = 67. But when we calculate <code>200**(2*n)<\/code>, the result is an integer. And we&#8217;re dividing by <code>factorial(2*n)<\/code>, which is also an integer. Both of these integers become too large to fit in a float, but their <em>ratio<\/em> has a maximum value of around 10<sup>80<\/sup>, smaller than the maximum float, which is on the order of 10<sup>308<\/sup>.<\/p>\n<p>When we don&#8217;t overflow, we have a different problem: catastrophic cancellation. You can&#8217;t calculate a number between \u22121 and 1 as an alternating sum of numbers as large as 10<sup>80<\/sup>. You&#8217;d need more than 80 + 16 = 96 decimal places of precision to compute the sum accurately, and floating point only gives you between 15 and 16 decimal places of precision.<\/p>\n<p>So how <em>would<\/em> you calculate cos(200)? The first step would be to use some sort of range reduction on 200. You could reduce 200 mod 2\u03c0 to get a smaller number to work with.<\/p>\n<pre>&gt;&gt;&gt; from math import cos, pi\r\n&gt;&gt;&gt; x = 200 % (2*pi)\r\n&gt;&gt;&gt; x\r\n5.221255477432827\r\n<\/pre>\n<p>Using a power series to compute the cosine of 5.221255477432827 is feasible, but not optimal. There&#8217;s also another problem: the naive range reduction above loses some precision.<\/p>\n<pre>&gt;&gt;&gt; cos(x)\r\n0.48718767500701254\r\n&gt;&gt;&gt; cos(x) - cos(200)\r\n6.661338147750939e-15\r\n<\/pre>\n<p>The error is small, but it&#8217;s still an order of magnitude larger than machine precision. You can&#8217;t simply reduce <em>n<\/em> mod 2\u03c0 with ordinary float division because the integer part of <em>n<\/em> \/ 2\u03c0 pushes some digits of precision off the right end. I intend to write about how range reduction works in future posts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Calculus professors with no experience in numerical computing will tell students that computers calculate trig functions with power series. They don&#8217;t. I worked on the implementation of trig functions in hardware, and I can assure you we didn&#8217;t just use power series. Power series are an excellent way calculate functions near the center of the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5,9],"tags":[],"class_list":["post-247572","post","type-post","status-publish","format-standard","hentry","category-computing","category-math"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Calculus professors with no experience in numerical computing will tell students that computers calculate trig functions with power series. They don&#039;t.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/how-not-to-calculate-cos\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"How not to calculate cosine\" \/>\n\t\t<meta property=\"og:description\" content=\"Calculus professors with no experience in numerical computing will tell students that computers calculate trig functions with power series. They don&#039;t.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/how-not-to-calculate-cos\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-07T15:11:10+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-07T15:11:25+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How not to calculate cosine\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Calculus professors with no experience in numerical computing will tell students that computers calculate trig functions with power series. They don&#039;t.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How not to calculate cosine","description":"Calculus professors with no experience in numerical computing will tell students that computers calculate trig functions with power series. They don't.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/how-not-to-calculate-cos\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"How not to calculate cosine","og:description":"Calculus professors with no experience in numerical computing will tell students that computers calculate trig functions with power series. They don't.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/how-not-to-calculate-cos\/","article:published_time":"2026-08-07T15:11:10+00:00","article:modified_time":"2026-08-07T15:11:25+00:00","twitter:card":"summary","twitter:title":"How not to calculate cosine","twitter:description":"Calculus professors with no experience in numerical computing will tell students that computers calculate trig functions with power series. They don't.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247572","title":null,"description":"Calculus professors with no experience in numerical computing will tell students that computers calculate trig functions with power series. They don't.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-08-07 14:02:31","updated":"2026-08-07 15:11:25","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/computing\/\" title=\"Computing\">Computing<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow not to calculate cosine\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Computing","link":"https:\/\/www.johndcook.com\/blog\/category\/computing\/"},{"label":"How not to calculate cosine","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/how-not-to-calculate-cos\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247572"}],"version-history":[{"count":3,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247572\/revisions"}],"predecessor-version":[{"id":247575,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247572\/revisions\/247575"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247561,"date":"2026-08-07T08:19:07","date_gmt":"2026-08-07T13:19:07","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247561"},"modified":"2026-08-07T08:29:27","modified_gmt":"2026-08-07T13:29:27","slug":"cos200","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/cos200\/","title":{"rendered":"cos(200!)"},"content":{"rendered":"<p>In a footnote to the <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/06\/log1000\/\">previous post<\/a>, I said that Python&#8217;s math library can calculate the logarithm of extremely large numbers but not the cosine. This post will expand on that comment.<\/p>\n<p>In this post I&#8217;ll use <em>n<\/em> = 200! as my example rather than 1000! nbecause this value of <em>N<\/em> is larger than the largest representable floating point number but small enough to be more convenient to work with.<\/p>\n<p>Suppose someone calculates 200! for you:<\/p>\n<pre>78865786736479050355236321393218506229513597768717326329474253324435\\\r\n94499634033429203042840119846239041772121389196388302576427902426371\\\r\n05061926624952829931113462857270763317237396988943922445621451664240\\\r\n25403329186413122742829485327752424240757390324032125740557956866022\\\r\n60319041703240623517008587961789222227896237038973747200000000000000\\\r\n00000000000000000000000000000000000\r\n<\/pre>\n<p>You could now calculate log(<em>n<\/em>) using<\/p>\n<p style=\"padding-left: 40px;\"><em>n<\/em> = 7.886578673647905 \u00d7 10<sup>374<\/sup><\/p>\n<p>and so<\/p>\n<p style=\"padding-left: 40px;\">log(<em>n<\/em>) = log(7.886578673647905 \u00d7 10<sup>374<\/sup>)<br \/>\n= log(7.886578673647905) + 374 log(10) = 863.2319871924055.<\/p>\n<p>The key thing that makes this possible is that the least significant digits of <em>n<\/em> only effect the least significant digits of log(<em>n<\/em>). In the calculation above I kept the first 16 digits of\u00a0<em>n<\/em>. Python couldn&#8217;t make use of any more digits, and had no need of any more digits, in order to produce the logarithm to machine precision.<\/p>\n<p>Cosine doesn&#8217;t work that way. The cosine of\u00a0<em>n<\/em> depends on the remainder when\u00a0<em>n<\/em> is divided by 2\u03c0, and that remainder depends on every single digit of <em>n<\/em>. I&#8217;ll illustrate that below.<\/p>\n<p>Using <code>bc -l<\/code> and setting the scale to 400, I can calculated <em>n<\/em> then calculate<\/p>\n<p style=\"padding-left: 40px;\">cos(<em>n<\/em> + 10<sup><em>i<\/em><\/sup>)<\/p>\n<p>for i running from 0 to 374, tweaking each digit one at a time. (Except when a digit is a 9 and the addition results in a carry.)<\/p>\n<pre>    n = 1\r\n    for (i = 1; i &lt;= 200; i++) n *= i\r\n    scale = 400\r\n    for (i = 1; i &lt;= 374; i++) {\r\n        x = c(n+10^i)\r\n        scale = 16\r\n        print x\/1, \"\\n\"\r\n        scale = 400\r\n    }\r\n<\/pre>\n<p>Here&#8217;s what a plot of the results look like.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/cos200factorial1.png\" width=\"480\" height=\"360\" \/><\/p>\n<p>The value of cos(<em>n<\/em>) is about \u22120.985, but the values above are all over the map. We can look at the range by projecting all the points over to the left edge then rotating a quarter turn:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/cos200factorial2.png\" width=\"360\" height=\"15\" \/><\/p>\n<p>The remarkable thing about this image is that there are a few gaps, i.e. a few values the cosine does <em>not<\/em> take on.<\/p>\n<p>Here&#8217;s a more sophisticated way to look at it. The sequence 10<sup><em>i<\/em><\/sup> mod 2\u03c0 is dense in [0, 2\u03c0], and so by going far enough out in the sequence, we can find a value that shifts the phase of <em>n<\/em> by any desired amount within any given tolerance.<\/p>\n<p>Every digit in\u00a0<em>n<\/em> matters, and changing any digit can change the value of cosine to be essentially any value. You cannot calculate the cosine of an enormous number without using some kind of extended precision arithmetic. There are clever range reduction algorithms that minimize the amount of extended arithmetic necessary, but extended arithmetic cannot be completely eliminated.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a footnote to the previous post, I said that Python&#8217;s math library can calculate the logarithm of extremely large numbers but not the cosine. This post will expand on that comment. In this post I&#8217;ll use n = 200! as my example rather than 1000! nbecause this value of N is larger than the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-247561","post","type-post","status-publish","format-standard","hentry","category-computing"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Why you can calculate the log of a huge number more easily than the cosine. Demonstration that every digit is maximally important.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/cos200\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Calculating the cosine of numbers outside the range of floats\" \/>\n\t\t<meta property=\"og:description\" content=\"Why you can calculate the log of a huge number more easily than the cosine. Demonstration that every digit is maximally important.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/cos200\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-07T13:19:07+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-07T13:29:27+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Calculating the cosine of numbers outside the range of floats\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Why you can calculate the log of a huge number more easily than the cosine. Demonstration that every digit is maximally important.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Calculating the cosine of numbers outside the range of floats","description":"Why you can calculate the log of a huge number more easily than the cosine. Demonstration that every digit is maximally important.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/cos200\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Calculating the cosine of numbers outside the range of floats","og:description":"Why you can calculate the log of a huge number more easily than the cosine. Demonstration that every digit is maximally important.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/cos200\/","article:published_time":"2026-08-07T13:19:07+00:00","article:modified_time":"2026-08-07T13:29:27+00:00","twitter:card":"summary","twitter:title":"Calculating the cosine of numbers outside the range of floats","twitter:description":"Why you can calculate the log of a huge number more easily than the cosine. Demonstration that every digit is maximally important.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247561","title":"Calculating the cosine of numbers outside the range of floats","description":"Why you can calculate the log of a huge number more easily than the cosine. Demonstration that every digit is maximally important.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-08-07 11:54:58","updated":"2026-08-07 14:02:59","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/computing\/\" title=\"Computing\">Computing<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tcos(200!)\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Computing","link":"https:\/\/www.johndcook.com\/blog\/category\/computing\/"},{"label":"cos(200!)","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/cos200\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247561"}],"version-history":[{"count":9,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247561\/revisions"}],"predecessor-version":[{"id":247570,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247561\/revisions\/247570"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247553,"date":"2026-08-06T08:23:43","date_gmt":"2026-08-06T13:23:43","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247553"},"modified":"2026-08-07T08:42:02","modified_gmt":"2026-08-07T13:42:02","slug":"log1000","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/06\/log1000\/","title":{"rendered":"Calculating log(1000!)"},"content":{"rendered":"<p>The <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/math-log\/\">previous post<\/a> pointed out that the following code such as the following unexpectedly works.<\/p>\n<pre>&gt;&gt;&gt; from math import log, factorial\r\n&gt;&gt;&gt; log(factorial(1000))\r\n5912.128178488163\r\n<\/pre>\n<p>If you don&#8217;t find this unexpected, note that if you replace <code>math.log<\/code> with <code>numpy.log<\/code> the code will fail [1]. Functions like natural logarithm operate on real numbers. Real numbers are represented as floating point numbers in programming languages, and 1000! factorial is too large to represent as a standard floating point number. (More on that <a href=\"https:\/\/www.johndcook.com\/blog\/2009\/04\/06\/anatomy-of-a-floating-point-number\/\">here<\/a>.)<\/p>\n<p>In this post I&#8217;d like to look at how you might calculate log(1000!) with less capable software, and even without software.<\/p>\n<p>One approach would be to sum the logarithms of the numbers 1 through 1000. This will give essentially the same result as above, with a little difference in the last couple decimal places due to rounding error.<\/p>\n<p>If you have a way to calculate 1000! but not a way to cast it to a floating point number, you could do this manually.<\/p>\n<pre>&gt;&gt;&gt; s = str(factorial(1000))\r\n&gt;&gt;&gt; s[:16]\r\n'4023872600770937'\r\n&gt;&gt;&gt; len(s)\r\n2568\r\n<\/pre>\n<p>This tells us 1000! = 4.023872600770937 \u00d7 10<sup>2567<\/sup>. Therefore<\/p>\n<p style=\"padding-left: 40px;\">log(1000!) = log(4.023872600770937) + 2567 log(10)<\/p>\n<p>which only requires working with numbers of modest size.<\/p>\n<h2>Calculating by hand<\/h2>\n<p>Now suppose it&#8217;s 1964. You don&#8217;t have a computer, or even a calculator, but you do have a copy of the recently published Handbook of Mathematical Functions by Abramowitz and Stegun (A&amp;S). You turn to Table 6.6 &#8220;Factorials for large arguments.&#8221; This has values of factorial for 100, 200, 300, \u2026, 1000, so you can simply look up your answer to 20 decimal places.<\/p>\n<p>That was too easy; I didn&#8217;t expect that to be there when I started writing this post. If you wanted to compute log(950!), for example, you&#8217;d have to work harder. You could find A&amp;S equation 6.1.41 (Stirling&#8217;s series) which says<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/AS6.1.41.svg\" alt=\"\\begin{align*} \\ln \\Gamma(z) &amp;\\sim (z - \\tfrac{1}{2}) \\ln z - z + \\tfrac{1}{2} \\ln 2\\pi + \\frac{1}{12z} - \\frac{1}{360z^3} \\\\ &amp;+ \\frac{1}{1260z^5} - \\frac{1}{680z^7} + \\cdots \\end{align*}\" width=\"401\" height=\"90\" \/><\/p>\n<p>So how would you use this formula to calculate log(1000!)? Since <em>n<\/em>! = \u0393(<em>n<\/em> + 1), you set <em>z<\/em> = 1001.<\/p>\n<p>You&#8217;d need to decide how many terms you need to use. Assuming the error is on the order of the first term you leave out, you&#8217;d reason that you could probably stop with the 1\/12<em>z<\/em> term because the next term is between 10<sup>\u221211<\/sup> and 10<sup>\u221212<\/sup>.<\/p>\n<p>You find Table 4.2 has natural logarithms, but not for 1001. You can look up log(1.001), however, and at the bottom of the same page is log(10) to 16 decimal places, and you can find log(10) to 24 decimal places in Table 1.1. So you calculate<\/p>\n<p style=\"padding-left: 40px;\">log(1001) = log(1.001 \u00d7 10\u00b3) = log(1.001) + 3 log(10).<\/p>\n<p>You can find log(2) and log(\u03c0) in Table 1.1, and average them to find \u00bd log(2\u03c0).<\/p>\n<p>Here&#8217;s Python code to simulate the hand calculations.<\/p>\n<pre>log2     = 0.6931_47180_55994_53094_172321 # Table 1.1\r\nlog10    = 2.3025_85092_99404_56840_179915 # Table 1.1\r\nlogpi    = 1.1447_29885_84940_01741_43427  # Table 1.1\r\nlog1_001 = 0.00099_95003_330835            # Table 4.2\r\n\r\nz = 1001\r\nlogz = log1_001 + 3*log10\r\ns = (z - 0.5)*logz - z + (log2 + logpi)\/2 + 1\/(12*z)\r\n\r\nprint(s)\r\n<\/pre>\n<p>This result differs from the one at the top of the post only in the last decimal place.<\/p>\n<h2>Related posts<\/h2>\n<p>Doing calculations with tables is not as simple as &#8220;just look it up.&#8221; It takes a bit of skill.<\/p>\n<ul>\n<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>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2024\/06\/25\/trig-tables\/\">Using a trig table<\/a><\/li>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2026\/03\/26\/table-precision\/\">How much precision can you squeeze out of a table?<\/a><\/li>\n<\/ul>\n<p>[1] The code will also fail if you replace <code>math.log<\/code> with <code>math.cos<\/code>. Both logarithm and cosine return moderate sized real numbers when given enormous inputs like 1000!, so representing the output as a float is not the problem. But logarithms of huge numbers can be computed with ordinary precision functions, as above. But computing the cosine of a huge number requires extended precision.<\/p>\n<p><strong>Update<\/strong>: The <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/07\/cos200\/\">next post<\/a> expands on why computing the cosine of a large number is more difficult than computing the log.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The previous post pointed out that the following code such as the following unexpectedly works. &gt;&gt;&gt; from math import log, factorial &gt;&gt;&gt; log(factorial(1000)) 5912.128178488163 If you don&#8217;t find this unexpected, note that if you replace math.log with numpy.log the code will fail [1]. Functions like natural logarithm operate on real numbers. Real numbers are represented [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[],"class_list":["post-247553","post","type-post","status-publish","format-standard","hentry","category-math"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"How would you compute log(1000!) without software that handles enormous numbers? How would you calculate it by hand?\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/06\/log1000\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Calculating log(1000!)\" \/>\n\t\t<meta property=\"og:description\" content=\"How would you compute log(1000!) without software that handles enormous numbers? How would you calculate it by hand?\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/06\/log1000\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-06T13:23:43+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-07T13:42:02+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Calculating log(1000!)\" \/>\n\t\t<meta name=\"twitter:description\" content=\"How would you compute log(1000!) without software that handles enormous numbers? How would you calculate it by hand?\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Calculating log(1000!)","description":"How would you compute log(1000!) without software that handles enormous numbers? How would you calculate it by hand?","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/06\/log1000\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Calculating log(1000!)","og:description":"How would you compute log(1000!) without software that handles enormous numbers? How would you calculate it by hand?","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/06\/log1000\/","article:published_time":"2026-08-06T13:23:43+00:00","article:modified_time":"2026-08-07T13:42:02+00:00","twitter:card":"summary","twitter:title":"Calculating log(1000!)","twitter:description":"How would you compute log(1000!) without software that handles enormous numbers? How would you calculate it by hand?","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247553","title":null,"description":"How would you compute log(1000!) without software that handles enormous numbers? How would you calculate it by hand?","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-08-06 11:14:31","updated":"2026-08-07 14:02:59","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tCalculating log(1000!)\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Calculating log(1000!)","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/06\/log1000\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247553"}],"version-history":[{"count":8,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247553\/revisions"}],"predecessor-version":[{"id":247571,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247553\/revisions\/247571"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247547,"date":"2026-08-05T13:26:25","date_gmt":"2026-08-05T18:26:25","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247547"},"modified":"2026-08-06T05:56:48","modified_gmt":"2026-08-06T10:56:48","slug":"math-log","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/math-log\/","title":{"rendered":"The code that didn&#8217;t break"},"content":{"rendered":"<p>Last week I wrote a <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/07\/28\/keys-and-cards\/\">post<\/a> on hiding cryptographic keys in decks of cards. I wrote some code for that post that shouldn&#8217;t work, but before fixing I noticed that it in fact did work.<\/p>\n<p>The code computes logarithms for integers larger than the largest representable float. For example, the largest float is on the order of 10<sup>308<\/sup>, and yet the following code works.<\/p>\n<pre>&gt;&gt;&gt; import math\r\n&gt;&gt;&gt; math.log10(10**400)\r\n400.0\r\n<\/pre>\n<p>The <code>log<\/code>, <code>log2<\/code>, and <code>log10<\/code> functions have some code inside that handles large integers specially. It doesn&#8217;t simply convert the integers to floats before taking the logarithm. If it did, it would overflow. If you replace <code>math<\/code> with <code>numpy<\/code> above, the code will fail. NumPy&#8217;s implementation of logarithms is more what I would expect.<\/p>\n<p>While playing around with this I also noticed that you can define floats larger than the largest float without warnings.<\/p>\n<pre>&gt;&gt;&gt; math.log(1e308)\r\n709.1962086421661\r\n&gt;&gt;&gt; math.log(1e309)\r\ninf\r\n<\/pre>\n<p>This isn&#8217;t a feature of <code>math.log<\/code> but of how Python handles scientific notation. The expression <code>1e308<\/code> is the floating point representation of 10<sup>308<\/sup>. It is a float, not an int.<\/p>\n<pre>&gt;&gt;&gt; type(1e308)\r\n&lt;class 'float'&gt;\r\n<\/pre>\n<p>The expression <code>1e309<\/code> is also a float. But since it&#8217;s larger than is possible for a float, Python interprets it as <code>inf<\/code>. The code<\/p>\n<pre>math.log(1e309)<\/pre>\n<p>returns <code>inf<\/code> based on the reasoning that log(\u221e) = \u221e.<\/p>\n<p>That explains the following behavior:<\/p>\n<pre>&gt;&gt;&gt; 1e309 == 1e310\r\nTrue\r\n<\/pre>\n<p>The expressions <code>1e309<\/code> and <code>1e310<\/code> are equal because both are alternate ways of writing <code>inf<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I wrote a post on hiding cryptographic keys in decks of cards. I wrote some code for that post that shouldn&#8217;t work, but before fixing I noticed that it in fact did work. The code computes logarithms for integers larger than the largest representable float. For example, the largest float is on the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[169],"class_list":["post-247547","post","type-post","status-publish","format-standard","hentry","category-math","tag-python"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"A couple oddities in math with very large numbers in Python\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"python\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/math-log\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"The code that didn\u2019t break\" \/>\n\t\t<meta property=\"og:description\" content=\"A couple oddities in math with very large numbers in Python\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/math-log\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-05T18:26:25+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-06T10:56:48+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"The code that didn\u2019t break\" \/>\n\t\t<meta name=\"twitter:description\" content=\"A couple oddities in math with very large numbers in Python\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"The code that didn\u2019t break","description":"A couple oddities in math with very large numbers in Python","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/math-log\/","robots":"max-image-preview:large","keywords":"python","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"The code that didn\u2019t break","og:description":"A couple oddities in math with very large numbers in Python","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/math-log\/","article:published_time":"2026-08-05T18:26:25+00:00","article:modified_time":"2026-08-06T10:56:48+00:00","twitter:card":"summary","twitter:title":"The code that didn\u2019t break","twitter:description":"A couple oddities in math with very large numbers in Python","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247547","title":null,"description":"A couple oddities in math with very large numbers in Python","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-08-05 17:47:04","updated":"2026-08-06 11:53:56","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tThe code that didn\u2019t break\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"The code that didn&#8217;t break","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/math-log\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247547"}],"version-history":[{"count":4,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247547\/revisions"}],"predecessor-version":[{"id":247551,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247547\/revisions\/247551"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247540,"date":"2026-08-05T09:49:35","date_gmt":"2026-08-05T14:49:35","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247540"},"modified":"2026-08-06T06:10:52","modified_gmt":"2026-08-06T11:10:52","slug":"enumerating-trees-and-circles","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/enumerating-trees-and-circles\/","title":{"rendered":"Enumerating trees and circles"},"content":{"rendered":"<p>A few days ago I wrote a post on <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/01\/counting-rooted-trees\/\">counting rooted trees<\/a>. That post looked at the sequence <em>c<\/em>(<em>n<\/em>) which counts the number of rooted trees with <em>n<\/em> nodes. Here one node is distinguished as the root, but the nodes below the root are not distinguished from each other; all that matters is how the nodes are connected.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/rooted_trees_order_1_to_4.svg\" width=\"680\" height=\"600\" \/><\/p>\n<p>The number of rooted trees with <em>n<\/em> nodes is the same as the number of ways to configure <em>n<\/em> \u2212 1 non-overlapping circles. Not only are the counts the same, there is a natural correspondence between the trees and the circles. It&#8217;s not obvious that there should be such a correspondence, with the right notation the correspondence is sort of a pun.<\/p>\n<p>The standard way to represent unlabeled trees is as a <a href=\"https:\/\/www.johndcook.com\/blog\/2022\/10\/26\/multisets\/\">multiset<\/a> of their children. We use a multiset, not a set, because some elements will be repeated. We represent a leaf as a pair of parentheses: <code>()<\/code>.<\/p>\n<p>There is only one rooted tree with one node: <code>()<\/code>.<\/p>\n<p>There is only one rooted tree with one two nodes: <code>(())<\/code>. Here the outer parentheses represent the root node and the inner parentheses represent its child.<\/p>\n<p>There are two rooted trees with three nodes, and we can represent them as <code>((()))<\/code> and <code>((),())<\/code>. The first is the straight line tree: a node that has a single child node that has a single child node. The second is a node that branches to two nodes. (Here&#8217;s where we need multisets.)<\/p>\n<p>The four rooted trees with four nodes can be represented as <code>(((())))<\/code>, <code>((((),()))<\/code>, <code>((),(()))<\/code>, and <code>((),(),(),())<\/code>.<\/p>\n<p>Here are the nine rooted trees with five nodes:<\/p>\n<pre>((((()))))\r\n((((),())))\r\n(((),(())))\r\n(((),(),()))\r\n((()),(()))\r\n((),((())))\r\n((),((),()))\r\n((),(),(()))\r\n((),(),(),())\r\n<\/pre>\n<p>The correspondence with non-overlapping circles removes the outer parentheses then joins the rest to form circles, with nested parentheses corresponding to concentric circles. A more geometric way to see the correspondence is to start at the bottom of the tree, replace leaves with circles, then work your way up circling connected components.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/nonoverlapping_circles2.png\" width=\"362\" height=\"896\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few days ago I wrote a post on counting rooted trees. That post looked at the sequence c(n) which counts the number of rooted trees with n nodes. Here one node is distinguished as the root, but the nodes below the root are not distinguished from each other; all that matters is how the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-247540","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"There&#039;s a one-to-one correspondence between rooted trees and non-overlapping circles\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/enumerating-trees-and-circles\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Enumerating trees and circles\" \/>\n\t\t<meta property=\"og:description\" content=\"There&#039;s a one-to-one correspondence between rooted trees and non-overlapping circles\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/enumerating-trees-and-circles\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-05T14:49:35+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-06T11:10:52+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Enumerating trees and circles\" \/>\n\t\t<meta name=\"twitter:description\" content=\"There&#039;s a one-to-one correspondence between rooted trees and non-overlapping circles\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Enumerating trees and circles","description":"There's a one-to-one correspondence between rooted trees and non-overlapping circles","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/enumerating-trees-and-circles\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Enumerating trees and circles","og:description":"There's a one-to-one correspondence between rooted trees and non-overlapping circles","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/enumerating-trees-and-circles\/","article:published_time":"2026-08-05T14:49:35+00:00","article:modified_time":"2026-08-06T11:10:52+00:00","twitter:card":"summary","twitter:title":"Enumerating trees and circles","twitter:description":"There's a one-to-one correspondence between rooted trees and non-overlapping circles","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247540","title":null,"description":"There's a one-to-one correspondence between rooted trees and non-overlapping circles","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-08-05 12:48:37","updated":"2026-08-06 11:53:56","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/uncategorized\/\" title=\"Uncategorized\">Uncategorized<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tEnumerating trees and circles\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Uncategorized","link":"https:\/\/www.johndcook.com\/blog\/category\/uncategorized\/"},{"label":"Enumerating trees and circles","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/05\/enumerating-trees-and-circles\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247540"}],"version-history":[{"count":4,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247540\/revisions"}],"predecessor-version":[{"id":247543,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247540\/revisions\/247543"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247536,"date":"2026-08-04T08:18:58","date_gmt":"2026-08-04T13:18:58","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247536"},"modified":"2026-08-04T20:20:01","modified_gmt":"2026-08-05T01:20:01","slug":"metallic-alchemy","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/metallic-alchemy\/","title":{"rendered":"Mathematical alchemy"},"content":{"rendered":"<p>After writing the <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/ratio-of-metallic-ratios\/\">previous post<\/a> about metallic ratios, I thought about the analogy to alchemy and the attempt to make precious metals out of base metals.<\/p>\n<p>When can you make one metallic ratio out of another? Can you make the golden ratio out of the lead ratio?<\/p>\n<p>Before we can make gold out of lead, we have to say what lead is.<\/p>\n<h2>Defining metallic ratios<\/h2>\n<p>The metallic ratios\u00a0<em>M<\/em>(<em>n<\/em>) can be defined several ways. The most interesting definition is the number whose continued fraction representation contains all <em>n<\/em>s. A more prosaic but more convenient definition is the larger number that equals its reciprocal plus <em>n<\/em>, which can be found using the quadratic formula.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/metallic_ratio_def.svg\" alt=\"M(n) = n + \\cfrac{1}{n+\\cfrac{1}{n+\\cfrac{1}{n+\\cdots}}} = \\frac{n + \\sqrt{n^2 + 4}}{2}\" width=\"344\" height=\"110\" \/><\/p>\n<p>The golden ratio is\u00a0<em>M<\/em>(1), the silver ratio is\u00a0<em>M<\/em>(2), and the bronze ratio is\u00a0<em>M<\/em>(3).<\/p>\n<h2>Gold from silver and bronze?<\/h2>\n<p>Can you make the golden ratio out of the silver and bronze ratios? Not by integer arithmetic. The golden ratio involves \u221a5, the silver ratio \u221a2 and the bronze ratio \u221a13. No integer operations on the latter two radicals will produce the former, though you can come arbitrarily close.<\/p>\n<h2>Gold from lead<\/h2>\n<p>The metallic ratios for <em>n<\/em> &gt; 3 don&#8217;t have standard names, but let&#8217;s call <em>M<\/em>(4) the lead ratio. Can you make the golden ratio out of the lead ratio? Yes you can:<\/p>\n<p style=\"padding-left: 40px;\"><em>M<\/em>(1) = (<em>M<\/em>(4) \u2212 1)\/2.<\/p>\n<h2>General solution<\/h2>\n<p>In general, when can you make\u00a0<em>M<\/em>(<em>n<\/em>) out of\u00a0<em>M<\/em>(<em>m<\/em>)? In abstract terms the question is when the fields<\/p>\n<p style=\"padding-left: 40px;\">\u211a(\u221a(<em>n<\/em>\u00b2 + 4))<\/p>\n<p>and<\/p>\n<p style=\"padding-left: 40px;\">\u211a(\u221a(<em>m<\/em>\u00b2 + 4))<\/p>\n<p>are the same, i.e. when adjoining \u221a(<em>n<\/em>\u00b2 + 4) to the rational numbers gives the same field as adjoining \u221a(<em>m<\/em>\u00b2 + 4) to the rational numbers. This occurs if and only if<\/p>\n<p style=\"padding-left: 40px;\">(<em>n<\/em>\u00b2 + 4)\/(<em>m\u00b2<\/em> + 4)<\/p>\n<p>is the square of a rational number.<\/p>\n<h2>Bronze from copper and tin<\/h2>\n<p>Can you make bronze out of copper and tin? Yes, if you define\u00a0<em>M<\/em>(36) to be the copper ratio and\u00a0<em>M<\/em>(393) to be the tin ratio, because<\/p>\n<p style=\"padding-left: 40px;\">(3\u00b2 + 4)\/(36\u00b2 + 4) = (1\/10)\u00b2<\/p>\n<p>and<\/p>\n<p style=\"padding-left: 40px;\">(3\u00b2 + 4)\/(292\u00b2 + 4) = (1\/109)\u00b2.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After writing the previous post about metallic ratios, I thought about the analogy to alchemy and the attempt to make precious metals out of base metals. When can you make one metallic ratio out of another? Can you make the golden ratio out of the lead ratio? Before we can make gold out of lead, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[94],"class_list":["post-247536","post","type-post","status-publish","format-standard","hentry","category-math","tag-number-theory"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"By analogy with alchemy, can you make gold from lead? i.e. can you make the golden ratio by integer operations on the lead ratio?\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"number theory\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/metallic-alchemy\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Metallic alchemy: making one metallic ratio from another\" \/>\n\t\t<meta property=\"og:description\" content=\"By analogy with alchemy, can you make gold from lead? i.e. can you make the golden ratio by integer operations on the lead ratio?\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/metallic-alchemy\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-04T13:18:58+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-05T01:20:01+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Metallic alchemy: making one metallic ratio from another\" \/>\n\t\t<meta name=\"twitter:description\" content=\"By analogy with alchemy, can you make gold from lead? i.e. can you make the golden ratio by integer operations on the lead ratio?\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Metallic alchemy: making one metallic ratio from another","description":"By analogy with alchemy, can you make gold from lead? i.e. can you make the golden ratio by integer operations on the lead ratio?","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/metallic-alchemy\/","robots":"max-image-preview:large","keywords":"number theory","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Metallic alchemy: making one metallic ratio from another","og:description":"By analogy with alchemy, can you make gold from lead? i.e. can you make the golden ratio by integer operations on the lead ratio?","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/metallic-alchemy\/","article:published_time":"2026-08-04T13:18:58+00:00","article:modified_time":"2026-08-05T01:20:01+00:00","twitter:card":"summary","twitter:title":"Metallic alchemy: making one metallic ratio from another","twitter:description":"By analogy with alchemy, can you make gold from lead? i.e. can you make the golden ratio by integer operations on the lead ratio?","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247536","title":"Metallic alchemy: making one metallic ratio from another","description":"By analogy with alchemy, can you make gold from lead? i.e. can you make the golden ratio by integer operations on the lead ratio?","keywords":null,"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-08-04 12:23:52","updated":"2026-08-05 17:40:38","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tMathematical alchemy\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Mathematical alchemy","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/metallic-alchemy\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247536"}],"version-history":[{"count":3,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247536\/revisions"}],"predecessor-version":[{"id":247539,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247536\/revisions\/247539"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247532,"date":"2026-08-04T06:41:49","date_gmt":"2026-08-04T11:41:49","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247532"},"modified":"2026-08-04T06:41:49","modified_gmt":"2026-08-04T11:41:49","slug":"ratio-of-metallic-ratios","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/ratio-of-metallic-ratios\/","title":{"rendered":"Ratio of metallic ratios"},"content":{"rendered":"<p>The golden ratio is the first and best known of the metallic ratios. I&#8217;ve written about the silver ratio a few times, most recently <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/silver-kings\/\">here<\/a>. And I&#8217;ve mentioned the <a href=\"https:\/\/www.johndcook.com\/blog\/2023\/04\/14\/metallic-ratios\/\">bronze ratio<\/a> a couple times. The metallic ratios after bronze don&#8217;t have standard names.<\/p>\n<p>The <em>n<\/em>th metallic ratio <em>M<\/em>(<em>n<\/em>) is the number whose continued fraction representation contains all <em>n<\/em>s.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/metallic_ratio.svg\" alt=\"n + \\cfrac{1}{n+\\cfrac{1}{n+\\cfrac{1}{n+\\cdots}}} = \\frac{n + \\sqrt{n^2 + 4}}{2}\" width=\"276\" height=\"95\" \/><\/p>\n<p>When <em>n<\/em> = 1, 2, and 3 we get the gold, silver, and bronze ratios.<\/p>\n<p>You can approximate any positive real number as a ratio of metallic ratios. To see this, note that for large\u00a0<em>n<\/em>, <i>M<\/i>(<em>n<\/em>)\u00a0is approximately\u00a0<em>n<\/em>. For any positive rational number <em>a<\/em>\/<em>b<\/em>,<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/metallic_ratio_ratio.svg\" alt=\"\\lim_{n\\to\\infty} \\frac{M(na)}{M(nb)} = \\frac{a}{b}\" width=\"131\" height=\"45\" \/><\/p>\n<p>and so you can make\u00a0<em>M<\/em>(<em>na<\/em>) \/\u00a0<em>M<\/em>(<em>nb<\/em>) as close to\u00a0<em>a<\/em>\/<em>b<\/em> as you like by taking\u00a0<em>n<\/em> large enough. And since the rationals are dense in the reals, you can approximate any positive real number as close as you&#8217;d like.<\/p>\n<p>Let&#8217;s look for metallic ratios whose ratios approximate \u03c0 to within 0.001 with the following Python code.<\/p>\n<pre>from math import pi, sqrt\r\n\r\nM = lambda n: 0.5*(n + sqrt(n**2 + 4))\r\n\r\nfor n in range(1, 100):\r\n    a = round(pi*n)\r\n    b = n\r\n    r = M(a)\/M(b)\r\n    if abs(r - pi) &lt; 0.001:\r\n        print(a, b, r)\r\n<\/pre>\n<p>This shows<\/p>\n<p style=\"padding-left: 40px;\">\u03c0 \u2248\u00a0<em>M<\/em>(132) \/\u00a0<em>M<\/em>(42) = 3.1412\u2026<\/p>\n<p>Could we find smaller numbers that work? The following code shows the answer is no.<\/p>\n<pre>k = 132 + 42\r\n# loop over numbers whose sum is less than k\r\nfor n in range(1, k):\r\n    for a in range(1, n):\r\n        b = n - a\r\n        r = M(a)\/M(b)\r\n        if abs(r - pi) &lt; 0.001:\r\n            print(a, b, r)\r\n            exit()\r\n<\/pre>\n<h2>Related posts<\/h2>\n<ul>\n<li class='link'><a href='https:\/\/www.johndcook.com\/blog\/2024\/09\/01\/pell-numbers\/'>Pell is to silver as Fibonacci is to gold<\/a><\/li>\n<li class='link'><a href='https:\/\/www.johndcook.com\/blog\/2024\/10\/10\/golden-ellipse\/'>Golden ellipse<\/a><\/li>\n<li class='link'><a href='https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/derivative-equals-inverse\/'>Derivative equals inverse<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The golden ratio is the first and best known of the metallic ratios. I&#8217;ve written about the silver ratio a few times, most recently here. And I&#8217;ve mentioned the bronze ratio a couple times. The metallic ratios after bronze don&#8217;t have standard names. The nth metallic ratio M(n) is the number whose continued fraction representation [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[],"class_list":["post-247532","post","type-post","status-publish","format-standard","hentry","category-math"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"The golden ratio is the first and best known of the metallic ratios. I&#039;ve written about the silver ratio a few times, most recently here. And I&#039;ve mentioned the bronze ratio a couple times. The metallic ratios after bronze don&#039;t have standard names. The nth metallic ratio M(n) is the number whose continued fraction representation\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/ratio-of-metallic-ratios\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Ratio of metallic ratios\" \/>\n\t\t<meta property=\"og:description\" content=\"The golden ratio is the first and best known of the metallic ratios. I&#039;ve written about the silver ratio a few times, most recently here. And I&#039;ve mentioned the bronze ratio a couple times. The metallic ratios after bronze don&#039;t have standard names. The nth metallic ratio M(n) is the number whose continued fraction representation\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/ratio-of-metallic-ratios\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-04T11:41:49+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-04T11:41:49+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Ratio of metallic ratios\" \/>\n\t\t<meta name=\"twitter:description\" content=\"The golden ratio is the first and best known of the metallic ratios. I&#039;ve written about the silver ratio a few times, most recently here. And I&#039;ve mentioned the bronze ratio a couple times. The metallic ratios after bronze don&#039;t have standard names. The nth metallic ratio M(n) is the number whose continued fraction representation\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Ratio of metallic ratios","description":"The golden ratio is the first and best known of the metallic ratios. I've written about the silver ratio a few times, most recently here. And I've mentioned the bronze ratio a couple times. The metallic ratios after bronze don't have standard names. The nth metallic ratio M(n) is the number whose continued fraction representation","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/ratio-of-metallic-ratios\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Ratio of metallic ratios","og:description":"The golden ratio is the first and best known of the metallic ratios. I've written about the silver ratio a few times, most recently here. And I've mentioned the bronze ratio a couple times. The metallic ratios after bronze don't have standard names. The nth metallic ratio M(n) is the number whose continued fraction representation","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/ratio-of-metallic-ratios\/","article:published_time":"2026-08-04T11:41:49+00:00","article:modified_time":"2026-08-04T11:41:49+00:00","twitter:card":"summary","twitter:title":"Ratio of metallic ratios","twitter:description":"The golden ratio is the first and best known of the metallic ratios. I've written about the silver ratio a few times, most recently here. And I've mentioned the bronze ratio a couple times. The metallic ratios after bronze don't have standard names. The nth metallic ratio M(n) is the number whose continued fraction representation","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247532","title":null,"description":null,"keywords":null,"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-08-04 10:51:59","updated":"2026-08-05 17:40:38","ai":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tRatio of metallic ratios\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Ratio of metallic ratios","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/04\/ratio-of-metallic-ratios\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247532"}],"version-history":[{"count":1,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247532\/revisions"}],"predecessor-version":[{"id":247535,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247532\/revisions\/247535"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247524,"date":"2026-08-02T15:47:53","date_gmt":"2026-08-02T20:47:53","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247524"},"modified":"2026-08-04T04:57:39","modified_gmt":"2026-08-04T09:57:39","slug":"holonomic-functions","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/holonomic-functions\/","title":{"rendered":"Holonomic functions"},"content":{"rendered":"<p><a href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/01\/why-polynomial-coefficients\/\">Yesterday<\/a> I wrote that a lot of the special functions that pop up in mathematical physics are solutions to second order linear differential equations with polynomial coefficients. More generally,<strong> holonomic functions<\/strong> are defined to be those functions that are the solutions to linear differential equations, of any order, with polynomial coefficients.<\/p>\n<p>Most special functions are holonomic. To quantify that statement, I went through the special functions covered in Abramowitz and Stegun. The large majority are holonomic, though some common functions like the gamma function are not holonomic.<\/p>\n<p><a href=\"https:\/\/www.johndcook.com\/holonomic_odes_abramowitz_stegun.pdf\">This report<\/a> goes through the functions in A&amp;S. For those that are holonomic, it gives the differential equation that the function solves. The large majority of these equations are second order, but not all. And the coefficients are nearly always first or second order polynomials, rarely higher order.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yesterday I wrote that a lot of the special functions that pop up in mathematical physics are solutions to second order linear differential equations with polynomial coefficients. More generally, holonomic functions are defined to be those functions that are the solutions to linear differential equations, of any order, with polynomial coefficients. Most special functions are [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[47,129],"class_list":["post-247524","post","type-post","status-publish","format-standard","hentry","category-math","tag-differential-equations","tag-special-functions"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Most special functions are holonomic, meaning that they can be defined by linear differential equations with polynomial coefficients.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"differential equations,special functions\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/holonomic-functions\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Holonomic functions\" \/>\n\t\t<meta property=\"og:description\" content=\"Most special functions are holonomic, meaning that they can be defined by linear differential equations with polynomial coefficients.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/holonomic-functions\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-02T20:47:53+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-04T09:57:39+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Holonomic functions\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Most special functions are holonomic, meaning that they can be defined by linear differential equations with polynomial coefficients.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Holonomic functions","description":"Most special functions are holonomic, meaning that they can be defined by linear differential equations with polynomial coefficients.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/holonomic-functions\/","robots":"max-image-preview:large","keywords":"differential equations,special functions","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Holonomic functions","og:description":"Most special functions are holonomic, meaning that they can be defined by linear differential equations with polynomial coefficients.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/holonomic-functions\/","article:published_time":"2026-08-02T20:47:53+00:00","article:modified_time":"2026-08-04T09:57:39+00:00","twitter:card":"summary","twitter:title":"Holonomic functions","twitter:description":"Most special functions are holonomic, meaning that they can be defined by linear differential equations with polynomial coefficients.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247524","title":null,"description":"Most special functions are holonomic, meaning that they can be defined by linear differential equations with polynomial coefficients.","keywords":null,"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-08-02 20:34:46","updated":"2026-08-05 17:40:39","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHolonomic functions\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Holonomic functions","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/holonomic-functions\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247524"}],"version-history":[{"count":2,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247524\/revisions"}],"predecessor-version":[{"id":247531,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247524\/revisions\/247531"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247518,"date":"2026-08-02T12:57:31","date_gmt":"2026-08-02T17:57:31","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247518"},"modified":"2026-08-02T19:20:01","modified_gmt":"2026-08-03T00:20:01","slug":"estimating-a-cumulative-sum","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/estimating-a-cumulative-sum\/","title":{"rendered":"Estimating a cumulative sum"},"content":{"rendered":"<p>In <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/01\/counting-rooted-trees\/\">this post<\/a> I mentioned two series which I denoted\u00a0<em>t<\/em>(<em>n<\/em>) and\u00a0<em>c<\/em>(<em>n<\/em>). The former is the number of unlabeled rooted trees with\u00a0<em>n<\/em> nodes. The latter is the cumulative sum of the former, i.e.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/cumsum_asymp1.svg\" alt=\"c(n) =\u00a0t(1) +\u00a0t(2) +\u00a0t(3) + \\cdots +\u00a0t(n)\" width=\"320\" height=\"18\" \/><\/p>\n<p>The sequence\u00a0<em>c<\/em>(<em>n<\/em>) is also the number of constraints on an <em>n<\/em>-step Runge-Kutta method; that&#8217;s how I became interested in it.<\/p>\n<p>Now the\u00a0<em>t<\/em>(<em>n<\/em>) sequence has been cataloged as OEIS <a href=\"https:\/\/oeis.org\/A000081\">A000081<\/a> and OEIS gives the asymptotic estimate of\u00a0<em>t<\/em>(<em>n<\/em>) for large\u00a0<em>n<\/em> as<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/cumsum_asymp2.svg\" alt=\"t(n) \\sim C \\frac{a^n}{n^{3\/2}}\" width=\"105\" height=\"42\" \/><\/p>\n<p>where <em>C<\/em>\u00a0= 0.4399\u2026 and \u03b1 = 2.9557\u2026.<\/p>\n<p>The cumulative sum of\u00a0<em>t<\/em>(<em>n<\/em>), what I&#8217;ve called\u00a0<em>c<\/em>(<em>n<\/em>), is also cataloged in OEIS, sequence number <a href=\"https:\/\/oeis.org\/A087803\">A087803<\/a>. However, OEIS does not give an asymptotic estimate for this sequence. I&#8217;ll give one here.<\/p>\n<p>(Update: After looking closer at the page for A087803 I see that there is an asymptotic formula, the same one derived here.)<\/p>\n<p>The basis for my derivation is to assume the cumulative sum of the asymptotic estimates gives an asymptotic estimate of the cumulative sum. This is justified by the fact that the sequence is increasing rapidly and only the last few terms contribute much relatively to the sum.<\/p>\n<p>The technique illustrated here would be applicable to the cumulative sum of other series whose asymptotic form is known.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/cumsum_asymp.svg\" alt=\"\\begin{align*} c(n) &amp;= \\sum_{n=1}^N t(n) \\\\ &amp;\\sim \\sum_{n=1}^N C \\frac{a^n}{n^{3\/2}}\\\\ &amp;= C \\frac{a^N}{N^{3\/2}} \\sum_{k=0}^{N-1} a^{-k}\\left(1 - \\frac{k}{N} \\right)^{-3\/2} \\\\ &amp;\\sim C \\frac{a^N}{N^{3\/2}} \\sum_{k=0}^\\infty a^{-k} \\\\ &amp;= C \\frac{a^N}{N^{3\/2}} \\frac{a}{a-1} \\\\ &amp;= C \\frac{a^{N+1}}{(a-1)N^{3\/2}} \\end{align*} \" width=\"280\" height=\"371\" \/><\/p>\n<p>Here&#8217;s code to visualize the rate of convergence.<\/p>\n<pre>import numpy as np\r\nimport matplotlib.pyplot as plt\r\n\r\n# from https:\/\/oeis.org\/A000081\/b000081.txt\r\nA000081 = [\r\n    0,\r\n    1,\r\n    1,\r\n    2,\r\n    4,\r\n    ...\r\n    51384328351659326880337136395054298255277970,\r\n]  \r\nA087803 = np.cumsum(A000081)\r\n\r\ndef approx(n):\r\n    C = 0.43992401257102530\r\n    a = 2.95576528565199497\r\n    return C*a**(n+1)*n**(-3\/2)\/(a - 1)\r\n\r\nn = np.arange(len(A087803))\r\nratio = A087803\/approx(n)\r\n\r\nplt.plot(n[1:], ratio[1:])\r\nplt.plot(n, 0*n + 1, '--')\r\nplt.xlabel(\"$n$\")\r\nplt.ylabel(\"exact\/approx\")\r\nplt.show()\r\n<\/pre>\n<p>Here&#8217;s the plot:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/cumsum_asymp_plot.png\" width=\"640\" height=\"480\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post I mentioned two series which I denoted\u00a0t(n) and\u00a0c(n). The former is the number of unlabeled rooted trees with\u00a0n nodes. The latter is the cumulative sum of the former, i.e. The sequence\u00a0c(n) is also the number of constraints on an n-step Runge-Kutta method; that&#8217;s how I became interested in it. Now the\u00a0t(n) sequence [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[],"class_list":["post-247518","post","type-post","status-publish","format-standard","hentry","category-math"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Asymptotic formula for the cumulative sum of a series whose asymptotic form is known. Applied to rooted trees and Runge-Kutta constraints.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/estimating-a-cumulative-sum\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Estimating a cumulative sum\" \/>\n\t\t<meta property=\"og:description\" content=\"Asymptotic formula for the cumulative sum of a series whose asymptotic form is known. Applied to rooted trees and Runge-Kutta constraints.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/estimating-a-cumulative-sum\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-02T17:57:31+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-03T00:20:01+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Estimating a cumulative sum\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Asymptotic formula for the cumulative sum of a series whose asymptotic form is known. Applied to rooted trees and Runge-Kutta constraints.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Estimating a cumulative sum","description":"Asymptotic formula for the cumulative sum of a series whose asymptotic form is known. Applied to rooted trees and Runge-Kutta constraints.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/estimating-a-cumulative-sum\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Estimating a cumulative sum","og:description":"Asymptotic formula for the cumulative sum of a series whose asymptotic form is known. Applied to rooted trees and Runge-Kutta constraints.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/estimating-a-cumulative-sum\/","article:published_time":"2026-08-02T17:57:31+00:00","article:modified_time":"2026-08-03T00:20:01+00:00","twitter:card":"summary","twitter:title":"Estimating a cumulative sum","twitter:description":"Asymptotic formula for the cumulative sum of a series whose asymptotic form is known. Applied to rooted trees and Runge-Kutta constraints.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247518","title":null,"description":"Asymptotic formula for the cumulative sum of a series whose asymptotic form is known. Applied to rooted trees and Runge-Kutta constraints.","keywords":null,"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-08-02 13:16:46","updated":"2026-08-05 17:40:39","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tEstimating a cumulative sum\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Estimating a cumulative sum","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/02\/estimating-a-cumulative-sum\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247518"}],"version-history":[{"count":6,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247518\/revisions"}],"predecessor-version":[{"id":247527,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247518\/revisions\/247527"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247512,"date":"2026-08-01T15:18:41","date_gmt":"2026-08-01T20:18:41","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247512"},"modified":"2026-08-01T16:13:18","modified_gmt":"2026-08-01T21:13:18","slug":"why-polynomial-coefficients","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/01\/why-polynomial-coefficients\/","title":{"rendered":"Why polynomial coefficients?"},"content":{"rendered":"<p>Second order linear differential equations with polynomial coefficients form their own area of study. This seems like a narrow class of equations, but it&#8217;s very important in applications.<\/p>\n<p>This class of equations seems like a mathematically natural topic, but why is it so important in applications? I did a PhD in differential equations without ever learning why. The theory of second order linear equations with polynomial coefficients is too complicated for undergraduate courses [0] and too well-established for graduate courses [1]. <\/p>\n<p>The explanation that I was missing can be found in the first chapter of [2]. The PDEs that are common in physics are separable in various coordinate systems, meaning that in these coordinate systems the PDEs reduce to ODEs. These ODEs either have polynomial coefficients, or there is a change of variables which makes the ODEs have polynomial coefficients.<\/p>\n<p>See this <a href=\"https:\/\/www.johndcook.com\/separable_helmholtz.pdf\">writeup<\/a> that looks at the Helmholtz and Laplace equations in 11 coordinate systems.<\/p>\n<p>[0] You may see the simplest parts of the theory in a section on solving ODEs with power series. But textbooks don&#8217;t go very far for good reasons.<\/p>\n<p>[1] Unfortunately, a lot of really useful topics are left out of the graduate curriculum because they&#8217;re too well understood to provide thesis topics. Or the problems that are still open have been open for so long that they&#8217;re likely too hard to be cracked by a graduate student.<\/p>\n<p>[2] Gerhard Kristensson. Second Order Differential Equations: Special Functions and their Classification. Springer, 2010.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Second order linear differential equations with polynomial coefficients form their own area of study. This seems like a narrow class of equations, but it&#8217;s very important in applications. This class of equations seems like a mathematically natural topic, but why is it so important in applications? I did a PhD in differential equations without ever [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[47,170],"class_list":["post-247512","post","type-post","status-publish","format-standard","hentry","category-math","tag-differential-equations","tag-science"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Why is one special area of differential equations -- linear second order equations with polynomial coefficients -- so mature and important in applications?\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"differential equations,science\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/01\/why-polynomial-coefficients\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Why polynomial coefficients?\" \/>\n\t\t<meta property=\"og:description\" content=\"Why is one special area of differential equations -- linear second order equations with polynomial coefficients -- so mature and important in applications?\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/01\/why-polynomial-coefficients\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-01T20:18:41+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-01T21:13:18+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Why polynomial coefficients?\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Why is one special area of differential equations -- linear second order equations with polynomial coefficients -- so mature and important in applications?\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Why polynomial coefficients?","description":"Why is one special area of differential equations -- linear second order equations with polynomial coefficients -- so mature and important in applications?","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/01\/why-polynomial-coefficients\/","robots":"max-image-preview:large","keywords":"differential equations,science","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Why polynomial coefficients?","og:description":"Why is one special area of differential equations -- linear second order equations with polynomial coefficients -- so mature and important in applications?","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/01\/why-polynomial-coefficients\/","article:published_time":"2026-08-01T20:18:41+00:00","article:modified_time":"2026-08-01T21:13:18+00:00","twitter:card":"summary","twitter:title":"Why polynomial coefficients?","twitter:description":"Why is one special area of differential equations -- linear second order equations with polynomial coefficients -- so mature and important in applications?","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247512","title":null,"description":"Why is one special area of differential equations -- linear second order equations with polynomial coefficients -- so mature and important in applications?","keywords":null,"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-08-01 18:36:06","updated":"2026-08-05 17:40:39","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tWhy polynomial coefficients?\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Why polynomial coefficients?","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/01\/why-polynomial-coefficients\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247512"}],"version-history":[{"count":4,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247512\/revisions"}],"predecessor-version":[{"id":247516,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247512\/revisions\/247516"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}]