Please help me with this simple problem? Confusing

2 visualizaciones (últimos 30 días)
Yoon
Yoon el 19 de Sept. de 2014
Comentada: Stephen23 el 19 de Sept. de 2014
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 comentario
Stephen23
Stephen23 el 19 de Sept. de 2014
Editada: Stephen23 el 19 de Sept. de 2014
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:

Iniciar sesión para comentar.

Respuestas (4)

Iain
Iain el 19 de Sept. de 2014
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 el 19 de Sept. de 2014
Editada: Stephen23 el 19 de Sept. de 2014
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 comentarios
Yoon
Yoon el 19 de Sept. de 2014
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 el 19 de Sept. de 2014
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.

Iniciar sesión para comentar.


Yoon
Yoon el 19 de Sept. de 2014
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 comentario
Image Analyst
Image Analyst el 19 de Sept. de 2014
Who are you replying to? Please reply as a "comment" under the answer that you're replying to.

Iniciar sesión para comentar.


Pierre Benoit
Pierre Benoit el 19 de Sept. de 2014
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.

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by