返回介绍

Stabilty and Condition Number

发布于 2025-02-25 23:43:52 字数 2183 浏览 0 评论 0 收藏 0

It is important that numerical algorithms be stable and efficient. Efficiency is a property of an algorithm, but stability can be a property of the system itself.

Example

\[\begin{split}\left(\begin{matrix}8&6&4&1\\1&4&5&1\\8&4&1&1\\1&4&3&6\end{matrix}\right)x = \left(\begin{matrix}19\\11\\14\\14\end{matrix}\right)\end{split}\]

A = np.array([[8,6,4,1],[1,4,5,1],[8,4,1,1],[1,4,3,6]])
b = np.array([19,11,14,14])
la.solve(A,b)
array([ 1.,  1.,  1.,  1.])
b = np.array([19.01,11.05,14.07,14.05])
la.solve(A,b)
array([-2.34 ,  9.745, -4.85 , -1.34 ])

Note that the tiny perturbations in the outcome vector \(b\) cause large differences in the solution! When this happens, we say that the matrix \(A\) ill-conditioned. This happens when a matrix is ‘close’ to being singular (i.e. non-invertible).

Condition Number

A measure of this type of behavior is called the condition number. It is defined as:

\[cond(A) = ||A||\cdot ||A^{-1}||\]

In general, it is difficult to compute.

Fact:

\[cond(A) = \frac{\lambda_1}{\lambda_n}\]

where \(\lambda_1\) is the maximum singular value of \(A\) and \(\lambda_n\) is the smallest. The higher the condition number, the more unstable the system. In general if there is a large discrepancy between minimal and maximal singular values, the condition number is large.

Example

U, s, V = np.linalg.svd(A)
print(s)
print(max(s)/min(s))
[ 15.5457   6.9002   3.8363   0.0049]
3198.6725812

Preconditioning

We can sometimes improve on this behavior by ‘pre-conditioning’. Instead of solving

\[Ax=b\]

we solve

\[D^{-1}Ax=D^{-1}b\]\[where :math:`D^{-1}A` has a lower condition number than :math:`A`\]

itself.

Preconditioning is a very involved topic, quite out of the range of this course. It is mentioned here only to make you aware that such a thing exists, should you ever run into an ill-conditioned problem!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文