在此问题中找到了找到特定问题的解决方案具有无限多个解的非平方线性系统的解.这导致了另一个问题:
In this question was found a solution to find a particular solution to a non-square linear system that has infinitely many solutions. This leads to another question:
如何找到带有R的具有无限多个解的非平方线性系统的所有解?解决方案)
示例:线性系统
x+y+z=1 x-y-2z=2等效于 A X = B ,其中:
A=matrix(c(1,1,1,1,-1,-2),2,3,T) B=matrix(c(1,2),2,1,T) A [,1] [,2] [,3] [1,] 1 1 1 [2,] 1 -1 -2 B [,1] [1,] 1 [2,] 2我们可以用以下方法描述无限组的解决方案:
We can describe the infinite set of solutions with:
x = 3/2 + (1/2) z y = -1/2 + (-3/2) z z in R因此,R可以这样描述解决方案集:
Thus, R could describe the set of solutions this way:
> solve2(A,B) $principal [1] 1 2 # this means that x and y will be described $free [1] 3 # this means that the 3rd variable (i.e. z) is free in the set of real numbers $P [1] 1.5 -0.5 $Q [1] 0.5 -1.5这意味着可以使用以下方法创建每个解决方案:
This means that every solution can be created with:
z = 236782 # any value would be ok solve2(A,B)$P + z * solve2(A,B)$Q # this gives x and y关于数学:总是存在这样的分解,当线性系统具有无限多个解时,这部分是可以的.问题是:R中有什么可以做的吗?
About the maths: there always exist such a decomposition, when the linear system has infinitely many solutions, this part is ok. The question is: is there something to do this in R?
推荐答案A*x = b
是
x = x0 + z其中x0是任意解,z在A的内核中
where x0 is any solution and z is in the kernel of A
如上所述,您可以使用广义逆来找到特定的解x0.您还可以使用SVD查找A内核的基础:
As pointed out above you can find a particular solution x0 by using the generalised inverse. You can also use the SVD to find a basis for the kernel of A:
A = U*S*V'其中U和V是正交的,而S是对角线的,例如,对角线上的最后k个条目为0(其他非零).
where U and V are orthogonal and S diagonal, with, say, the last k entries on the diagonal 0 (and the others non-zero).
如果遵循该公式,则V的最后k列构成A的核的基础,如果我们称这些z1,.. zk,则原始方程式的解是
If follows that the last k columns of V form a basis for the kernel of A, and if we call these z1,..zk then the solutions of the original equation are
x = x0 + c1*z1 + .. ck*zk对于任何真实的c1..ck
for any real c1..ck
更多推荐
寻找具有无限多个解的非平方线性系统的所有解
发布评论