Why is MATLAB giving false output for A and B being equal?

  • MATLAB
  • Thread starter stihl29
  • Start date
  • Tags
    Matlab
In summary, some people may consider MATLAB to be "retarded" due to its perceived lack of user-friendliness for beginners. However, it is a widely used tool by scientists for data analysis, simulation, and visualization and can be used for a wide range of scientific research. Some people may prefer other programming languages over MATLAB for their flexibility and suitability for specific tasks, and it is not necessary for all scientists to learn MATLAB, but it can be a valuable skill to have.
  • #1
stihl29
25
0
i have this code

A = [2 -2;-2 -1];
A=orth(A);
B=inv(A);
if A==B
disp('match');
else
disp('no match');
end

they are the same, but i always get the output 'no match'

any ideas?
 
Physics news on Phys.org
  • #2
Technically A is not equal to B because the inverse algorithm gives only an approximation.

To see this,

Code:
>> orth([2 -2;-2 -1]) - inv(orth([2 -2;-2 -1]))
ans =
  1.0e-015 *
   0.888178419700125  -0.444089209850063
  -0.388578058618805  -0.777156117237609

So your expression is being analysed as false.
 

1. Why do some people consider MATLAB to be "retarded"?

Some people may consider MATLAB to be "retarded" because it is not as user-friendly as other programming languages and can be difficult for beginners to learn.

2. Is MATLAB actually a useful tool for scientists?

Yes, MATLAB is a widely used tool by scientists for data analysis, simulation, and visualization. It offers a variety of built-in functions, toolboxes, and libraries that make it a powerful tool for scientific research.

3. Can I use MATLAB for any type of scientific research?

Yes, MATLAB can be used for a wide range of scientific research, including but not limited to engineering, physics, mathematics, biology, and finance.

4. Why do some people prefer other programming languages over MATLAB?

Some people may prefer other programming languages over MATLAB because they offer more flexibility and control, or because they are more suitable for specific tasks. Additionally, some people may find the syntax of MATLAB to be less intuitive compared to other languages.

5. Is it necessary to learn MATLAB as a scientist?

It depends on the specific field of research and the tasks involved. While MATLAB is a valuable tool for many scientists, it is not necessary to learn it for all types of research. It is always beneficial to have a diverse skill set in various programming languages, but it ultimately depends on the individual's research needs.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
584
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
553
Back
Top