[{"id":247940,"date":"2026-09-21T18:13:22","date_gmt":"2026-09-21T23:13:22","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247940"},"modified":"2026-09-21T18:13:22","modified_gmt":"2026-09-21T23:13:22","slug":"haversine-law","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/21\/haversine-law\/","title":{"rendered":"Haversine law"},"content":{"rendered":"<p>Suppose you want to solve a triangle. You know two sides and the angle between them. Then you can solve for the third side using the law of cosines.<\/p>\n<p>Now suppose you want to solve a\u00a0<strong>big<\/strong> triangle, a triangle on the surface of the earth so large that the curvature of the earth matters. You can still use the law of cosines, but you&#8217;ll need <a href=\"https:\/\/www.johndcook.com\/blog\/2022\/08\/24\/law-of-cosines-on-a-sphere\/\">the spherical law of cosines<\/a>:<\/p>\n<p style=\"padding-left: 40px;\">cos(<em>c<\/em>) = cos(<em>a<\/em>) cos(<em>b<\/em>) + sin(<em>a<\/em>) sin(<em>b<\/em>) cos(<em>C<\/em>).<\/p>\n<p>If you know the (angular) lengths of sides\u00a0<em>a<\/em> and\u00a0<em>b<\/em>, and (tangential) angle\u00a0<em>C<\/em> between the two sides, you can solve for\u00a0<em>c<\/em> by taking the inverse cosine of the right hand side above.<\/p>\n<p>Now suppose you want to solve this big triangle because you&#8217;re a <strong>navigator<\/strong> on a ship a couple centuries ago, doing calculations by looking up trig functions and inverse trig functions in a table. You&#8217;re interested in triangles that are so big that you have to account for the fact that you&#8217;re living on a sphere. But at the same time, you&#8217;re triangles are still fairly small relative to the size of the globe.<\/p>\n<h2>The problem with the law of cosines<\/h2>\n<p>The numbers\u00a0<em>a<\/em> and\u00a0<em>b<\/em> will often be fairly small, and so their cosines will be near 1 and their sines are near zero. So the calculation<\/p>\n<p style=\"padding-left: 40px;\">cos(<em>a<\/em>) cos(<em>b<\/em>) + sin(<em>a<\/em>) sin(<em>b<\/em>) cos(<em>C<\/em>)<\/p>\n<p>will add a number near 1 and a number near zero. That&#8217;s a problem.<\/p>\n<p>Say you&#8217;re working with five decimal place arithmetic. Then if the second term above is less than 10<sup>\u22125<\/sup>, its contribution to the sum gets completely lost in the addition to the first term. If the second term is larger than 10<sup>\u22125<\/sup> but still small, its contribution to the sum will be partially lost.<\/p>\n<h2>Law of haversines<\/h2>\n<p>Enter the <a href=\"https:\/\/www.johndcook.com\/blog\/2009\/09\/25\/how-many-trig-functions\/\">haversine<\/a>, defined by<\/p>\n<p style=\"padding-left: 40px;\">hav(\u03b8) = (1 \u2212 cos(\u03b8))\/2.<\/p>\n<p>The expression 1 \u2212 cos \u03b8 was called the versine, and so half of the versine is the haversine.<\/p>\n<p>In terms of the haversine, the law of cosines above becomes the law of haversines:<\/p>\n<p style=\"padding-left: 40px;\">hav(<em>c<\/em>) = hav(<em>a<\/em> \u2212\u00a0<em>b<\/em>) + sin(<em>a<\/em>) sin(<em>b<\/em>) hav(<em>C<\/em>).<\/p>\n<p>Now suppose you have a table of haversines and inverse haversines. The law of haversines requires a little less work: you have one less table lookup, and you trade a product for a subtraction.<\/p>\n<p>But the primary advantage is numerical accuracy: the terms on the right side have roughly the same size.<\/p>\n<h2>Tables<\/h2>\n<p>Note that we&#8217;re assuming the values in your table of haversines have been calculated correctly to the given precision. If you calculated your own values of haversines from the definition above, you&#8217;d lose precision in the subtraction 1 \u2212 cos \u03b8, defeating the advantage of the law of haversines [1].<\/p>\n<h2>History<\/h2>\n<p>According to <a href=\"https:\/\/en.wikipedia.org\/wiki\/Haversine_formula\">Wikipedia<\/a>.<\/p>\n<blockquote><p>The first table of haversines in English was published by James Andrew in 1805, but Florian Cajori credits an earlier use by Jos\u00e9 de Mendoza y R\u00edos in 1801. The term <em>haversine<\/em> was coined in 1835 by James Inman.<\/p><\/blockquote>\n<h2>Experiments<\/h2>\n<p>I ran some experiments that carried out arithmetic in float16 (11 bits of precision) to approximate what someone might have done by hand. When the difference between <em>a<\/em> and\u00a0<em>b<\/em> was on the order of 1\u00b0 or 0.1\u00b0, the law of cosine method often overflowed: the right-hand side evaluated to something larger than 1 even though theoretically it should be less than 1. The haversine method never overflowed.<\/p>\n<p>The median error for the haversine method was a couple orders of magnitude less than that of the cosine method.<\/p>\n<h2>Related posts<\/h2>\n<ul>\n<li class='link'><a href='https:\/\/www.johndcook.com\/blog\/2025\/12\/01\/lewis-clark-geolocation\/'>Lews &amp; Clark navigation<\/a><\/li>\n<li class='link'><a href='https:\/\/www.johndcook.com\/blog\/2009\/09\/25\/how-many-trig-functions\/'>How many trig functions are there?<\/a><\/li>\n<li class='link'><a href='https:\/\/www.johndcook.com\/blog\/2025\/11\/08\/heron-on-a-sphere\/'>Analog of Heron&#8217;s formula for a sphere<\/a><\/li>\n<\/ul>\n<p>[1] hav(\u03b8) = (1 \u2212 cos(\u03b8))\/2 = sin\u00b2(\u03b8\/2). If you calculated hav \u03b8 by looking up sin(\u03b8\/2) and squaring it, you&#8217;d be doing extra work, but you wouldn&#8217;t have numerical problems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Suppose you want to solve a triangle. You know two sides and the angle between them. Then you can solve for the third side using the law of cosines. Now suppose you want to solve a\u00a0big triangle, a triangle on the surface of the earth so large that the curvature of the earth matters. You [&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":[224,312],"class_list":["post-247940","post","type-post","status-publish","format-standard","hentry","category-math","tag-geometry","tag-navigation"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"The haversine law was used to solve triangles in navigation at sea. It gives more accurate results in practice than the law of cosines.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"geometry,navigation\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/21\/haversine-law\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.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=\"Haversine law\" \/>\n\t\t<meta property=\"og:description\" content=\"The haversine law was used to solve triangles in navigation at sea. It gives more accurate results in practice than the law of cosines.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/21\/haversine-law\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-09-21T23:13:22+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-09-21T23:13:22+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Haversine law\" \/>\n\t\t<meta name=\"twitter:description\" content=\"The haversine law was used to solve triangles in navigation at sea. It gives more accurate results in practice than the law of cosines.\" \/>\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":"Haversine law","description":"The haversine law was used to solve triangles in navigation at sea. It gives more accurate results in practice than the law of cosines.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/21\/haversine-law\/","robots":"max-image-preview:large","keywords":"geometry,navigation","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Haversine law","og:description":"The haversine law was used to solve triangles in navigation at sea. It gives more accurate results in practice than the law of cosines.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/21\/haversine-law\/","article:published_time":"2026-09-21T23:13:22+00:00","article:modified_time":"2026-09-21T23:13:22+00:00","twitter:card":"summary","twitter:title":"Haversine law","twitter:description":"The haversine law was used to solve triangles in navigation at sea. It gives more accurate results in practice than the law of cosines.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247940","title":null,"description":"The haversine law was used to solve triangles in navigation at sea. It gives more accurate results in practice than the law of cosines.","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-09-21 16:29:49","updated":"2026-09-21 23:13:22","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":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\tHaversine law\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":"Haversine law","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/21\/haversine-law\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247940","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=247940"}],"version-history":[{"count":2,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247940\/revisions"}],"predecessor-version":[{"id":247943,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247940\/revisions\/247943"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247934,"date":"2026-09-18T20:17:36","date_gmt":"2026-09-19T01:17:36","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247934"},"modified":"2026-09-19T09:30:16","modified_gmt":"2026-09-19T14:30:16","slug":"logistic-fit-sensitivity","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/18\/logistic-fit-sensitivity\/","title":{"rendered":"Why fitting a logistic is nearly impossible from early data"},"content":{"rendered":"<p>Nothing grows exponentially forever. What appears to be an exponential curve often turns out to be some sort of S curve, such as a logistic curve.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/www.johndcook.com\/logistic_tangents.png\" alt=\"logistic curve with extrapolations\" width=\"480\" height=\"360\" \/><\/p>\n<p>Suppose you&#8217;re collecting data on the left side of the curve. If there&#8217;s even a small amount of error in your data, you won&#8217;t be able to predict the asymptotic value with any accuracy. But if you have data on both sides of the inflection point, you can make a good prediction of the limiting value.<\/p>\n<p>I&#8217;ve written about this <a href=\"https:\/\/www.johndcook.com\/blog\/2025\/12\/20\/fit-logistic-curve\/\">before<\/a>, explaining that the problem is hard, but I didn&#8217;t say\u00a0<em>why<\/em> it&#8217;s hard. Here I&#8217;d like to give an idea why it&#8217;s hard.<\/p>\n<p>Suppose you want to fit a logistic equation<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/logistic_fit1.svg\" alt=\"y(t) = \\frac{L}{1 + \\exp(-k(t - t_0))}\" width=\"197\" height=\"43\" \/><\/p>\n<p>to three distinct values of <em>t<\/em> and the corresponding values of <em>y<\/em>. There is a unique solution, but in general you cannot find a solution in closed form. However, if the values of <em>t<\/em> are evenly spaced<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/logistic_fit2.svg\" alt=\"y_2 - y_1 = y_1 - y_0 = h\" width=\"154\" height=\"20\" \/><\/p>\n<p>there is a method [1] to solve for the parameters <em>L<\/em>, <em>k<\/em>, and <em>t<\/em><sub>0<\/sub>. For this post we&#8217;re only interested in the limiting value <em>L<\/em>, and it can be found by<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/logistic_fit3.svg\" alt=\"L = \\frac{y_1^2(y_0 + y_2) - 2y_0 y_1 y_2}{y_1^2 - y_0 y_2}\" width=\"193\" height=\"54\" \/><\/p>\n<p>independent of\u00a0<em>h<\/em>.<\/p>\n<p>To find out how small changes in the\u00a0<em>y<\/em>&#8216;s change the estimate of\u00a0<em>L<\/em>, we take the partial derivatives of\u00a0<em>L<\/em> with respect to the\u00a0<em>y<\/em>&#8216;s and find<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/logistic_fit4.svg\" alt=\"\\frac{\\partial L}{\\partial y_0} = \\frac{\\partial L}{\\partial y_2} = \\frac{y_1^2\\, h^2}{\\left(y_1^2 - y_0 y_2\\right)^2} \" width=\"191\" height=\"68\" \/><\/p>\n<p>and<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/logistic_fit5.svg\" alt=\"\\frac{\\partial L}{\\partial y_1} = \\frac{-2\\, y_0 y_2\\, h^2}{\\left(y_1^2 - y_0 y_2\\right)^2}\" width=\"143\" height=\"66\" \/><br \/>\nAll three derivatives have the same expression in the denominator: <em>y<\/em><sub>1<\/sub>\u00b2 \u2212 <em>y<\/em><sub>0<\/sub> <em>y<\/em><sub>2<\/sub>.<\/p>\n<p>If the function\u00a0<em>y<\/em>(<em>t<\/em>) were an exponential, this expression would be exactly zero [2]. The function <em>y<\/em>(<em>t<\/em>) is not exactly exponential, but it is <em>approximately<\/em> exponential when the <em>t<\/em>&#8216;s are in the left or right tail of the logistic curve. The further out in either tail the <em>t<\/em>&#8216;s are, the closer the expression is to zero.<\/p>\n<p>So when all the <em>t<\/em>&#8216;s come from the same side of the inflection point, <em>y<\/em>(<em>t<\/em>) is nearly exponential the partial derivatives are huge and so the fitted value of <em>L<\/em> is extremely sensitive to changes in the <em>y<\/em>&#8216;s.<\/p>\n<p>As a concrete example, set\u00a0<em>L<\/em> =\u00a0<em>k<\/em> = 1 and <em>t<\/em><sub>0<\/sub> = 0. Evaluate\u00a0<em>y<\/em>(<em>t<\/em>) at \u22122, \u22121.5, and \u22121. Then the values of\u00a0<em>y<\/em> are<\/p>\n<p style=\"padding-left: 40px;\"><em>y<\/em><sub>0<\/sub> = 0.11920292<br \/>\n<em>y<\/em><sub>1<\/sub> = 0.18242552<br \/>\n<em>y<\/em><sub>2<\/sub> = 0.26894142<\/p>\n<p>If you forecast <em>L<\/em> using exactly these three values you&#8217;ll get <em>L<\/em> = 1.<\/p>\n<p>But if you change <em>y<\/em><sub>0<\/sub> to 0.12374097, the forecasted value of <em>L<\/em> is infinite. Values of <em>y<\/em><sub>0<\/sub> in the interval [0.11920292, 0.12374097] predict values of <em>K<\/em> in [1, \u221e].<\/p>\n<p>[1] Raymond Pearl and Lowell J. Reed. On the Rate of Growth of the Population of the United States Since 1790 and its Mathematical Representation. Proceedings of the National Academy of Sciences of the United States of America, Vol. 6, No. 6 (Jun. 15, 1920), pp. 275-288<\/p>\n<p>[2] exp(<em>x<\/em> +\u00a0<em>h<\/em>)\u00b2 = exp(<em>x<\/em>)\u00b2 exp(<em>h<\/em>)\u00b2 = exp(<em>x<\/em>) exp(<em>x<\/em> + 2<em>h<\/em>)<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nothing grows exponentially forever. What appears to be an exponential curve often turns out to be some sort of S curve, such as a logistic curve. Suppose you&#8217;re collecting data on the left side of the curve. If there&#8217;s even a small amount of error in your data, you won&#8217;t be able to predict 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":[106],"class_list":["post-247934","post","type-post","status-publish","format-standard","hentry","category-math","tag-probability-and-statistics"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Why fitting a logistic to data is very sensitive when all the data are on one side of the inflection point.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"probability and statistics\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/18\/logistic-fit-sensitivity\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.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 fitting a logistic is nearly impossible from early data\" \/>\n\t\t<meta property=\"og:description\" content=\"Why fitting a logistic to data is very sensitive when all the data are on one side of the inflection point.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/18\/logistic-fit-sensitivity\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-09-19T01:17:36+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-09-19T14:30:16+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Why fitting a logistic is nearly impossible from early data\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Why fitting a logistic to data is very sensitive when all the data are on one side of the inflection point.\" \/>\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 fitting a logistic is nearly impossible from early data","description":"Why fitting a logistic to data is very sensitive when all the data are on one side of the inflection point.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/18\/logistic-fit-sensitivity\/","robots":"max-image-preview:large","keywords":"probability and statistics","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Why fitting a logistic is nearly impossible from early data","og:description":"Why fitting a logistic to data is very sensitive when all the data are on one side of the inflection point.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/18\/logistic-fit-sensitivity\/","article:published_time":"2026-09-19T01:17:36+00:00","article:modified_time":"2026-09-19T14:30:16+00:00","twitter:card":"summary","twitter:title":"Why fitting a logistic is nearly impossible from early data","twitter:description":"Why fitting a logistic to data is very sensitive when all the data are on one side of the inflection point.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247934","title":null,"description":"Why fitting a logistic to data is very sensitive when all the data are on one side of the inflection point.","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-09-18 23:53:59","updated":"2026-09-21 16:29:59","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":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 fitting a logistic is nearly impossible from early data\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 fitting a logistic is nearly impossible from early data","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/18\/logistic-fit-sensitivity\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247934","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=247934"}],"version-history":[{"count":5,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247934\/revisions"}],"predecessor-version":[{"id":247939,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247934\/revisions\/247939"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247924,"date":"2026-09-17T11:48:14","date_gmt":"2026-09-17T16:48:14","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247924"},"modified":"2026-09-18T07:10:00","modified_gmt":"2026-09-18T12:10:00","slug":"empirical-fractal","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/17\/empirical-fractal\/","title":{"rendered":"Empirical fractal"},"content":{"rendered":"<p>There&#8217;s a common saying in discussion of fractals that the length of a coastline depends on how small a device you use to measure it. I thought this was a hypothetical, say as applied to the steps in the construction of the Koch snowflake. But the saying has its roots in actually surveying.<\/p>\n<p>Lewis Fry Richardson (1881\u20131953) noticed that the length of the coast of Scotland depended on the size of segments used to measure it. More specifically, he found that the length followed a power law, i.e. that there&#8217;s a linear relation between the log of the coastline length and the log of the ruler length.<\/p>\n<p>Here&#8217;s a reproduction of Richardson&#8217;s plot, taken from [1].<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/scottish_coast.png\" width=\"500\" height=\"351\" \/><\/p>\n<p>Mandelbrot built on Richardson&#8217;s observation and defined the idea of fractal dimension.<\/p>\n<p>I was under the impression that fractals were invented as mathematical novelties that researchers later found applications for. But as is often the case, the applications came first. Or at least <em>some<\/em> applications came first.<\/p>\n<p>Ideally there&#8217;s always a feedback cycle where applications lead to theory and theory leads to applications. As Donald Knuth put it, &#8220;The best theory is inspired by practice. The best practice is inspired by theory.&#8221;<\/p>\n<h2>Related posts<\/h2>\n<ul>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2025\/09\/04\/minimalist-mandelbrot-set\/\">Minimalist Mandelbrot set<\/a><\/li>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2021\/07\/11\/fractal-brownian-motion\/\">The fractal nature of Brownian motion<\/a><\/li>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2025\/08\/16\/randomly-generated-dragon\/\">Randomly generated dragon<\/a><\/li>\n<\/ul>\n<p>[1] Eoghan Bradley and Mark McCartney. Four hundred years of the fractal coastline of Scotland. The Mathematical Gazette, November 2019, Vol. 103, No. 558 (November 2019), pp. 518-521<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There&#8217;s a common saying in discussion of fractals that the length of a coastline depends on how small a device you use to measure it. I thought this was a hypothetical, say as applied to the steps in the construction of the Koch snowflake. But the saying has its roots in actually surveying. Lewis Fry [&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":[224],"class_list":["post-247924","post","type-post","status-publish","format-standard","hentry","category-math","tag-geometry"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Richardson&#039;s measurements of the coast of Scotland were a precursor to the theory of fractals.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"geometry\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/17\/empirical-fractal\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.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=\"Empirical fractal\" \/>\n\t\t<meta property=\"og:description\" content=\"Richardson&#039;s measurements of the coast of Scotland were a precursor to the theory of fractals.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/17\/empirical-fractal\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-09-17T16:48:14+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-09-18T12:10:00+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Empirical fractal\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Richardson&#039;s measurements of the coast of Scotland were a precursor to the theory of fractals.\" \/>\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":"Empirical fractal","description":"Richardson's measurements of the coast of Scotland were a precursor to the theory of fractals.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/17\/empirical-fractal\/","robots":"max-image-preview:large","keywords":"geometry","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Empirical fractal","og:description":"Richardson's measurements of the coast of Scotland were a precursor to the theory of fractals.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/17\/empirical-fractal\/","article:published_time":"2026-09-17T16:48:14+00:00","article:modified_time":"2026-09-18T12:10:00+00:00","twitter:card":"summary","twitter:title":"Empirical fractal","twitter:description":"Richardson's measurements of the coast of Scotland were a precursor to the theory of fractals.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247924","title":null,"description":"Richardson's measurements of the coast of Scotland were a precursor to the theory of fractals.","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-09-17 16:30:32","updated":"2026-09-18 12:10:01","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":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\tEmpirical fractal\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":"Empirical fractal","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/17\/empirical-fractal\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247924","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=247924"}],"version-history":[{"count":6,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247924\/revisions"}],"predecessor-version":[{"id":247931,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247924\/revisions\/247931"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247924"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247915,"date":"2026-09-17T09:03:51","date_gmt":"2026-09-17T14:03:51","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247915"},"modified":"2026-09-18T09:15:24","modified_gmt":"2026-09-18T14:15:24","slug":"phone-words","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/17\/phone-words\/","title":{"rendered":"Phone words"},"content":{"rendered":"<p>I recently bought a copy of Los Alamos Rolodex, a book displaying business cards from Los Alamos Nation Labs from 1967 to 1978. You can find some examples of the cards <a href=\"https:\/\/clui.org\/collections\/los-alamos-business-cards\/selection-cards\">here<\/a>.<\/p>\n<p>One of the cards in the book is for Eugene Frank, President of B &amp; F Instruments. His card lists his phone number as<\/p>\n<p style=\"padding-left: 40px;\">(215) MErcury 9-7100<\/p>\n<p>At first glance I thought the &#8220;E&#8221; in &#8220;MErcury&#8221; had been accidentally capitalized. Then I realized the intention was that someone would dial ME (i.e. 63) and ingore &#8220;rcury&#8221;. So the phone number would be (215) 639-7100.<\/p>\n<p>This card was from 1968, the height of the space race. Maybe the card was alluding to the Project Mercury or the planet Mercury, or both. [1]<\/p>\n<p>The telephone keypad mapping (ITU E.161 standard) is a poor attempt at making phone numbers more memorable. For starters, there&#8217;s no way to encode 0 or 1 [2]. It&#8217;s unlikely a phone number will correspond to anything memorable unless you come up with the word first and then try to obtain the phone number, such as 800 FLOWERS.<\/p>\n<p>Inserting extra letters, as Mr. Frank did, greatly increases the chances of encoding a phone number as a word. But then you need to denote which letters count and which ones are filler, so there&#8217;s not much advantage. Still, I wanted to play around with it for fun. I found 109 words [3] containing the letters from a telephone encoding of 4228646. (I&#8217;m using the file <code>\/usr\/share\/dict\/words<\/code> on my laptop as my list of words.)<\/p>\n<p>Here are some of the more interesting hits.<\/p>\n<ul>\n<li>semicatholicism<\/li>\n<li>heartburning<\/li>\n<li>gladiatorism<\/li>\n<li>diabetogenic<\/li>\n<li>galactogenetic<\/li>\n<li>xanthocreatinine<\/li>\n<\/ul>\n<p>There are over 30,000 words containing an encoding of the area code 832. One of these is <em>traditional<\/em>, and so I could write my phone number as<\/p>\n<p style=\"padding-left: 40px;\"><code>TraDitionAl semICAThOlIcisM<\/code>.<\/p>\n<p>Another choice for 832 is <em>intercosmic<\/em>, so<\/p>\n<p style=\"padding-left: 40px;\"><code>inTErCosmic GAlaCTOGeNetic<\/code><\/p>\n<p>is another possibility.<\/p>\n<p><em>Galactogentic<\/em> can refer to the production of milk by the mammary glands or to the formation of galaxies (e.g. the Milky Way). Here <em>intercosmic<\/em> fits with the later sense.<\/p>\n<p>I got greedy and tried to find a word containing the full phone number, 8324228646, but didn&#8217;t find anything.<\/p>\n<p>Here&#8217;s my business card in the style of the Los Alamos Rolodex cards, created by Grok, using (832) GlAdiATOrIsM as the phone number.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/vintage_card.png\" width=\"600\" height=\"366\" \/><\/p>\n<p>Now suppose you remembered &#8220;gladiatorism&#8221; but not which letters were capitalized. Then you&#8217;d have to try up to 792, i.e. 12 choose 7, possible numbers, so this really isn&#8217;t a practical mnemonic. If you remembered &#8220;traditional semicatholicism&#8221; without capitalization it would be worse, with over a million possibilities (11 choose 3 times 15 choose 7). Some possibilities are counted twice, since different ways of selecting letters can lead to the same phone number, but still there are too many possibilities to try.<\/p>\n<h2>Related posts<\/h2>\n<ul>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2021\/07\/26\/major-memory-keypad\/\">Major memory system telephone keypad<\/a><\/li>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2023\/11\/17\/phone-number-intel\/\">What can you learn from a phone number?<\/a><\/li>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2022\/03\/14\/phone-tones-in-musical-notation\/\">Phone tones inn musical notation<\/a><\/li>\n<\/ul>\n<p>[1] Thanks to Andrew for pointing out in his comment that it was common at one time to encode the first two numbers of the exchange (the second triplet of numbers in a phone number) as letters, and assign a word to those letters. Sometimes this was standardized, such as Pennsylvania 6 for 736, an example made famous by Glenn Miller. But from what I can tell, not all exchanges had standard names, and proposed standards weren&#8217;t always adopted in practice.<\/p>\n<p>In the example above, I don&#8217;t know whether it was common to encode 639 as Mercury 9, or even ME 9, or whether Mr. Frank chose this. It was common chose\u00a0<em>some<\/em> encoding for the first two numbers of the exchange, though that practice was going away by 1968. Perhaps Mr. Frank was an older man who retained a habit he acquired when it was more common. None of the other cards in the book spelled out the exchange.<\/p>\n<p><strong>Update<\/strong>: Thanks to Chuck for pointing out this <a href=\"https:\/\/en.wikipedia.org\/wiki\/Telephone_exchange_names#Standardization\">list<\/a> of recommended words for exchanges. Note that there are multiple suggestions for most exchanges, including six for 63X.<\/p>\n<p>[2] Not only are there no letters for 0 and 1, the letters O and I represent digits. At one point in time the first digit of an exchange (the middle three digits) could not be a 0 or 1, but these digits could appear anywhere else.<\/p>\n<p>[3] I initially found a list of 185 words, but some of these were duplicates: a word can represent a phone number in more than one way.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently bought a copy of Los Alamos Rolodex, a book displaying business cards from Los Alamos Nation Labs from 1967 to 1978. You can find some examples of the cards here. One of the cards in the book is for Eugene Frank, President of B &amp; F Instruments. His card lists his phone number [&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-247915","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Vintage business cards and phone number encodings adding extra letters.\" \/>\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\/09\/17\/phone-words\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.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=\"Phone words\" \/>\n\t\t<meta property=\"og:description\" content=\"Vintage business cards and phone number encodings adding extra letters.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/17\/phone-words\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-09-17T14:03:51+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-09-18T14:15:24+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Phone words\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Vintage business cards and phone number encodings adding extra letters.\" \/>\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":"Phone words","description":"Vintage business cards and phone number encodings adding extra letters.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/17\/phone-words\/","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":"Phone words","og:description":"Vintage business cards and phone number encodings adding extra letters.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/17\/phone-words\/","article:published_time":"2026-09-17T14:03:51+00:00","article:modified_time":"2026-09-18T14:15:24+00:00","twitter:card":"summary","twitter:title":"Phone words","twitter:description":"Vintage business cards and phone number encodings adding extra letters.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247915","title":null,"description":"Vintage business cards and phone number encodings adding extra letters.","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-09-17 11:34:21","updated":"2026-09-18 23:55:03","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":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\tPhone words\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":"Phone words","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/17\/phone-words\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247915","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=247915"}],"version-history":[{"count":9,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247915\/revisions"}],"predecessor-version":[{"id":247933,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247915\/revisions\/247933"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247909,"date":"2026-09-16T11:05:11","date_gmt":"2026-09-16T16:05:11","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247909"},"modified":"2026-09-16T11:05:11","modified_gmt":"2026-09-16T16:05:11","slug":"concentration-ratio","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/concentration-ratio\/","title":{"rendered":"Converting between cosine similarity and concentration ratio"},"content":{"rendered":"<p>I&#8217;ve written three posts on cosine similarity lately. The <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/cosine-similarity\/\">first<\/a> looked at interpreting cosine similarity. The <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/simple-approximation-for-spherical-cap-area\/\">second<\/a> looked at an approximation related to the first. The <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/coffee-milk-latte\/\">third<\/a> looked at how ranking according to cosine similarity works better than cosine similarity itself.<\/p>\n<p>Normalized word vectors are points on a high dimensional sphere, and geometry in high dimensions is counterintuitive. See the first post in this series for an explanation.<\/p>\n<p>The set of points within a given angular distance of a point on a hypersphere is called a <a href=\"https:\/\/www.johndcook.com\/blog\/2023\/08\/09\/hypersphere-cap\/\">spherical cap<\/a>. The ratio of the area of this spherical cap to that of the whole sphere is called <strong>cap fraction<\/strong> or <strong>concentration ratio<\/strong>. Concentration ratio explains why a modest cosine similarity value corresponds to a tiny portion of the area of the sphere and should be interpreted as a close match.<\/p>\n<p>For this post, I wanted to share a plot of concentration ratio as a function of cosine similarity.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/concentration_ratio.png\" width=\"480\" height=\"360\" \/><\/p>\n<p>This shows that moderate values of cosine similarity correspond to infinitesimal concentration ratios. And yet, as the third post linked at the top showed, word vectors are very unevenly distributed, and even extremely small regions of the sphere can contain multiple word vectors.<\/p>\n<p>I only included cosine similarity values up to 0.8 because the function plotted above takes a nosedive for larger values, even on a logarithmic scale.<\/p>\n<p>Here&#8217;s the Python code to make the plot, using the function <code>cap_fraction<\/code> from <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/simple-approximation-for-spherical-cap-area\/\">here<\/a>.<\/p>\n<pre>\r\ns = np.linspace(0, 0.8, 500)\r\nplt.plot(s, cap_fraction(np.acos(s), 200))\r\nplt.yscale(\"log\")\r\nplt.xlabel(\"cosine similarity\")\r\nplt.ylabel(\"concentration ratio\")\r\nplt.show()\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve written three posts on cosine similarity lately. The first looked at interpreting cosine similarity. The second looked at an approximation related to the first. The third looked at how ranking according to cosine similarity works better than cosine similarity itself. Normalized word vectors are points on a high dimensional sphere, and geometry in high [&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":[224,146],"class_list":["post-247909","post","type-post","status-publish","format-standard","hentry","category-math","tag-geometry","tag-machine-learning"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Concentration ratio may be easier to understand than cosine similarity, but it&#039;s still a little tricky to understand.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"geometry,machine learning\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/concentration-ratio\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.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=\"Converting between cosine similarity and concentration ratio\" \/>\n\t\t<meta property=\"og:description\" content=\"Concentration ratio may be easier to understand than cosine similarity, but it&#039;s still a little tricky to understand.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/concentration-ratio\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-09-16T16:05:11+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-09-16T16:05:11+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Converting between cosine similarity and concentration ratio\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Concentration ratio may be easier to understand than cosine similarity, but it&#039;s still a little tricky to understand.\" \/>\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":"Converting between cosine similarity and concentration ratio","description":"Concentration ratio may be easier to understand than cosine similarity, but it's still a little tricky to understand.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/concentration-ratio\/","robots":"max-image-preview:large","keywords":"geometry,machine learning","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Converting between cosine similarity and concentration ratio","og:description":"Concentration ratio may be easier to understand than cosine similarity, but it's still a little tricky to understand.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/concentration-ratio\/","article:published_time":"2026-09-16T16:05:11+00:00","article:modified_time":"2026-09-16T16:05:11+00:00","twitter:card":"summary","twitter:title":"Converting between cosine similarity and concentration ratio","twitter:description":"Concentration ratio may be easier to understand than cosine similarity, but it's still a little tricky to understand.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247909","title":null,"description":"Concentration ratio may be easier to understand than cosine similarity, but it's still a little tricky to understand.","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-09-16 15:28:04","updated":"2026-09-16 18:00:59","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":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\tConverting between cosine similarity and concentration ratio\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":"Converting between cosine similarity and concentration ratio","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/concentration-ratio\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247909","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=247909"}],"version-history":[{"count":1,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247909\/revisions"}],"predecessor-version":[{"id":247911,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247909\/revisions\/247911"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247906,"date":"2026-09-16T10:06:58","date_gmt":"2026-09-16T15:06:58","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247906"},"modified":"2026-09-17T10:21:54","modified_gmt":"2026-09-17T15:21:54","slug":"coffee-milk-latte","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/coffee-milk-latte\/","title":{"rendered":"Coffee + milk \u2260 latte"},"content":{"rendered":"<p><a href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/cosine-similarity\/\">Yesterday<\/a> I wrote about the canonical example of how vector embeddings of words add:<\/p>\n<p style=\"padding-left: 40px;\">\u201cking\u201d \u2212 \u201cman\u201d + \u201cwoman\u201d \u2248 \u201cqueen\u201d<\/p>\n<p>This should be interpreted as saying that the word vector for\u00a0<em>king<\/em>, minus the word vector for\u00a0<em>man<\/em>, plus the word vector for\u00a0<em>woman<\/em>, is in some sense close to the word vector for\u00a0<em>queen<\/em>.<\/p>\n<p>This post will look at another example. Is the expression<\/p>\n<p style=\"padding-left: 40px;\">&#8220;coffee&#8221; + &#8220;milk&#8221; \u2248 &#8220;latte&#8221;<\/p>\n<p>true in some sense?<\/p>\n<h2>Notation<\/h2>\n<p>In this post I will use &#8220;foo&#8221; to mean the vector embedding of the word\u00a0<em>foo<\/em>.<\/p>\n<h2>Coffee + milk<\/h2>\n<p>The cosine similarity between &#8220;coffee&#8221; + &#8220;milk&#8221; and &#8220;latte&#8221; is about 0.63. And for reasons given in the previous post, this is a large value of cosine similarity. But there are 11 words that are more similar to &#8220;milk&#8221; + &#8220;coffee&#8221; than &#8220;latte&#8221;. Here are the top 12 matches in order.<\/p>\n<ol>\n<li>coffee<\/li>\n<li>milk<\/li>\n<li>tea<\/li>\n<li>drink<\/li>\n<li>chocolate<\/li>\n<li>cream<\/li>\n<li>breakfast<\/li>\n<li>ice<\/li>\n<li>beer<\/li>\n<li>vanilla<\/li>\n<li>starbucks<\/li>\n<li>latte<\/li>\n<\/ol>\n<p>There are two questions to resolve. First, why isn&#8217;t\u00a0<em>latte<\/em> one of the closest words? Second, why is the cosine similarity large even though\u00a0<em>latte<\/em> is not one of the best matches?<\/p>\n<h2>Concept arithmetic<\/h2>\n<p>When word vector arithmetic works, as in the king and queen example, the vectors combine <em>concepts<\/em>. If you replace the male gender component of <em>king<\/em> with a female component, you get a vector close to the vector for\u00a0<em>queen<\/em>.<\/p>\n<p>But when you add the vectors for\u00a0<em>milk<\/em> and\u00a0<em>coffee<\/em>, you&#8217;re not adding concepts, you&#8217;re adding ingredients.<\/p>\n<p>The concepts of\u00a0<em>milk<\/em> and\u00a0<em>coffee<\/em> are similar in that they&#8217;re both common beverages, as are tea and even beer. A latte is a beverage, but it&#8217;s not as common as milk, coffee, tea, or beer.<\/p>\n<h2>Extremely uneven distribution<\/h2>\n<p>If you divide word vectors by their norm, you get a point on a high-dimensional sphere. In the case of the glove-twitter-200 vector embedding, you get a point on a sphere in 200 dimensions. As explained in the earlier post, a fairly large cosine similarity corresponds to a tiny portion of the sphere&#8217;s surface area.<\/p>\n<p>In the example of \u201cking\u201d \u2212 \u201cman\u201d + \u201cwoman\u201d, the vector &#8220;queen&#8221; is the closest match (except for &#8220;king&#8221; itself).<\/p>\n<p>But there are a lot of words whose vectors are within a tiny region around &#8220;coffee&#8221; + &#8220;milk&#8221;. And by tiny, I mean a region that accounts for a proportion of the sphere on the order of 10<sup>\u221223<\/sup>.<\/p>\n<p>The glove-twitter-200 vector list contains vectors for 1.2 million words. If these vectors were roughly evenly distributed on the sphere when normalized, you&#8217;d expect each patch representing 10<sup>\u22126<\/sup> of the sphere to contain about a word or two. You wouldn&#8217;t expect a patch taking up 10<sup>\u221212 <\/sup>of the sphere to contain more than one word, and you certainly wouldn&#8217;t expect a patch taking up 10<sup>\u221223 <\/sup>of the sphere to contain 12 words [1].<\/p>\n<h2>Rank order<\/h2>\n<p>Rank order based on cosine similarity is more robust than cosine similarity itself. This is an example of a phenomenon that occurs regularly: a metric whose values are dubious might still rank things well. Naive Bayes is another example. It naively computes probabilities in a way that is blatantly wrong, and yet ranking things by these spurious probabilities works well in some cases.<\/p>\n<p>The cosine similarity between \u201cking\u201d \u2212 \u201cman\u201d + \u201cwoman\u201d and &#8220;queen&#8221; is roughly the same as the cosine similarity between &#8220;coffee&#8221; + &#8220;milk&#8221; and &#8220;latte.&#8221; But in the former example, rank order picks out\u00a0<em>queen<\/em> as the best match; rank order works like you&#8217;d expect, because you&#8217;re working with attributes that can be decomposed.<\/p>\n<h2>Dog + infant = puppy?<\/h2>\n<p>I wouldn&#8217;t be surprised if the Anglo-Saxon word for\u00a0<em>puppy<\/em> was something like\u00a0<em>dogchild<\/em>. The language was full of colorful compound words, such as <em>hronrad<\/em> (&#8220;whale-road&#8221;) for the sea and <em>nosethyrl<\/em> (&#8220;nose-hole&#8221;) for nostril.<\/p>\n<p>Here are the top ten matches for &#8220;dog&#8221; + &#8220;infant&#8221; along with their cosine similarities.<\/p>\n<ol>\n<li>dog, 0.819<\/li>\n<li>infant, 0.809<\/li>\n<li>toddler, 0.734<\/li>\n<li>dogs, 0.697<\/li>\n<li>puppy, 0.688<\/li>\n<li>cat, 0.682<\/li>\n<li>pet, 0.676<\/li>\n<li>child, 0.671<\/li>\n<li>newborn, 0.670<\/li>\n<li>baby, 0.650<\/li>\n<\/ol>\n<p>This shows that &#8220;puppy&#8221; is close to &#8220;dog&#8221; + &#8220;infant&#8221;, both in terms of cosine similarity and rank order, though it&#8217;s not the closet.<\/p>\n<p>This also shows that you have to take the addition of word vectors with a grain of salt. It&#8217;s no surprise that\u00a0<em>puppy<\/em> was a good match, but it&#8217;s surprising that\u00a0<em>cat<\/em> is nearly as good.<\/p>\n<p>[1] I poked around a little to get an idea just how unevenly words are distributed. The closest pair of words is <em>jajaja<\/em> and <em>jajajaja<\/em> with a cosine similarity of 0.993. The most isolated word, meaning the word whose nearest neighbor is furthest away, the the Thai word <span lang=\"th\">\u0e40\u0e04\u0e22\u0e44\u0e2b\u0e21<\/span>. It&#8217;s nearest neighbor is the Russian word <span lang=\"ru\">\u0431\u043e\u043b\u044c<\/span> with a cosine similarity of 0.283.<\/p>\n<p>The glove-twitter-200 vectors were created from a corpus that is about half English and about other languages and strings of symbols that are not words in any language. Presumably <span lang=\"th\">\u0e40\u0e04\u0e22\u0e44\u0e2b\u0e21<\/span> would have a much closer neighbor in a corpus containing more Thai words.<\/p>\n<p>I didn&#8217;t search the entire corpus, only the 50,000 most frequently occurring vectors, because a full search would require running an <em>O<\/em>(<em>N<\/em>\u00b2) search with <em>N<\/em> = 1,200,000.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yesterday I wrote about the canonical example of how vector embeddings of words add: \u201cking\u201d \u2212 \u201cman\u201d + \u201cwoman\u201d \u2248 \u201cqueen\u201d This should be interpreted as saying that the word vector for\u00a0king, minus the word vector for\u00a0man, plus the word vector for\u00a0woman, is in some sense close to the word vector for\u00a0queen. This post will [&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":[17],"tags":[146],"class_list":["post-247906","post","type-post","status-publish","format-standard","hentry","category-statistics","tag-machine-learning"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Subtle aspects of adding word vectors. Does coffee + milk = latte? Sorta, but it&#039;s not nearly the best match.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"machine learning\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/coffee-milk-latte\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.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=\"Coffee + milk \u2260 latte\" \/>\n\t\t<meta property=\"og:description\" content=\"Subtle aspects of adding word vectors. Does coffee + milk = latte? Sorta, but it&#039;s not nearly the best match.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/coffee-milk-latte\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-09-16T15:06:58+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-09-17T15:21:54+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Coffee + milk \u2260 latte\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Subtle aspects of adding word vectors. Does coffee + milk = latte? Sorta, but it&#039;s not nearly the best match.\" \/>\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":"Coffee + milk \u2260 latte","description":"Subtle aspects of adding word vectors. Does coffee + milk = latte? Sorta, but it's not nearly the best match.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/coffee-milk-latte\/","robots":"max-image-preview:large","keywords":"machine learning","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Coffee + milk \u2260 latte","og:description":"Subtle aspects of adding word vectors. Does coffee + milk = latte? Sorta, but it's not nearly the best match.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/coffee-milk-latte\/","article:published_time":"2026-09-16T15:06:58+00:00","article:modified_time":"2026-09-17T15:21:54+00:00","twitter:card":"summary","twitter:title":"Coffee + milk \u2260 latte","twitter:description":"Subtle aspects of adding word vectors. Does coffee + milk = latte? Sorta, but it's not nearly the best match.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247906","title":null,"description":"Subtle aspects of adding word vectors. Does coffee + milk = latte? Sorta, but it's not nearly the best match.","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-09-16 13:39:19","updated":"2026-09-17 16:31:00","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":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\/statistics\/\" title=\"Statistics\">Statistics<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tCoffee + milk \u2260 latte\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Statistics","link":"https:\/\/www.johndcook.com\/blog\/category\/statistics\/"},{"label":"Coffee + milk \u2260 latte","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/coffee-milk-latte\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247906","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=247906"}],"version-history":[{"count":6,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247906\/revisions"}],"predecessor-version":[{"id":247922,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247906\/revisions\/247922"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247901,"date":"2026-09-16T07:04:09","date_gmt":"2026-09-16T12:04:09","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247901"},"modified":"2026-09-16T07:08:27","modified_gmt":"2026-09-16T12:08:27","slug":"fibonacci-product","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/fibonacci-product\/","title":{"rendered":"Fibonacci product"},"content":{"rendered":"<p>The product of four consecutive Fibonacci numbers equals the product of two consecutive integers.<\/p>\n<p>For example,<\/p>\n<p style=\"padding-left: 40px;\">3 \u00d7 5 \u00d7 8 \u00d7 13 = 39 \u00d7 40.<\/p>\n<p>I ran across this theorem in a note [1] that says &#8220;The product of any four consecutive Fibonacci numbers is twice a triangular number.&#8221; Since triangular numbers have the form <em>n<\/em>(<em>n<\/em> + 1)\/2, twice a triangular number is the product of two consecutive integers.<\/p>\n<p>The note also gives a way to find the numbers on the right hand side. We have<\/p>\n<p style=\"padding-left: 40px;\"><em>F<\/em><sub><em>n<\/em><\/sub> <em>F<\/em><sub><em>n<\/em>+1<\/sub> <em>F<\/em><sub><em>n<\/em>+2<\/sub> <em>F<\/em><sub><em>n<\/em>+3<\/sub> = <em>m<\/em>(<em>m<\/em> + 1)<\/p>\n<p>where <em>m<\/em> equals<\/p>\n<p style=\"padding-left: 40px;\"><em>F<\/em><sub><em>n<\/em>+1<\/sub> <em>F<\/em><sub><em>n<\/em>+2<\/sub><\/p>\n<p>if <em>n<\/em> is odd and<\/p>\n<p style=\"padding-left: 40px;\"><em>F<\/em><sub><em>n<\/em><\/sub> <em>F<\/em><sub><em>n<\/em>+3<\/sub><\/p>\n<p>if <em>n<\/em> is even.<\/p>\n<p>In the example at the top, 3 is the 4th Fibonacci number, so <em>n<\/em> = 4. Since 4 is even,\u00a0<em>m<\/em> is the product of the 4th and 7th Fibonacci numbers, i.e.\u00a0<em>m<\/em> = 3 \u00d7 13 = 39.<\/p>\n<h2>More Fibonacci posts<\/h2>\n<ul>\n<li class='link'><a href='https:\/\/www.johndcook.com\/blog\/2018\/07\/13\/fibonacci-meets-pythagoras\/'>Fibonacci meets Pythagoras<\/a><\/li>\n<li class='link'><a href='https:\/\/www.johndcook.com\/blog\/2026\/02\/05\/fibonacci-certificate\/'>Certified Fibonacci numbers<\/a><\/li>\n<li class='link'><a href='https:\/\/www.johndcook.com\/blog\/2025\/10\/17\/trig-fibonacci\/'>Turning trig identities into Fibonacci identities<\/a><\/li>\n<\/ul>\n<p>[1] K. B. Subramaniam. On a link between Triangular and Fibonacci numbers. The Mathematical Gazette, Vol. 103, No. 558 (November 2019), p. 489.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The product of four consecutive Fibonacci numbers equals the product of two consecutive integers. For example, 3 \u00d7 5 \u00d7 8 \u00d7 13 = 39 \u00d7 40. I ran across this theorem in a note [1] that says &#8220;The product of any four consecutive Fibonacci numbers is twice a triangular number.&#8221; Since triangular numbers have [&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-247901","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.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"The product of four consecutive Fibonacci numbers equals the product of two consecutive integers.\" \/>\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\/09\/16\/fibonacci-product\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.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=\"Fibonacci product\" \/>\n\t\t<meta property=\"og:description\" content=\"The product of four consecutive Fibonacci numbers equals the product of two consecutive integers.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/fibonacci-product\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-09-16T12:04:09+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-09-16T12:08:27+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Fibonacci product\" \/>\n\t\t<meta name=\"twitter:description\" content=\"The product of four consecutive Fibonacci numbers equals the product of two consecutive integers.\" \/>\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":"Fibonacci product","description":"The product of four consecutive Fibonacci numbers equals the product of two consecutive integers.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/fibonacci-product\/","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":"Fibonacci product","og:description":"The product of four consecutive Fibonacci numbers equals the product of two consecutive integers.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/fibonacci-product\/","article:published_time":"2026-09-16T12:04:09+00:00","article:modified_time":"2026-09-16T12:08:27+00:00","twitter:card":"summary","twitter:title":"Fibonacci product","twitter:description":"The product of four consecutive Fibonacci numbers equals the product of two consecutive integers.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247901","title":null,"description":"The product of four consecutive Fibonacci numbers equals the product of two consecutive integers.","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-09-16 11:43:26","updated":"2026-09-16 13:39:53","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":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\tFibonacci product\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":"Fibonacci product","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/16\/fibonacci-product\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247901","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=247901"}],"version-history":[{"count":4,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247901\/revisions"}],"predecessor-version":[{"id":247905,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247901\/revisions\/247905"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247896,"date":"2026-09-15T17:00:44","date_gmt":"2026-09-15T22:00:44","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247896"},"modified":"2026-09-16T10:34:56","modified_gmt":"2026-09-16T15:34:56","slug":"simple-approximation-for-spherical-cap-area","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/simple-approximation-for-spherical-cap-area\/","title":{"rendered":"Simple approximation for spherical cap area"},"content":{"rendered":"<p>The <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/cosine-similarity\/\">previous post<\/a> looked at how to interpret cosine similarity, or equivalently angles between word vectors. In a high-dimensional space, randomly chosen vectors are likely nearly perpendicular, and so relatively large angles, such as 50\u00b0, indicate very closely related words.<\/p>\n<p>Another way to look at this, as explained in the previous post, is that in high dimensions, a spherical cap of angular radius \u03b8 represents a small portion of a sphere, even for moderately large \u03b8.<\/p>\n<p>The proportion of the area inside the spherical cap, given <a href=\"https:\/\/www.johndcook.com\/blog\/2023\/08\/09\/hypersphere-cap\/\">here<\/a>, involves the &#8220;regularized incomplete beta function&#8221; and so it&#8217;s hard to have an intuition for the value.<\/p>\n<p>For large dimension <em>n<\/em>, the approximation<\/p>\n<p style=\"padding-left: 40px;\"><em>n<\/em><sup>\u22121\/2<\/sup> sin<sup><em>n<\/em> \u2212 1<\/sup>(\u03b8)<\/p>\n<p>gives the proportion of the area inside the cap to within an order of magnitude. It&#8217;s easy to see that this function goes to zero quickly as\u00a0<em>n<\/em> increases, provided |\u03b8| &lt; \u03c0\/2.<\/p>\n<p>If you have the cosine similarity\u00a0<em>c<\/em> = cos \u03b8 rather than \u03b8 itself, the approximation becomes<\/p>\n<p style=\"padding-left: 40px;\"><em>n<\/em><sup>\u22121\/2<\/sup> (1 \u2212 <em>c<\/em>\u00b2)<sup>(<em>n<\/em> \u2212 1)\/2<\/sup>.<\/p>\n<h2>Python script<\/h2>\n<p>Let&#8217;s try it on the example from the previous post, in which\u00a0<em>n<\/em> = 200 and \u03b8 = 49\u00b0.<\/p>\n<pre>import numpy as np\r\nfrom scipy.special import betainc\r\n\r\n# Fraction of S^{n-1} inside a spherical cap of angular radius theta\r\n# theta is measured from the pole\r\n# Assume 0 &lt; theta &lt; pi\/2\r\n\r\ndef cap_fraction(theta, n):\r\n    x = np.sin(theta) ** 2\r\n    return 0.5 * betainc(0.5 * (n - 1), 0.5, x)\r\n\r\ndef cap_fraction_approx(theta, n):\r\n    return n**(-0.5) * np.sin(theta)**(n-1)\r\n\r\ntheta = np.deg2rad(49)\r\nprint(cap_fraction(theta, 200)) \r\nprint(cap_fraction_approx(theta, 200)) \r\n<\/pre>\n<p>This prints 2.03e-26 and 3.37e-26. The order of magnitude is correct as advertised.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The previous post looked at how to interpret cosine similarity, or equivalently angles between word vectors. In a high-dimensional space, randomly chosen vectors are likely nearly perpendicular, and so relatively large angles, such as 50\u00b0, indicate very closely related words. Another way to look at this, as explained in the previous post, is that in [&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":[224],"class_list":["post-247896","post","type-post","status-publish","format-standard","hentry","category-math","tag-geometry"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"A simple expression for roughly calculating the proportion of area inside a spherical cap of a high-dimensional sphere, useful for interpreting cosine similarity.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"geometry\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/simple-approximation-for-spherical-cap-area\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.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=\"Simple approximation for spherical cap area\" \/>\n\t\t<meta property=\"og:description\" content=\"A simple expression for roughly calculating the proportion of area inside a spherical cap of a high-dimensional sphere, useful for interpreting cosine similarity.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/simple-approximation-for-spherical-cap-area\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-09-15T22:00:44+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-09-16T15:34:56+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Simple approximation for spherical cap area\" \/>\n\t\t<meta name=\"twitter:description\" content=\"A simple expression for roughly calculating the proportion of area inside a spherical cap of a high-dimensional sphere, useful for interpreting cosine similarity.\" \/>\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":"Simple approximation for spherical cap area","description":"A simple expression for roughly calculating the proportion of area inside a spherical cap of a high-dimensional sphere, useful for interpreting cosine similarity.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/simple-approximation-for-spherical-cap-area\/","robots":"max-image-preview:large","keywords":"geometry","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Simple approximation for spherical cap area","og:description":"A simple expression for roughly calculating the proportion of area inside a spherical cap of a high-dimensional sphere, useful for interpreting cosine similarity.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/simple-approximation-for-spherical-cap-area\/","article:published_time":"2026-09-15T22:00:44+00:00","article:modified_time":"2026-09-16T15:34:56+00:00","twitter:card":"summary","twitter:title":"Simple approximation for spherical cap area","twitter:description":"A simple expression for roughly calculating the proportion of area inside a spherical cap of a high-dimensional sphere, useful for interpreting cosine similarity.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247896","title":null,"description":"A simple expression for roughly calculating the proportion of area inside a spherical cap of a high-dimensional sphere, useful for interpreting cosine similarity.","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-09-15 16:46:24","updated":"2026-09-16 15:44:00","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":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\tSimple approximation for spherical cap area\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":"Simple approximation for spherical cap area","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/simple-approximation-for-spherical-cap-area\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247896","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=247896"}],"version-history":[{"count":4,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247896\/revisions"}],"predecessor-version":[{"id":247910,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247896\/revisions\/247910"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247894,"date":"2026-09-15T11:06:02","date_gmt":"2026-09-15T16:06:02","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247894"},"modified":"2026-09-15T17:10:49","modified_gmt":"2026-09-15T22:10:49","slug":"cosine-similarity","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/cosine-similarity\/","title":{"rendered":"What counts as a large cosine similarity?"},"content":{"rendered":"<p>Machine learning represents words as vectors and measures the similarity of words by the angles between the vectors.<\/p>\n<p>For vectors\u00a0<strong>x<\/strong>\u00a0and\u00a0<strong>y<\/strong>,<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/dotproduct3.svg\" alt=\"\\mathbf{x} \\cdot \\mathbf{y} = ||\\mathbf{x} || \\,||\\mathbf{y} || \\, \\cos(\\theta)\" width=\"173\" height=\"18\" \/><\/p>\n<p>where \u03b8 is the angle between the vectors, and so<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" style=\"background-color: white;\" src=\"https:\/\/www.johndcook.com\/dotproduct4.svg\" alt=\"\\cos(\\theta) = \\frac{\\mathbf{x} \\cdot \\mathbf{y}}{ ||\\mathbf{x} || \\,||\\mathbf{y} || }\" width=\"136\" height=\"37\" \/><\/p>\n<p>This is the cosine similarity between the words represented by <strong>x<\/strong> and <strong>y<\/strong>.<\/p>\n<p>Small angles have large cosines, and so words with larger cosine similarities are closer together than words with smaller cosine similarities. The cosine similarity between a word and itself equals 1, and we&#8217;d expect unrelated words to have a cosine similarity near 0.<\/p>\n<p>You can do a sort of arithmetic with vector embeddings of words. The canonical example is that<\/p>\n<p style=\"padding-left: 40px;\">&#8220;king&#8221; \u2212 &#8220;man&#8221; + &#8220;woman&#8221; \u2248 &#8220;queen&#8221;<\/p>\n<p>Implicit in this equation is that we&#8217;re really adding vector representations of the words. Let\u00a0<strong>a<\/strong>,\u00a0<strong>b<\/strong>,\u00a0<strong>c<\/strong>, and\u00a0<strong>d<\/strong> be the vector embeddings of the words\u00a0<em>king<\/em>,\u00a0<em>man<\/em>,\u00a0<em>woman<\/em>, and\u00a0<em>queen<\/em>. What we&#8217;re really asserting is that<\/p>\n<p style=\"padding-left: 40px;\"><strong>a<\/strong> \u2212\u00a0<strong>b<\/strong> +\u00a0<strong>c<\/strong> \u2248\u00a0<strong>d<\/strong>,<\/p>\n<p>except that&#8217;s not true! Or at least it&#8217;s not true unless you view it in the right context.<\/p>\n<p>The angle between <strong>a<\/strong> \u2212\u00a0<strong>b<\/strong> +\u00a0<strong>c<\/strong> and\u00a0<strong>d<\/strong> is about 49\u00b0, which corresponds to a cosine similarity of 0.656. Here I&#8217;m using the gensim glove-twitter-200 embedding that represents words as 200-dimensional vectors.<\/p>\n<p>The way to interpret the equation above is not that a 49\u00b0 degree angle is approximately 0, or that a similarity of 0.656 is approximately 1.<\/p>\n<p>In high dimensions, such as 200-dimensional word embeddings, nearly all vectors are nearly perpendicular. I wrote a post about this <a href=\"https:\/\/www.johndcook.com\/blog\/2023\/08\/09\/random-points-hypersphere-orthant\/\">here<\/a>. So the angle between randomly selected words will usually be close to 90\u00b0, and so in that context an angle of 49\u00b0 is relatively small. For example, the angle between the vector representations of\u00a0<em>king<\/em> and\u00a0<em>fireplace<\/em> is 89.25\u00b0.<\/p>\n<p>If you divide word vectors by their norm, you can think of each vector as a point on a high-dimensional sphere, in our case a sphere in 200 dimensions. The proportion of vectors within 49\u00b0 of a given point is surprisingly small in high dimensions.<\/p>\n<p>Let&#8217;s say our point of interest is the north pole of an <em>n<\/em>-dimensional sphere. We&#8217;d like to calculate the proportion of the area of the sphere that is within an angle \u03b8 of the pole. I go through the calculations <a href=\"https:\/\/www.johndcook.com\/blog\/2023\/08\/09\/hypersphere-cap\/\">here<\/a>. (Update: I give an approximation <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/simple-approximation-for-spherical-cap-area\/\">here<\/a> that&#8217;s easier to work with than the exact formula.)<\/p>\n<p>When <em>n<\/em> = 3, 17% of the area is with 49 degrees of the pole. But when <em>n<\/em> = 200, the proportion is on the order of 10<sup>\u221226<\/sup>, essentially zero.<\/p>\n<p>The vector <strong>d<\/strong> above representing <em>queen<\/em> is within a relatively tiny region around the vector <strong>a<\/strong> \u2212\u00a0<strong>b<\/strong> +\u00a0<strong>c<\/strong>.<\/p>\n<p>In terms of cosine similarity, 0.656 is a large similarity. Words with a cosine similarity in this range are quite close, even though we wouldn&#8217;t normally think of 0.656 being close to 1. In this context, 0.656\u00a0<em>is<\/em> close to 1.<\/p>\n<h2>Related posts<\/h2>\n<ul>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2023\/08\/08\/angles-between-words\/\">Angles between words<\/a><\/li>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2023\/08\/09\/hypersphere-cap\/\">Area and volume of a hypersphere cap<\/a><\/li>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2023\/08\/09\/cosine-similarity-not-a-metric\/\">Cosine similarity does not satisfy the triangle inequality<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Machine learning represents words as vectors and measures the similarity of words by the angles between the vectors. For vectors\u00a0x\u00a0and\u00a0y, where \u03b8 is the angle between the vectors, and so This is the cosine similarity between the words represented by x and y. Small angles have large cosines, and so words with larger cosine similarities [&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":[260],"tags":[48],"class_list":["post-247894","post","type-post","status-publish","format-standard","hentry","category-ai","tag-differential-geometry"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Vector embeddings let you conclude things like &quot;king&quot; \u2212 &quot;man&quot; + &quot;woman&quot; approximately equals &quot;queen&quot;. But this might not seem true when you look at the numbers.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"differential geometry\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/cosine-similarity\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.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=\"What counts as a large cosine similarity?\" \/>\n\t\t<meta property=\"og:description\" content=\"Vector embeddings let you conclude things like &quot;king&quot; \u2212 &quot;man&quot; + &quot;woman&quot; approximately equals &quot;queen&quot;. But this might not seem true when you look at the numbers.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/cosine-similarity\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-09-15T16:06:02+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-09-15T22:10:49+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"What counts as a large cosine similarity?\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Vector embeddings let you conclude things like &quot;king&quot; \u2212 &quot;man&quot; + &quot;woman&quot; approximately equals &quot;queen&quot;. But this might not seem true when you look at the numbers.\" \/>\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":"What counts as a large cosine similarity?","description":"Vector embeddings let you conclude things like \"king\" \u2212 \"man\" + \"woman\" approximately equals \"queen\". But this might not seem true when you look at the numbers.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/cosine-similarity\/","robots":"max-image-preview:large","keywords":"differential geometry","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"What counts as a large cosine similarity?","og:description":"Vector embeddings let you conclude things like &quot;king&quot; \u2212 &quot;man&quot; + &quot;woman&quot; approximately equals &quot;queen&quot;. But this might not seem true when you look at the numbers.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/cosine-similarity\/","article:published_time":"2026-09-15T16:06:02+00:00","article:modified_time":"2026-09-15T22:10:49+00:00","twitter:card":"summary","twitter:title":"What counts as a large cosine similarity?","twitter:description":"Vector embeddings let you conclude things like &quot;king&quot; \u2212 &quot;man&quot; + &quot;woman&quot; approximately equals &quot;queen&quot;. But this might not seem true when you look at the numbers.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247894","title":null,"description":"Vector embeddings let you conclude things like \"king\" \u2212 \"man\" + \"woman\" approximately equals \"queen\". But this might not seem true when you look at the numbers.","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-09-15 14:48:31","updated":"2026-09-16 01:15:55","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":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\/ai\/\" title=\"AI\">AI<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tWhat counts as a large cosine similarity?\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"AI","link":"https:\/\/www.johndcook.com\/blog\/category\/ai\/"},{"label":"What counts as a large cosine similarity?","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/15\/cosine-similarity\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247894","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=247894"}],"version-history":[{"count":2,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247894\/revisions"}],"predecessor-version":[{"id":247899,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247894\/revisions\/247899"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247892,"date":"2026-09-14T05:44:45","date_gmt":"2026-09-14T10:44:45","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247892"},"modified":"2026-09-14T05:44:45","modified_gmt":"2026-09-14T10:44:45","slug":"guessing-the-meaning-of-a-number","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/14\/guessing-the-meaning-of-a-number\/","title":{"rendered":"Guessing the meaning of a number"},"content":{"rendered":"<p>Suppose I give you an\u00a0<em>n<\/em>-digit number and ask you what it represents. This seems impossible, and in theory it\u00a0<em>is<\/em> impossible. But in practice it&#8217;s often possible.<\/p>\n<p>Apps on a phone may automatically interpret a 10-digit number as a phone number or a 16-digit number as a package tracking number. And very often these interpretations are correct, given the kinds of things most people use their phones for.<\/p>\n<p>It&#8217;s not surprising that a 10-digit number\u00a0<em>on a phone<\/em> is a\u00a0<em>phone number<\/em>. It&#8217;s more interesting that a 16-digit number is likely a tracking number. It could be other things, such as a credit card number. But people don&#8217;t usually write out credit card numbers in a text note; credit card numbers likely saved in some more opaque way.<\/p>\n<p>I run into a variation of this problem routinely, trying to infer what a number represents inside medical notes.<\/p>\n<p>A five-digit number could be a US postal code, or it could be a <a href=\"https:\/\/www.johndcook.com\/blog\/2022\/09\/23\/hcpcs-codes\/\">medical procedure code<\/a>.<\/p>\n<p>A six-digit number could be a date in MMDDYY format, or it could be a medical record number.<\/p>\n<p>A ten-digit number could be a phone number, or it could be an <a href=\"https:\/\/www.johndcook.com\/blog\/2024\/06\/26\/npi-number\/\">NPI<\/a> (National Provider Identifier) number.<\/p>\n<p>It&#8217;s interesting that it&#8217;s possible make a good guess at what a number means inside unstructured text. Context has been lost, but not all context: you know you&#8217;re looking at medical notes. And that meager bit of context can be surprisingly useful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Suppose I give you an\u00a0n-digit number and ask you what it represents. This seems impossible, and in theory it\u00a0is impossible. But in practice it&#8217;s often possible. Apps on a phone may automatically interpret a 10-digit number as a phone number or a 16-digit number as a package tracking number. And very often these interpretations 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":[1],"tags":[],"class_list":["post-247892","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"If all you know about a number is its length, how could you possibly tell what it means? Given a little context, it might be possible to make a good guess.\" \/>\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\/09\/14\/guessing-the-meaning-of-a-number\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.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=\"Guessing the meaning of a number\" \/>\n\t\t<meta property=\"og:description\" content=\"If all you know about a number is its length, how could you possibly tell what it means? Given a little context, it might be possible to make a good guess.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/09\/14\/guessing-the-meaning-of-a-number\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-09-14T10:44:45+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-09-14T10:44:45+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Guessing the meaning of a number\" \/>\n\t\t<meta name=\"twitter:description\" content=\"If all you know about a number is its length, how could you possibly tell what it means? Given a little context, it might be possible to make a good guess.\" \/>\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":"Guessing the meaning of a number","description":"If all you know about a number is its length, how could you possibly tell what it means? Given a little context, it might be possible to make a good guess.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/14\/guessing-the-meaning-of-a-number\/","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":"Guessing the meaning of a number","og:description":"If all you know about a number is its length, how could you possibly tell what it means? Given a little context, it might be possible to make a good guess.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/09\/14\/guessing-the-meaning-of-a-number\/","article:published_time":"2026-09-14T10:44:45+00:00","article:modified_time":"2026-09-14T10:44:45+00:00","twitter:card":"summary","twitter:title":"Guessing the meaning of a number","twitter:description":"If all you know about a number is its length, how could you possibly tell what it means? Given a little context, it might be possible to make a good guess.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247892","title":null,"description":"If all you know about a number is its length, how could you possibly tell what it means? Given a little context, it might be possible to make a good guess.","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-09-14 10:06:25","updated":"2026-09-14 15:25:05","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":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\tGuessing the meaning of a number\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":"Guessing the meaning of a number","link":"https:\/\/www.johndcook.com\/blog\/2026\/09\/14\/guessing-the-meaning-of-a-number\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247892","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=247892"}],"version-history":[{"count":1,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247892\/revisions"}],"predecessor-version":[{"id":247893,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247892\/revisions\/247893"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}]