Re: AB=BA
- From: "Arie Driga" <a_driga@xxxxxxxxx>
- Date: Thu, 17 Apr 2008 14:49:38 +0000 (UTC)
"John D'Errico" <woodchips@xxxxxxxxxxxxxxxx> wrote in
message <fu7hmh$j3s$1@xxxxxxxxxxxxxxxxxx>...
"Arie Driga" <a_driga@xxxxxxxxx> wrote in messageI get
<fu7bn6$qj5$1@xxxxxxxxxxxxxxxxxx>...
"helper " <spamless@xxxxxxxxxx> wrote in message
<fu79jm$mv3$1@xxxxxxxxxxxxxxxxxx>...
I did calculation by hand (for A*B=-B*A), at the end
trying toon my lhs a matrix of [b_21 b_22; b_11 b_12] and on myrhs I
get [-b_12 -b_11; -b_22 -b_21]
For helper, did you get the same as I did? I am
Seeunderstand your explanation as well.
Driga
You are doing correct.
[b_21 b_22; b_11 b_12] = [-b_12 -b_11; -b_22 -b_21]
Now this actually represents 4 different equations. The
first of which would be
b_21 = -b_12
Extract all 4 and you obtain a system of 4 equations.
non-zerowhat you can determine from them.
This is what I did to get a system with 4 equations :
0 0 0 1 b_11 -b_11
0 0 1 0 b_12 -b_12
0 1 0 0 * b_21 = -b_21
1 0 0 0 b_22 -b_22
next, I don't know what to do. For John, can you explain it
in a more simplified version, after all I am new in this
thing. Thanks all.
Have fun. Note that I've left out the information
as to when this has a solution for k = -1.
Since its homework, you need to do something.
John
function B = abba(A,k)
% abba: solves the linear system A*B = k*B*A
%
% Note: the solution will not be unique, so a specific,
% solution is returned for general A. For k == 1, theproblem will
% always have a solution. For k = -1, the solution will notleave this
% generally exist unless A has a certain property. (I'll
% up to the student to decide what that is.)
%
% arguments: (input)
% A - nxn (real) array
%
% k - (optional) scalar numeric
% DEFAULT: k = 1
% provide a default for k: k = 1
if (nargin<1) || isempty(k)
k = 1;
elseif numel(k)>1
error('k must be scalar if provided')
end
% verify that A is a (real) square matrix
if (nargin == 0) || isempty(A)
help abba
return
elseif ~isreal(A)
error('A must be a real numeric array')
end
sizeA = size(A);
if (length(sizeA) >2) || (diff(sizeA)~=0)
error('A must be a square matrix')
end
n = sizeA(1);
% create a linear system for A*B - k*B*A
M = kron(eye(n),A) - kron(k*A',eye(n));
% find a non-zero solution to this linear (homogenous) system
Mnull = null(M);
if isempty(Mnull)
% M had full rank
B = [];
return
end
B = reshape(sum(Mnull,2),n,n);
I will read this, and try to understand the function,
because there are a lot that I still do not know. And this
is not my homework, I just want to learn matlab.
Thanks again.
.
- Follow-Ups:
- Re: AB=BA
- From: John D'Errico
- Re: AB=BA
- References:
- Prev by Date: fftw with simulink
- Next by Date: Re: HELP for "quadgk" integral !!!
- Previous by thread: Re: AB=BA
- Next by thread: Re: AB=BA
- Index(es):
Relevant Pages
|