1
  1. Octave は NO ソリューションを含む Linear Systems を特定し、その趣旨のメッセージを投げることができますか?
  2. Octave は、多くの解を持ち、解セットを記述する線形システムを「解く」ことができますか?

私には役に立たない Octave 出力の 2 つの例を次に示します。目的の出力を Octave に求める別の方法はありますか?

いいえ解決策:

octave:13> A=[1,1,1;1,1,1] 
A =   
   1   1   1
   1   1   1   

octave:14> b=[0;1]
b =    
   0
   1

octave:15> A\b
ans =    
   0.16667
   0.16667
   0.16667

Infinity Many Solutions: ( http://joshua.smcvt.edu/linearalgebra/book.pdf ) 2.13 (pg16) から取得。

octave:19> M=[2,1,0,-1,0;0,1,0,1,1;1,0,-1,2,0]
M =   
   2   1   0  -1   0
   0   1   0   1   1
   1   0  -1   2   0

octave:20> n=[4;4;0]
n =    
   4
   4
   0

octave:21> M\n
ans =    
   0.761905
   2.380952
   0.571429
  -0.095238
   1.714286

Books Solution:
{ [x;y;z;w;u] = 
  [0; 4; 0; 0; 0] + [1; -1; 3; 1; 0]*w + [0.5; -1; 0.5; 0; 1]*u | w,u (R) 
}
OR
{ (w+(0.5)u, 4-w-u, 3w+(0.5)u, w, u) | w,u (R) }
4

1 に答える 1

0

必要なものをチェックする組み込み関数があるかどうかはわかりませんが、最初の質問については、コードを記述して自分でチェックすることができます。拡大行列を行階段形(rref)にした後、矛盾が発生したかどうかを確認する必要があります。これを行うには、任意の行ですべての変数が0であるが、定数が0ではないかどうかを確認します。これは、0 * x1 + 0 * x2 + ... 0 * xnがゼロに等しくないことを意味します(矛盾)。次のコードはまさにそれをチェックしていると思います

%function [feasible, x] = isfeasible(A,b)
%checks if Ax = b is feasible (a solution exists)
%and returns the solution if it exits
%input
%A: M x N matrix representing the variables in each equation, with one equation per row
%b: N X 1 vector of the constants
%output
%feasible: 1 if a solution exists, 0 otherwise
%x: N x 1 vector containing the values of the variables
function [feasible, x] = isfeasible(A,b)
  feasible = 1; %assume function is feasible
  Rref = rref([A,b]); %put the augmented matrix into row reduced echelon form
  x = Rref(:,end); %these are the values that the variables should be to solve the set of equations
  variableSums = sum(abs(Rref(:,1:(end-1))),2);
  if(any((variableSums == 0) & (abs(x) ~= 0))) %a contradiction has occurred.
    feasible = 0; %this means that 0 * all the variables is not 0
  endif
endfunction 

2番目の質問については、拡大行列[A、b]を行階段形にした後、いずれかの行にゼロ以外の値を持つ複数の列(最後の列を除く)がある場合、連立方程式には複数の列があります解決。Octaveはこれを解決し、一連のソリューションを特徴付けることができます。あなたがしなければならないのはrref([A、b])とあなたが戻ってきた解決策を読むことだけです。

あなたの例でrrefを使用すると、rref([M、n])=が見つかりました

      x         y         z         w         u      constant
   1.00000   0.00000   0.00000  -1.00000  -0.50000   0.00000
   0.00000   1.00000   0.00000   1.00000   1.00000   4.00000
   0.00000   0.00000   1.00000  -3.00000  -0.50000  -0.00000

これの意味は

x = w + .5 * u

y = 4-w-u

z = 3 * w + .5 * u

于 2013-03-03T23:37:19.427 に答える