递推关系的数值(不)稳定性
Numerical (In)Stability of Recurrence Relations

原始链接: https://www.johndcook.com/blog/2026/08/24/numerical-instability-recurrece/

三项递推关系是计算特殊函数的有力工具,但由于潜在的数值不稳定性,使用时需谨慎。这种不稳定性源于二阶线性差分方程拥有两个线性无关的解:一个随 $n$ 增大而增长,另一个随 $n$ 增大而衰减。 在计算“极小”(衰减)解时,舍入误差往往会引入“主导”(增长)解的一小部分分量,该分量最终会淹没计算结果。例如,$J_n(x)$ 和 $Y_n(x)$ 作为 $x$ 的函数时表现相似,但作为 $n$ 的函数时却大相径庭:$J_n(x)$ 向零衰减,而 $Y_n(x)$ 则趋于负无穷。因此,正向递推对于 $Y_n$ 是稳定的,但对于 $J_n$ 却不稳定,后者需要采取相反的计算方法。 只要两个线性无关解的比值趋于零或无穷大,就会出现数值不稳定性。在这种情况下,为计算极小解的稳定值,必须采用米勒算法(Miller's algorithm)等专门技术,以避免主导解带来的干扰影响。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 递推关系的数值(不)稳定性 (johndcook.com) 4 分,由 ibobev 发布于 54 分钟前 | 隐藏 | 过往 | 收藏 | 讨论 | 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

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 on which kind of Bessel function and which direction the recurrence is applied.

In the forward direction, computing higher order values from lower order values, works well for Bessel functions of the second kind Yn but not for Bessel functions of the first kind Jn. In the reverse direction, the recurrence is stable for Jn but not for Yn.

I didn’t explain in that post why this is. In this post I will.

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 n 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. This post illustrates this phenomena for differential equations, and this post illustrates it for difference equations.

When you look at a plot of Bessel functions in a text book, you’ll probably see a few plots of Jn(x) andYn(x) for a few small values of n. The functions seem to behave roughly the same way, like sine and cosine. And that’s true, as functions of x.

But it’s not true for Jn(x) andYn(x) as functions of n for fixed x. As n increases, Jn(x) decays to zero and Yn(x) goes off to −∞.

That’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 n.

There are techniques for computing the solution that does not diverse, the so-called minimal solution, such as Miller’s algorithm mentioned here.

 

联系我们 contact @ memedata.com