Re: AB=BA



"John D'Errico" <woodchips@xxxxxxxxxxxxxxxx> wrote in
message <fu7hmh$j3s$1@xxxxxxxxxxxxxxxxxx>...
"Arie Driga" <a_driga@xxxxxxxxx> wrote in message
<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
I get
on my lhs a matrix of [b_21 b_22; b_11 b_12] and on my
rhs I
get [-b_12 -b_11; -b_22 -b_21]

For helper, did you get the same as I did? I am
trying to
understand 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.
See
what 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,
non-zero
% solution is returned for general A. For k == 1, the
problem will
% always have a solution. For k = -1, the solution will not
% generally exist unless A has a certain property. (I'll
leave this
% 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.

.



Relevant Pages

  • Re: AB=BA
    ... elseif numel>1 ... % verify that A is a square matrix ... error('A must be a real numeric array') ... % find a non-zero solution to this linear system ...
    (comp.soft-sys.matlab)
  • Re: Date Help..!!!Urgent
    ... And don't ask us to do your homework. ... then set an another array, which contains other details along with the ...  For instance, his first night is 2008-12-16, and last is ... overlap and changing prices) that contain the cost for each day. ...
    (comp.lang.php)
  • Re: Excel2000: How to check for Optional parameter=Nothing
    ... ElseIf IsArrayThen ... Cell reference or expression returning a cell reference like ... Array like ... >>> Arvi Laanemets ...
    (microsoft.public.excel.programming)
  • Re: Arrays/Literal Notation
    ... seeking help with homework, you should ensure that you do the following: ... My note says that I know the rank (number of dimensions) is 3; ... The rank of the array is 3, its dimensions are 3,1,4. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Using a Sparse Matrix library in c++
    ... This method uses the dcscmm routine from the SparseLib++ library ... int iR,//number of rows of A (in my case, it is a square matrix) ... /* to use dcscmm, we need pntre array. ...
    (sci.math.num-analysis)