slash
(/) 右除算およびフィードバック
Syntax
X = A / B // while A = X * B X = A ./ B // while A = X .* B X = A ./. B // while A = X .*. B S = G /. K // on-row comment /* block of multilines comments */
説明
右除算. X=A/B は, X*B=A の解です.
スラッシュ (右除算) とバックスラッシュ (左除算) 演算子は以下の等式で関係付けられます:
B/A=(A'\B')'.
Aが正方の場合,
X の解はLU分解または線形最小二乗ソルバにより求められます.
Aの条件数が 1/(10*%eps)以下の場合(すなわちA
の条件が良い場合), ピボット選択付きLU分解が使用されます.
そうでない場合 (すなわち A の条件が悪い場合),
X はAの完全直交分解により
||A*X-B||を最小化する最小ノルム解となります
(すなわち, Xは線形最小二乗問題の解となります).
A./B は要素毎の右除算, すなわち,
エントリA(i,j)/B(i,j)を有する行列となります.
B がスカラー (1x1 行列)の場合,この演算は
A./B*ones(A)と同じになります.
Aがスカラーの場合も同様です.
システムフィードバック. S = G/.Kは
S = G*(eye() + K*G)^(-1) と評価されます.
この演算子はシンプルな記述が容易に可能となります.
![]() | Note that 123./B is interpreted as (123)./B.
In this case, the dot is part of the operator, not of the decimal number.
In the opposite, G/.5 is interpreted as G/(.5) :
The dot here is part of the number, while it is not the case in
G/. 5 |
コメント // は, 特定の行をコメントにします.
すなわち, // で始まる行はインタプリタから無視されます.
It is the same with /* which start to comment a
block of code and with */ which end to comment this block.
例
a = [3.,-24.,30.]; B = [ 9. -36. 30. -36. 192. -180. 30. -180. 180. ]; x = a / B x*B-a // ゼロに近い a = 4 / 2; // 2となります a = 2 ./ [2,4]; // [1. 0.5]
Kronecker right division :
A = [1 100 ; 10 1000], B = [1 2 4], P = A .*. B P ./. B
--> A = [1 100 ; 10 1000], B = [1 2 4], A = 1. 100. 10. 1000. B = 1. 2. 4. --> P = A .*. B P = 1. 2. 4. 100. 200. 400. 10. 20. 40. 1000. 2000. 4000. --> P ./. B ans = 1. 100. 10. 1000.
// コメントは有用です. コードを理解しやすくします. a = 1; // Comment after some heading instructions /* Even long, that is to say on many lines, comments are useful */
参照
- inv — 逆行列
- backslash — (\) 左行列除算: exact or least square solution
- kron ./. — Kronecker left and right divisions
- comments — (// or /*...*/) comments
- overloading — 表示,関数および演算子オーバーロード機能
履歴
| バージョン | 記述 |
| 5.4.1 | バックスラッシュの条件数の閾値が増加しました. |
| 6.0.0 | 1./B means now 1 ./ B, no longer 1. / B |
| Report an issue | ||
| << semicolon (;) | Scilab keywords | star >> |
