Please help me with this simple problem? Confusing

2 ビュー (過去 30 日間)
Yoon
Yoon 2014 年 9 月 19 日
コメント済み: Stephen23 2014 年 9 月 19 日
Hey guys, new to forum, would like to ask quick question.
I made the matrix in matlab shown as
>> ref(B)
ans =
1 0 -33/5
0 1 67/5
0 0 0
This is actually the reduced echelon form of matrix.
When I try to make a comparison between ref(B, 1e-15) and ref(B, 1e-16)
it comes out as
>> ref(B, 1e-15)
ans =
1 0 -33/5
0 1 67/5
0 0 0
>> ref(B, 1e-16)
ans =
1 0 0
0 1 0
0 0 1
From this results, I can be certain that the default value for tol (tolerance variable) is smaller than 10e-15 but not smaller than 10e-16.
How do I explain why this is? (the tol seems quite confusing).
thank you guys!!!
  1 件のコメント
Stephen23
Stephen23 2014 年 9 月 19 日
編集済み: Stephen23 2014 年 9 月 19 日
If you actually want people who know about this topic to give advice, then try using a more informative question than "Please help me with this simple problem? Confusing" (this could be almost anything...) Your question should give a brief explanation of the topic/area/error/... that you are working with, to help those who might be able to help you.
You should read these pages, which give excellent advice on solving problems in MATLAB, and asking questions here:

サインインしてコメントする。

回答 (4 件)

Iain
Iain 2014 年 9 月 19 日
Is the tolerance as simple as being the "epsilon" of the numbers involved?
The machine epsilon is the smallest number that can be added to another. It's normally down at the 15th significant figure.

Stephen23
Stephen23 2014 年 9 月 19 日
編集済み: Stephen23 2014 年 9 月 19 日
There is no standard function in MATLAB called ref , so your code does not work (unless you have a custom function called ref ).
If you mean the standard function rref , which calculates the reduced row echelon form of a matrix, then the function help states that it "uses the given tolerance in the rank tests". This essentially means that values <tol will be considered as being equivalent to zero.
  2 件のコメント
Yoon
Yoon 2014 年 9 月 19 日
But why does tol show the correct result when tol is set as 10e-15 (-33/5, 67/5) but wrongly (0,0) when set to 10e-16? I mean 10e-15 is not greater than -33/5) or am I misunderstanding something
Stephen23
Stephen23 2014 年 9 月 19 日
An excellent idea (from Pierre Benoit below) would be to look at the rref code itself, which is apparently an Mfile. Try using a breakpoint, and comparing the two cases.

サインインしてコメントする。


Yoon
Yoon 2014 年 9 月 19 日
But why does tol show the correct result when tol is set as 10e-15 (-33/5, 67/5) but wrongly (0,0) when set to 10e-16? I mean 10e-15 is not greater than -33/5) or am I misunderstanding something
  1 件のコメント
Image Analyst
Image Analyst 2014 年 9 月 19 日
Who are you replying to? Please reply as a "comment" under the answer that you're replying to.

サインインしてコメントする。


Pierre Benoit
Pierre Benoit 2014 年 9 月 19 日
There is a round-off error in the last column and the last row after the Gauss-Jordan algorithm is used for the first two columns. Therefore, because of your high tolerance, this round-off error is interpreted as a non-negligible number and the result is changed to a matrix with one extra rank (and in your case become regular).
The precision of the machine cannot be infinite ! You have to set your tol (or keep with the default tol, which is safe) in regard of the precision of the machine.
You can check how Rref works since it's just a m.file to see where it's happening.
Check also eps as Iain suggested.

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by