什么是\ a?

The answer:一种\A是一种lways一世,除非不是。

内容

Why A\A ?<一种n一种me="ae338b95-f89b-4634-bbe2-add19f0fa92f">

我已经解释了我们的Backslash操作员已有近50年了,但是我不得不承认,今天的博客文章的标题看起来有些奇怪。你永远不会看到3\3为了numbers. So, what is一种\A

一种\A求解方程

| a*x = a |

如果一种是square and nonsingular, thenX=一世。But what if一种是rectangular, or singular, or not known exactly? These are all nontrivial questions.

This post is my response to a recent internal discussion at MathWorks about backslash generating NaNs.

单元素矩阵<一种n一种me="44882ad7-ebee-4871-946c-baab21cc1e31">

任何关于矩阵的通用声明应该应用licable to 1-by-1 matrices in particular. For 1-by-1 matrices, there is an easy answer to our question.

  • 如果一种是任何非零的数字,然后a \ a = 1

My colleague Pete Stewart likes to use "mono-elemental" for this important class of matrices.

Nonsingular matrices<一种n一种me="d6de032f-e1da-47b9-8f08-4bf7acd2eeaa">

当1 by-1的情况概括为较大n的n-n,它变成:

  • 如果一种是任何非源矩阵,然后一种\A = I,,,,

This is not the end of the story, of course. It's our job to investigate approximately nonsingular and approximately equals.

再次单元素<一种n一种me="0152d18e-8c8d-4aa0-802c-1fe3807f3033">

当我的女儿五年级时,她的数学老师告诉她,数学家还没有发现如何除以零。但是IEEE 754浮点算术标准的作者已经弄清楚了,并向我们保证了0\0是not equal to1,,,,but rather

  • 如果a = 0, 然后0\0不是数字。

一种nd, for a diagonal matrix of any order, this scalar case is applicable to each diagonal element.

等级缺陷矩阵<一种n一种me="38c52489-7db2-4ba0-ad0c-156111d7643f">

如果一种是一种r一种nk deficient矩阵与等级r<n, 然后一种\Acannot possibly be一世。The rank of the product of two matrices cannot be larger than rank of either matrix. So一种\A无法胜任一种本身和

  • 如果一种排名不足,然后一种\A是definitely not一世

碰巧的是,最近的一期暹罗评论包括有关我的同事吉尔·斯特朗(Gil Strang)和我本人的关于矩阵等级“ lu和cr消除”的论文。该论文可从<一种href="https://epubs.siam.org/doi/epdf/10.1137/20M1358694">暹罗网站或吉尔<一种href="https://math.mit.edu/~gs/linearalgebra/lucr.pdf">麻省理工学院网站。另一个指针是<一种href="//www.tatmou.com/blogs/cleve/2020/10/23/">Cleve's Corner。

Lots of NaNs<一种n一种me="2e31bb2c-7c65-45ae-8d75-a1fecebbf576">

这是三个例子一种\A生成

一种=0B = [1 0; 0 0] C = [1 2; 4 8] X = A\A Y = B\B Z = C\C
a = 0 b = 1 0 0 0 c = 1 2 4 8 x = nan y = 1 0 nan nan z = nan nan nan nan nan nan

魔法正方形<一种n一种me="c49fe7ce-b9fb-45da-8af6-e6842166dd89">

我一直喜欢通过检查魔法正方形来调查矩阵的任何属性。

small_fig warning离开nmax = 50; r = zeros(nmax,1); e = zeros(nmax,1);为了n = 1:nmax a =魔术(n);x = a \ a;i =眼(n);r(n)=等级(a);e(n)= norm(x-i);结尾

奇怪的<一种n一种me="09b5c1de-53f5-47ed-b21b-270fe66f6aea">

MATLAB uses three different algorithms for computing magic squares, odd, singly even and doubly even. If the ordern很奇怪,那a =魔术(n)是非语言的一种n和the elements of the computed一种\A一种re within roundoff error of the elements of一世。请注意,错误图的比例因子为3.0E-15。

n=3:2:nmax; plots(n,r,60,e,[],“奇怪的”

偶数<一种n一种me="fee1eea4-2f6d-4eac-aad6-c4941db49733">

如果the ordern可以分开2,但不是4, 然后魔术(n)是r一种nk deficient. Its rank is about half its order. The error plot reflects the fact that一种\A是not一世

n=2:4:nmax; plots(n,r,60,e,200,"Singly even"

偶尔<一种n一种me="91e4c282-d92b-4198-9b30-0120fb80694a">

如果the ordern可以分开4, 然后魔术(n)排名不足。等级总是3。错误图无处不在。订单840have errors that are larger than my plot scale. Orders1632完全因为计算而缺少一种\A相遇0\0导致

n=4:4:nmax; plots(n,r,12,e,750,“偶尔”

伪为<一种n一种me="ba1706d3-0349-427a-bdec-9a4c6b6a59f9">

pinv(a)*bmore "robust" than一种\b

你不应该使用pinv只是为没有解决方案的问题创建解金宝搏官方网站决方案。伪源旨在表征特定技术问题的解决方案:如果线性方程系统具有许多解决方案,哪个是最短的解决方案?金宝搏官方网站如果您更换一种\b经过pinv(a)*b,确保这就是您想要的。

使用PINV代替后斜线不会消除排名不足。这些困难已经存在于单元素矩阵中。唯一缺陷1 by-1矩阵的等级是0PINV(0)=0。这比您的脸部少于,但是你没有办法PINV(0)*0等于1

当我重做上面的示例时,我得到了

一种=0B = [1 0; 0 0] C = [1 2; 4 8] X = pinv(A)*A Y = pinv(B)*B Z = pinv(C)*C
一种=0B = 1 0 0 0 C = 1 2 4 8 X = 0 Y = 1 0 0 0 Z = 0.2000 0.4000 0.4000 0.8000

The NaNs are gone, but is this really "more robust" than backslash? If you still think so, explain wherez来自。

我的底线<一种n一种me="5d730b9c-864f-4f18-8aac-f7fb5c2cd06b">

这是大约是正方形的,密集的,非对称矩阵一种。For such matrices:

  • 一种\Amay produce对于缺乏等级的矩阵。
  • pinv(a)*a避免通过尝试隐藏缺陷级别的矩阵。




与Matlab®R2022A一起出版

|

댓글

댓글을 남기려면<一种href="//www.tatmou.com/blogs/login?uri=/cleve/2022/02/22/what-is-aa/">링크를클릭하여하여계정계정하거나계정만드십시오만드십시오만드십시오。