why mod(rref(A), 2) does not give the correct result?

9 ビュー (過去 30 日間)
Lily
Lily 2025 年 5 月 30 日
編集済み: David Goodmanson 2025 年 5 月 30 日
Lets say I have the followings all in mod 2
a = [1 1 0 0 0]'
a = 5×1
1 1 0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
b = [1 0 1 0 1]'
b = 5×1
1 0 1 0 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
c = [0 1 1 0 1]'
c = 5×1
0 1 1 0 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
clearly, c = a + b in mod 2
However when I run the command
mod(rref([a b c]), 2)
ans = 5×3
1 0 0 0 1 0 0 0 1 0 0 0 0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
It does not give the corret result for linear combination in mod 2? My expect answer should be:
expected_ans = [1 0 1; 0 1 1; 0 0 0; 0 0 0; 0 0 0]
expected_ans = 5×3
1 0 1 0 1 1 0 0 0 0 0 0 0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Could anyone explain why?

採用された回答

David Goodmanson
David Goodmanson 2025 年 5 月 30 日
編集済み: David Goodmanson 2025 年 5 月 30 日
Hi Lily,
Although c is a linear combination of a and b mod 2, rref does not know anything about mod 2.
rank([a b c])
ans = 3
As far as rref is concerned, a, b and c are linearly independent ('mod' not being a linear operation under the usual addition of numbers). So you get three nonzero rows.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by