{"id":247737,"date":"2026-08-24T20:47:47","date_gmt":"2026-08-25T01:47:47","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247737"},"modified":"2026-08-24T22:53:04","modified_gmt":"2026-08-25T03:53:04","slug":"numerical-instability-recurrece","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/24\/numerical-instability-recurrece\/","title":{"rendered":"Numerical (in)stability of recurrence relations"},"content":{"rendered":"<p>The <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/24\/three-term-recurrences\/\">previous post<\/a> gave several examples of three-term recurrence relations for special functions. These relations can be computationally useful, but they have to be applied carefully.<\/p>\n<p>Several years ago I wrote a post on <a href=\"https:\/\/www.johndcook.com\/blog\/2020\/01\/17\/stable-recurrence-relations\/\">stable and unstable recurrences<\/a>. In that post I show that the stability of the recurrence relation for Bessel functions produces depends on which kind of Bessel function and which direction the recurrence is applied.<\/p>\n<p>In the forward direction, computing higher order values from lower order values, works well for Bessel functions of the second kind <em>Y<\/em><sub><em>n<\/em><\/sub> but not for Bessel functions of the first kind <em>J<\/em><sub><em>n<\/em><\/sub>. In the reverse direction, the recurrence is stable for <em>J<\/em><sub><em>n<\/em><\/sub> but not for <em>Y<\/em><sub><em>n<\/em><\/sub>.<\/p>\n<p>I didn&#8217;t explain in that post why this is. In this post I will.<\/p>\n<p>Second order linear difference equations have two independent solutions, just like second order linear differential equations. For both kinds of equations, all solutions are linear combinations of the two solutions. Suppose one solution grows with <em>n<\/em> and the other decays. You may want to compute the decaying solution, but in doing so you might pick up a small component of the growing solution due to rounding error. <a href=\"https:\/\/www.johndcook.com\/blog\/2013\/11\/12\/sensitive-dependence-on-initial-conditions\/\">This post<\/a> illustrates this phenomena for differential equations, and <a href=\"https:\/\/www.johndcook.com\/blog\/2020\/01\/17\/stable-recurrence-relations\/\">this post<\/a> illustrates it for difference equations.<\/p>\n<p>When you look at a plot of Bessel functions in a text book, you&#8217;ll probably see a few plots of <em>J<\/em><sub><em>n<\/em><\/sub>(<em>x<\/em>) and<em>Y<\/em><sub><em>n<\/em><\/sub>(<em>x<\/em>) for a few small values of\u00a0<em>n<\/em>. The functions seem to behave roughly the same way, like sine and cosine. And that&#8217;s true,\u00a0<strong>as functions of <em>x<\/em><\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/bessel_vary_x.png\" width=\"480\" height=\"360\" \/><\/p>\n<p>But it&#8217;s not true for <em>J<\/em><sub><em>n<\/em><\/sub>(<em>x<\/em>) and<em>Y<\/em><sub><em>n<\/em><\/sub>(<em>x<\/em>) as functions of\u00a0<em>n<\/em> for fixed\u00a0<em>x<\/em>. As\u00a0<em>n<\/em> increases, <em>J<\/em><sub><em>n<\/em><\/sub>(<em>x<\/em>) decays to zero and <em>Y<\/em><sub><em>n<\/em><\/sub>(<em>x<\/em>) goes off to \u2212\u221e.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/bessel_vary_nu.png\" width=\"480\" height=\"360\" \/><\/p>\n<p>That&#8217;s the source of numerical instability. And there will be similar instability problems for other recurrences where the ratios of the two independent solutions goes to zero or infinity as a function of\u00a0<em>n<\/em>.<\/p>\n<p>There are techniques for computing the solution that does not diverse, the so-called minimal solution, such as Miller&#8217;s algorithm mentioned <a href=\"https:\/\/www.johndcook.com\/blog\/2020\/01\/17\/stable-recurrence-relations\/\">here<\/a>.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The previous post gave several examples of three-term recurrence relations for special functions. These relations can be computationally useful, but they have to be applied carefully. Several years ago I wrote a post on stable and unstable recurrences. In that post I show that the stability of the recurrence relation for Bessel functions produces depends [&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":[129],"class_list":["post-247737","post","type-post","status-publish","format-standard","hentry","category-math","tag-special-functions"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Why are recurrence relations stable in one direction and unstable in the other?\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"special functions\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/24\/numerical-instability-recurrece\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Numerical (in)stability of recurrence relations\" \/>\n\t\t<meta property=\"og:description\" content=\"Why are recurrence relations stable in one direction and unstable in the other?\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/08\/24\/numerical-instability-recurrece\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-08-25T01:47:47+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-08-25T03:53:04+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Numerical (in)stability of recurrence relations\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Why are recurrence relations stable in one direction and unstable in the other?\" \/>\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":"Numerical (in)stability of recurrence relations","description":"Why are recurrence relations stable in one direction and unstable in the other?","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/24\/numerical-instability-recurrece\/","robots":"max-image-preview:large","keywords":"special functions","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Numerical (in)stability of recurrence relations","og:description":"Why are recurrence relations stable in one direction and unstable in the other?","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/08\/24\/numerical-instability-recurrece\/","article:published_time":"2026-08-25T01:47:47+00:00","article:modified_time":"2026-08-25T03:53:04+00:00","twitter:card":"summary","twitter:title":"Numerical (in)stability of recurrence relations","twitter:description":"Why are recurrence relations stable in one direction and unstable in the other?","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247737","title":null,"description":"Why are recurrence relations stable in one direction and unstable in the other?","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-08-25 00:55:15","updated":"2026-08-25 04:06:59","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tNumerical (in)stability of recurrence relations\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":"Numerical (in)stability of recurrence relations","link":"https:\/\/www.johndcook.com\/blog\/2026\/08\/24\/numerical-instability-recurrece\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247737","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=247737"}],"version-history":[{"count":2,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247737\/revisions"}],"predecessor-version":[{"id":247740,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247737\/revisions\/247740"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}