Symmetric Matrix Product is not Symmetric [duplicate]
up vote
0
down vote
favorite
This question already has an answer here:
Why is 24.0000 not equal to 24.0000 in MATLAB?
6 answers
When we have two symmetric matrices x and y, the matrix z = xyx is theoretically also symmetric. However this is not exactly true in Matlab:
x = randn(3);
y = randn(3);
x = x*x';
y = x*x';
z = x*y*x;
issymetric(z)
Why does this happen and what can I do about it? Since I do not want to do
z = .5*(z+z')
all anwers in this stackoverflow question are unsatisfactionary.
matlab matrix symmetric
marked as duplicate by Sardar Usama, OmG, Luis Mendo
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 days ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
0
down vote
favorite
This question already has an answer here:
Why is 24.0000 not equal to 24.0000 in MATLAB?
6 answers
When we have two symmetric matrices x and y, the matrix z = xyx is theoretically also symmetric. However this is not exactly true in Matlab:
x = randn(3);
y = randn(3);
x = x*x';
y = x*x';
z = x*y*x;
issymetric(z)
Why does this happen and what can I do about it? Since I do not want to do
z = .5*(z+z')
all anwers in this stackoverflow question are unsatisfactionary.
matlab matrix symmetric
marked as duplicate by Sardar Usama, OmG, Luis Mendo
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 days ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
Why is 24.0000 not equal to 24.0000 in MATLAB?
6 answers
When we have two symmetric matrices x and y, the matrix z = xyx is theoretically also symmetric. However this is not exactly true in Matlab:
x = randn(3);
y = randn(3);
x = x*x';
y = x*x';
z = x*y*x;
issymetric(z)
Why does this happen and what can I do about it? Since I do not want to do
z = .5*(z+z')
all anwers in this stackoverflow question are unsatisfactionary.
matlab matrix symmetric
This question already has an answer here:
Why is 24.0000 not equal to 24.0000 in MATLAB?
6 answers
When we have two symmetric matrices x and y, the matrix z = xyx is theoretically also symmetric. However this is not exactly true in Matlab:
x = randn(3);
y = randn(3);
x = x*x';
y = x*x';
z = x*y*x;
issymetric(z)
Why does this happen and what can I do about it? Since I do not want to do
z = .5*(z+z')
all anwers in this stackoverflow question are unsatisfactionary.
This question already has an answer here:
Why is 24.0000 not equal to 24.0000 in MATLAB?
6 answers
matlab matrix symmetric
matlab matrix symmetric
asked 2 days ago
stollenm
17217
17217
marked as duplicate by Sardar Usama, OmG, Luis Mendo
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 days ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Sardar Usama, OmG, Luis Mendo
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 days ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
The problem is that Matlab does not perform the calculations exact, and thus the finite precision of the floating point calculations introduces some truncation errors.
If you run the example with symbolic math (no truncation, exact), you will see that z
is actually symmetric.
x = sym(randn(3));
y = sym(randn(3));
x = x*x';
y = y*y';
z = x*y*x;
% issymmetric does not take symbolic expressions as argument, convert to double
issymmetric(double(z))
Since you now do the double conversion at the end, and not in the intermediate steps, the matrix will remain symmetric.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The problem is that Matlab does not perform the calculations exact, and thus the finite precision of the floating point calculations introduces some truncation errors.
If you run the example with symbolic math (no truncation, exact), you will see that z
is actually symmetric.
x = sym(randn(3));
y = sym(randn(3));
x = x*x';
y = y*y';
z = x*y*x;
% issymmetric does not take symbolic expressions as argument, convert to double
issymmetric(double(z))
Since you now do the double conversion at the end, and not in the intermediate steps, the matrix will remain symmetric.
add a comment |
up vote
1
down vote
accepted
The problem is that Matlab does not perform the calculations exact, and thus the finite precision of the floating point calculations introduces some truncation errors.
If you run the example with symbolic math (no truncation, exact), you will see that z
is actually symmetric.
x = sym(randn(3));
y = sym(randn(3));
x = x*x';
y = y*y';
z = x*y*x;
% issymmetric does not take symbolic expressions as argument, convert to double
issymmetric(double(z))
Since you now do the double conversion at the end, and not in the intermediate steps, the matrix will remain symmetric.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The problem is that Matlab does not perform the calculations exact, and thus the finite precision of the floating point calculations introduces some truncation errors.
If you run the example with symbolic math (no truncation, exact), you will see that z
is actually symmetric.
x = sym(randn(3));
y = sym(randn(3));
x = x*x';
y = y*y';
z = x*y*x;
% issymmetric does not take symbolic expressions as argument, convert to double
issymmetric(double(z))
Since you now do the double conversion at the end, and not in the intermediate steps, the matrix will remain symmetric.
The problem is that Matlab does not perform the calculations exact, and thus the finite precision of the floating point calculations introduces some truncation errors.
If you run the example with symbolic math (no truncation, exact), you will see that z
is actually symmetric.
x = sym(randn(3));
y = sym(randn(3));
x = x*x';
y = y*y';
z = x*y*x;
% issymmetric does not take symbolic expressions as argument, convert to double
issymmetric(double(z))
Since you now do the double conversion at the end, and not in the intermediate steps, the matrix will remain symmetric.
answered 2 days ago
rickert
747316
747316
add a comment |
add a comment |