VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1[2]34 ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 18:00:47 02/27/03 Thu
Author: Dave Gilson
Subject: work example, read at peril !!!
In reply to: Dave Gilson 's message, "A thought about blogs" on 17:27:06 02/27/03 Thu

Some of things don't come out right, but I don't think you'll care ;-)


s=cell(1,3);
s{1}=[complex(0,0),complex(1,0);complex(1,0),complex(0,0)];
s{1}=[complex(0,0),complex(1,0);complex(1,0),complex(0,0)]

s =

[2x2 double] [] []

s{1}=[complex(0,0),complex(1,0);complex(1,0),complex(0,0)]; s{1}

ans =

0 1
1 0

s{2}=[complex(0,0),complex(0,-1);complex(0,1),complex(0,0)]; s{2}

ans =

0 0 - 1.0000i
0 + 1.0000i 0

s{3}=[complex(1,0),complex(0,0);complex(0,0),complex(-1,0)]; s{3}

ans =

1 0
0 -1

syms n n1 n2 n3 real;
ns=sym(zeros(2)); n=[n1,n2,n3];
for k=1:3; ns=ns+n(k)*s{k}; end; ns

ns =

[ n3, n1-i*n2]
[ n1+i*n2, -n3]

[v d]=eig(ns);
v=simple(v);
pretty(v), d

[ 2 2 2 1/2 2 2 2 1/2 ]
[(n3~ + n1~ + n2~ ) + n3~ -(n3~ + n1~ + n2~ ) + n3~]
[----------------------------- ------------------------------]
[ n1~ + n2~ I n1~ + n2~ I ]
[ ]
[ 1 1 ]

d =

[ (n3^2+n1^2+n2^2)^(1/2), 0]
[ 0, -(n3^2+n1^2+n2^2)^(1/2)]

v=subs(v,'(n3^2+n1^2+n2^2)^(1/2)',1); d=subs(d,'(n3^2+n1^2+n2^2)^(1/2)',1);
pretty(v), d

[ 1 + n3~ -1 + n3~ ]
[----------- -----------]
[n1~ + n2~ I n1~ + n2~ I]
[ ]
[ 1 1 ]

d =

1 0
0 -1

% have now got simplified matrix of eigen vectors and eigenvalues,
% and have substituted in the condition that n is a unit vector.
% Now create a cell of two column vectors to take in the columns of v.
ev=cell(1,2); ev{1}=v(:,1); ev{2}=v(:,2);
pretty(ev{1}), pretty(ev{2})

[ 1 + n3~ ]
[-----------]
[n1~ + n2~ I]
[ ]
[ 1 ]

[ -1 + n3~ ]
[-----------]
[n1~ + n2~ I]
[ ]
[ 1 ]
% Let us check that these two are indeed orthogonal, as they should be.
ev{1}*ev{2}
??? Error using ==> sym/mtimes
Inner matrix dimensions must agree.

size(ev{1}), size(ev{2})

ans =

2 1


ans =

2 1

ev{1}, ev{2}

ans =

[ (1+n3)/(n1+n2*i)]
[ 1]


ans =

[ (-1+n3)/(n1+n2*i)]
[ 1]

ev{1}(1,1)

ans =

(1+n3)/(n1+n2*i)

ev{1}*ev{2}
??? Error using ==> sym/mtimes
Inner matrix dimensions must agree.

%but they do don't they?
%Looks like I'll have to do this the long way this time!
(ev{1}(1,1)*ev{2}(1,1))+(ev{1}(2,1)*ev{2}(2,1))

ans =

(1+n3)/(n1+n2*i)^2*(-1+n3)+1

pretty(ans)

(1 + n3~) (-1 + n3~)
-------------------- + 1
2
(n1~ + n2~ I)
simplify(ans)

ans =

(-1+n3^2+n1^2+2*i*n1*n2-n2^2)/(n1+n2*i)^2

pretty(ans)

2 2 2
-1 + n3~ + n1~ + 2 I n1~ n2~ - n2~
-------------------------------------
2
(n1~ + n2~ I)
% Hmmm, eigenvectors don't appear to be orthogonal
% odd...
doc eig

Overloaded methods
doc symbolic/eig

%so if the eigenvectors are not orthogonal, this suggests that the
%origonal operator, ns, is not hermition. Let us check this
ns, ns'

ns =

[ n3, n1-i*n2]
[ n1+i*n2, -n3]


ans =

[ n3, n1-i*n2]
[ n1+n2*i, -n3]

ns==ns'

ans =

1 1
0 1

n1+i*n2==n1+n2*i

ans =

1

% So, ns IS hermitian, therefore the eigenvectors have to be orthogonal
% Furthermore something funny is going on!
% I shall recalculate the eigenvectors and re-test their orthogonality
% without simplifying or substituting them
[v d]=eig(ns);
e1=v(:,1); e2=v(:,2);
e1*e2
??? Error using ==> sym/mtimes
Inner matrix dimensions must agree.

% That damn error again!!!!
size(e1), size(e2)

ans =

2 1


ans =

2 1

size(e1)==size(e2)

ans =

1 1

e1

e1 =

[ (n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3-i*n2*(n3^2+n1^2+n2^2)^(1/2)-i*n2*n3)/(n1^2+n2^2)]
[ 1]

e2

e2 =

[ (-n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+i*n2*(n3^2+n1^2+n2^2)^(1/2)-i*n2*n3)/(n1^2+n2^2)]
[ 1]

e1(1)*e2(1)+e1(2)*e2(2)

ans =

(n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3-i*n2*(n3^2+n1^2+n2^2)^(1/2)-i*n2*n3)/(n1^2+n2^2)^2*(-n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+i*n2*(n3^2+n1^2+n2^2)^(1/2)-i*n2*n3)+1

pretty(ans)

1/2 1/2
(n1~ %1 + n1~ n3~ - n2~ %1 I - n2~ n3~ I)

1/2 1/2 / 2 2 2
(-n1~ %1 + n1~ n3~ + n2~ %1 I - n2~ n3~ I) / (n1~ + n2~ )
/

+ 1

2 2 2
%1 := n3~ + n1~ + n2~
simple(ans)

simplify:

2*n2*(i*n1+n2)/(n1^2+n2^2)


radsimp:

2*n2*(i*n1+n2)/(n1^2+n2^2)


combine(trig):

(2*i*n1*n2+2*n2^2)/(n1^2+n2^2)


factor:

2*i*n2/(n1+n2*i)


expand:

-1/(n1^2+n2^2)^2*n1^4+2*i/(n1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^2+n2^2)^(1/2)*i-i*n2*n3)+1


ans =

2*i*n2/(n1+n2*i)

pretty(ans)

2 I n2~
-----------
n1~ + n2~ I
dim
??? Undefined function or variable 'dim'.

dimension
??? Undefined function or variable 'dimension'.

% I realise I should be multiplying by the conjugate of one of the vectors!
e1*e2'

ans =

[ (n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3-i*n2*(n3^2+n1^2+n2^2)^(1/2)-i*n2*n3)/(n1^2+n2^2)^2*(-n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3-i*n2*(n3^2+n1^2+n2^2)^(1/2)+i*n2*n3), (n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3-i*n2*(n3^2+n1^2+n2^2)^(1/2)-i*n2*n3)/(n1^2+n2^2)]
[ (-n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3-i*n2*(n3^2+n1^2+n2^2)^(1/2)+i*n2*n3)/(n1^2+n2^2), 1]

% wrong again!
e1'*e2

ans =

(n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i+i*n2*n3)/(n1^2+n2^2)^2*(-n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i-i*n2*n3)+1

simple(ans)

simplify:

0


radsimp:

0


combine(trig):

0


factor:

0


expand:

-1/(n1^2+n2^2)^2*n1^4-2/(n1^2+n2^2)^2*n1^2*n2^2-1/(n1^2+n2^2)^2*n2^4+1


combine:

(n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i+i*n2*n3)/(n1^2+n2^2)^2*(-n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i-i*n2*n3)+1


convert(exp):

(n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i+i*n2*n3)/(n1^2+n2^2)^2*(-n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i-i*n2*n3)+1


convert(sincos):

(n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i+i*n2*n3)/(n1^2+n2^2)^2*(-n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i-i*n2*n3)+1


convert(tan):

(n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i+i*n2*n3)/(n1^2+n2^2)^2*(-n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i-i*n2*n3)+1


collect(n1):

(n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i+i*n2*n3)/(n1^2+n2^2)^2*(-n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i-i*n2*n3)+1


mwcos2sin:

(n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i+i*n2*n3)/(n1^2+n2^2)^2*(-n1*(n3^2+n1^2+n2^2)^(1/2)+n1*n3+n2*(n3^2+n1^2+n2^2)^(1/2)*i-i*n2*n3)+1


ans =

0

% YES! I have been forgetting my matrix multiplication!!!
ev{1}

ans =

[ (1+n3)/(n1+n2*i)]
[ 1]

ev{1}'

ans =

[ (1+n3)/(n1-i*n2), 1]

ev{1}'*ev{2}

ans =

(1+n3)/(n1-i*n2)*(-1+n3)/(n1+n2*i)+1

simple(ans)

simplify:

(-1+n3^2+n1^2+n2^2)/(n1^2+n2^2)


radsimp:

(-1+n3^2+n1^2+n2^2)/(n1-i*n2)/(n1+n2*i)


combine(trig):

(-1+n3^2+n1^2+n2^2)/(n1^2+n2^2)


factor:

(-1+n3^2+n1^2+n2^2)/(n1-n2*i)/(n1+n2*i)


expand:

-1/(n1-i*n2)/(n1+n2*i)+1/(n1-i*n2)/(n1+n2*i)*n3^2+1


combine:

(1+n3)/(n1-i*n2)*(-1+n3)/(n1+n2*i)+1


convert(exp):

(1+n3)/(n1-i*n2)*(-1+n3)/(n1+n2*i)+1


convert(sincos):

(1+n3)/(n1-i*n2)*(-1+n3)/(n1+n2*i)+1


convert(tan):

(1+n3)/(n1-i*n2)*(-1+n3)/(n1+n2*i)+1


collect(n1):

(1+n3)/(n1-i*n2)*(-1+n3)/(n1+n2*i)+1


mwcos2sin:

(1+n3)/(n1-i*n2)*(-1+n3)/(n1+n2*i)+1


ans =

(-1+n3^2+n1^2+n2^2)/(n1^2+n2^2)

subs(ans,'n3^2+n1^2+n2^2',1)

ans =

(-n3^2-n1^2-n2^2+n3^2*(n3^2+n1^2+n2^2)+n1^2*(n3^2+n1^2+n2^2)+n2^2*(n3^2+n1^2+n2^2))^(n3^2+n1^2+n2^2)/(n1^2*(n3^2+n1^2+n2^2)+n2^2*(n3^2+n1^2+n2^2))

simple(ans)

simplify:

(-n3^2-n1^2-n2^2+n3^4+2*n3^2*n1^2+2*n3^2*n2^2+n1^4+2*n1^2*n2^2+n2^4)^(n3^2+n1^2+n2^2)/(n3^2+n1^2+n2^2)/(n1^2+n2^2)


radsimp:

(-n3^2-n1^2-n2^2+n3^4+2*n3^2*n1^2+2*n3^2*n2^2+n1^4+2*n1^2*n2^2+n2^4)^(n3^2+n1^2+n2^2)/(n3^2+n1^2+n2^2)/(n1^2+n2^2)


combine(trig):

(-n3^2-n1^2-n2^2+n3^4+2*n3^2*n1^2+2*n3^2*n2^2+n1^4+2*n1^2*n2^2+n2^4)^(n3^2+n1^2+n2^2)/(n3^2*n1^2+n1^4+2*n1^2*n2^2+n3^2*n2^2+n2^4)


factor:

((n3^2+n1^2+n2^2)*(-1+n3^2+n1^2+n2^2))^(n3^2+n1^2+n2^2)/(n3^2+n1^2+n2^2)/(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+n2^2*(n3^2+n2^2))


mwcos2sin:

(-n3^2-n1^2-n2^2+n3^2*(n3^2+n1^2+n2^2)+n1^2*(n3^2+n1^2+n2^2)+n2^2*(n3^2+n1^2+n2^2))^(n3^2+n1^2+n2^2)/(n1^2*(n3^2+n1^2+n2^2)+n2^2*(n3^2+n1^2+n2^2))


ans =

((n3^2+n1^2+n2^2)*(-1+n3^2+n1^2+n2^2))^(n3^2+n1^2+n2^2)/(n3^2+n1^2+n2^2)/(n1^2+n2^2)

% Was almost there to proving ev{1} and ev{2} are orthogonal!
ev{1}'*ev{2}

ans =

(1+n3)/(n1-i*n2)*(-1+n3)/(n1+n2*i)+1

ip=simple(ans)

ip =

(-1+n3^2+n1^2+n2^2)/(n1^2+n2^2)

% n3^2+n1^2+n2^2=1 though!
ip=subs(ans,'n3^2+n1^2+n2^2',1)

ip =

((n3^2+n1^2+n2^2)^2+n3*(n3^2+n1^2+n2^2))^(n3^2+n1^2+n2^2)/(n1*(n3^2+n1^2+n2^2)+(-i)^(n3^2+n1^2+n2^2)*n2^(n3^2+n1^2+n2^2)*(n3^2+n1^2+n2^2))*(-n3^2-n1^2-n2^2+n3*(n3^2+n1^2+n2^2))^(n3^2+n1^2+n2^2)/(n1*(n3^2+n1^2+n2^2)+n2^(n3^2+n1^2+n2^2)*(i*(n3^2+n1^2+n2^2))^(n3^2+n1^2+n2^2)*(n3^2+n1^2+n2^2))*(n3^2+n1^2+n2^2)+(n3^2+n1^2+n2^2)^2

pretty(ip)

2 %1 2 2 2 %1
(%1 + n3~ %1) (-n3~ - n1~ - n2~ + n3~ %1) %1 2
------------------------------------------------------- + %1
%1 %1 %1 %1
(n1~ %1 + (-I) n2~ %1) (n1~ %1 + n2~ (%1 I) %1)

2 2 2
%1 := n3~ + n1~ + n2~
%????????????????????????
ip=subs(ans,'n3^2+n1^2+n2^2',1)

ip =

((n3^2+n1^2+n2^2)^2+n3*(n3^2+n1^2+n2^2))^(n3^2+n1^2+n2^2)/(n1*(n3^2+n1^2+n2^2)+(-i)^(n3^2+n1^2+n2^2)*n2^(n3^2+n1^2+n2^2)*(n3^2+n1^2+n2^2))*(-n3^2-n1^2-n2^2+n3*(n3^2+n1^2+n2^2))^(n3^2+n1^2+n2^2)/(n1*(n3^2+n1^2+n2^2)+n2^(n3^2+n1^2+n2^2)*((n3^2+n1^2+n2^2)*i)^(n3^2+n1^2+n2^2)*(n3^2+n1^2+n2^2))*(n3^2+n1^2+n2^2)+(n3^2+n1^2+n2^2)^2

ip=subs(ans,'n3^2+n1^2+n2^2',1)

ip =

((n3^2+n1^2+n2^2)^2+n3*(n3^2+n1^2+n2^2))^(n3^2+n1^2+n2^2)/(n1*(n3^2+n1^2+n2^2)+(-i)^(n3^2+n1^2+n2^2)*n2^(n3^2+n1^2+n2^2)*(n3^2+n1^2+n2^2))*(-n3^2-n1^2-n2^2+n3*(n3^2+n1^2+n2^2))^(n3^2+n1^2+n2^2)/(n1*(n3^2+n1^2+n2^2)+n2^(n3^2+n1^2+n2^2)*((n3^2+n1^2+n2^2)*i)^(n3^2+n1^2+n2^2)*(n3^2+n1^2+n2^2))*(n3^2+n1^2+n2^2)+(n3^2+n1^2+n2^2)^2

pertty(ip)
??? Undefined function or variable 'pertty'.

pretty(ip)

2 %1 2 2 2 %1
(%1 + n3~ %1) (-n3~ - n1~ - n2~ + n3~ %1) %1 2
------------------------------------------------------- + %1
%1 %1 %1 %1
(n1~ %1 + (-I) n2~ %1) (n1~ %1 + n2~ (%1 I) %1)

2 2 2
%1 := n3~ + n1~ + n2~
% Well, without knowledge of how to make 'smarter' substitutions,
% I think it is safe to say that I have shown that the eigenvectors
% are also orthogonal
ip=simple(ev{1}'*ev{2})

ip =

(-1+n3^2+n1^2+n2^2)/(n1^2+n2^2)

pretty(ip)

2 2 2
-1 + n3~ + n1~ + n2~
-----------------------
2 2
n1~ + n2~
% sum(ni^2)=1, therefore sum(ni^2)-1=0
% So I do have orthogonal eigenvectors, but I still have not
% found a smart way of telling matlab that their sum of square
% is equal to one!
% Perhaps if I don't get anyway on this line of attack I should
% try rewriting n in terms of spherical polar coordinates with
% a unit radius, thus reducing parameters down from 3 to 2.

% Next phase, let's normalise the (orthogonal) eigenvectors!

% and I'm not going to bother with using cell arrays either,
% nice idea tying the vectors together into a unified structure.
% However, I think for what Im' donig it's a bit redundant.
ev1=ev{1}; ev2=ev{2};
norm(ev1), norm(2)
??? Error using ==> norm
Function 'norm' is not defined for values of class 'sym'.

norm(ev1), norm(ev2)
??? Error using ==> norm
Function 'norm' is not defined for values of class 'sym'.


% I have to say, using symbolic maths presents lots of obsticals to you
% in matlab, there is probably something in TMW file exchange, but I think
% it will be quicker to fashion my own algorithm than go looking for something
% just now. I'll log in and look later.
ev1norm=sqrt(ev1(1)^2+ev1(2)^2)

ev1norm =

((1+n3)^2/(n1+n2*i)^2+1)^(1/2)

pretty(ev1norm)

/ 2 \1/2
| (1 + n3~) |
|-------------- + 1|
| 2 |
\(n1~ + n2~ I) /
ev2norm=sqrt(ev2(1)^2+ev2(2)^2); pretty(ev2norm)

/ 2 \1/2
| (-1 + n3~) |
|-------------- + 1|
| 2 |
\(n1~ + n2~ I) /
ev1normsq=ev1(1)^2+ev1(2)^2; ev2normsq=ev2(1)^2+ev2(2)^2;
% I decided it would be more convenient to eliminate the
% square root as I will be using the outer product notation
% when I compute my eigenspace projector.

% Next phase, computer the projector onto the eigen space
% To do this we need an orthonormal basis of the eigenspace.
% Hence the need for orthonormal eigenvectors. We will then
% Compute the projector in the outer-product notation...
% P=|e1> % dim(eigenspace)=2).

eigenprojector=((ev1*ev1')/ev1normsq)+((ev2*ev2')/ev2normsq)

eigenprojector =

[ (1+n3)^2/(n1+n2*i)/(n1-i*n2)/((1+n3)^2/(n1+n2*i)^2+1)+(-1+n3)^2/(n1+n2*i)/(n1-i*n2)/((-1+n3)^2/(n1+n2*i)^2+1), (1+n3)/(n1+n2*i)/((1+n3)^2/(n1+n2*i)^2+1)+(-1+n3)/(n1+n2*i)/((-1+n3)^2/(n1+n2*i)^2+1)]
[ (1+n3)/(n1-i*n2)/((1+n3)^2/(n1+n2*i)^2+1)+(-1+n3)/(n1-i*n2)/((-1+n3)^2/(n1+n2*i)^2+1), 1/((1+n3)^2/(n1+n2*i)^2+1)+1/((-1+n3)^2/(n1+n2*i)^2+1)]

pretty(eigenprojector)

[ 2
[ (1 + n3~)
[------------------------------------------------
[ / 2 \
[ | (1 + n3~) |
[(n1~ + n2~ I) (n1~ - n2~ I) |-------------- + 1|
[ | 2 |
[ \(n1~ + n2~ I) /

2
(-1 + n3~)
+ ------------------------------------------------ ,
/ 2 \
| (-1 + n3~) |
(n1~ + n2~ I) (n1~ - n2~ I) |-------------- + 1|
| 2 |
\(n1~ + n2~ I) /

1 + n3~
----------------------------------
/ 2 \
| (1 + n3~) |
(n1~ + n2~ I) |-------------- + 1|
| 2 |
\(n1~ + n2~ I) /

]
-1 + n3~ ]
+ ----------------------------------]
/ 2 \]
| (-1 + n3~) |]
(n1~ + n2~ I) |-------------- + 1|]
| 2 |]
\(n1~ + n2~ I) /]

[ 1 + n3~
[----------------------------------
[ / 2 \
[ | (1 + n3~) |
[(n1~ - n2~ I) |-------------- + 1|
[ | 2 |
[ \(n1~ + n2~ I) /

-1 + n3~
+ ---------------------------------- ,
/ 2 \
| (-1 + n3~) |
(n1~ - n2~ I) |-------------- + 1|
| 2 |
\(n1~ + n2~ I) /

1 1 ]
------------------ + ------------------]
2 2 ]
(1 + n3~) (-1 + n3~) ]
-------------- + 1 -------------- + 1]
2 2 ]
(n1~ + n2~ I) (n1~ + n2~ I) ]
% Yikes! Lets see if we can cut this down a bit...

test=simple(eigenprojector)

test =

[ (1+n3)^2/(n1+n2*i)/(n1-i*n2)/((1+n3)^2/(n1+n2*i)^2+1)+(-1+n3)^2/(n1+n2*i)/(n1-i*n2)/((-1+n3)^2/(n1+n2*i)^2+1), (1+n3)/(n1+n2*i)/((1+n3)^2/(n1+n2*i)^2+1)+(-1+n3)/(n1+n2*i)/((-1+n3)^2/(n1+n2*i)^2+1)]
[ (1+n3)/(n1-i*n2)/((1+n3)^2/(n1+n2*i)^2+1)+(-1+n3)/(n1-i*n2)/((-1+n3)^2/(n1+n2*i)^2+1), 1/((1+n3)^2/(n1+n2*i)^2+1)+1/((-1+n3)^2/(n1+n2*i)^2+1)]

pretty(test)

[ 2
[ (1 + n3~)
[------------------------------------------------
[ / 2 \
[ | (1 + n3~) |
[(n1~ + n2~ I) (n1~ - n2~ I) |-------------- + 1|
[ | 2 |
[ \(n1~ + n2~ I) /

2
(-1 + n3~)
+ ------------------------------------------------ ,
/ 2 \
| (-1 + n3~) |
(n1~ + n2~ I) (n1~ - n2~ I) |-------------- + 1|
| 2 |
\(n1~ + n2~ I) /

1 + n3~
----------------------------------
/ 2 \
| (1 + n3~) |
(n1~ + n2~ I) |-------------- + 1|
| 2 |
\(n1~ + n2~ I) /

]
-1 + n3~ ]
+ ----------------------------------]
/ 2 \]
| (-1 + n3~) |]
(n1~ + n2~ I) |-------------- + 1|]
| 2 |]
\(n1~ + n2~ I) /]

[ 1 + n3~
[----------------------------------
[ / 2 \
[ | (1 + n3~) |
[(n1~ - n2~ I) |-------------- + 1|
[ | 2 |
[ \(n1~ + n2~ I) /

-1 + n3~
+ ---------------------------------- ,
/ 2 \
| (-1 + n3~) |
(n1~ - n2~ I) |-------------- + 1|
| 2 |
\(n1~ + n2~ I) /

1 1 ]
------------------ + ------------------]
2 2 ]
(1 + n3~) (-1 + n3~) ]
-------------- + 1 -------------- + 1]
2 2 ]
(n1~ + n2~ I) (n1~ + n2~ I) ]
% That didn't help!
test=simplify(eigenprojector)

test =

[ 2*(1-2*n3^2+n1^2+2*i*n1*n2-n2^2+n3^4+n3^2*n1^2+2*i*n3^2*n1*n2-n3^2*n2^2)*(n1+n2*i)/(n1-n2*i)/(1+2*n3+n3^2+n1^2+2*i*n1*n2-n2^2)/(1-2*n3+n3^2+n1^2+2*i*n1*n2-n2^2), 2*(-1+n3^2+n1^2+2*i*n1*n2-n2^2)*n3*(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~ - n2~ I)) ,

2 2 2 ]
(-1 + n3~ + n1~ + 2 I n1~ n2~ - n2~ ) n3~ (n1~ + n2~ I)]
2 ---------------------------------------------------------]
%4 %3 %2 %1 ]

[ 2 2 2 2
[ (n1~ + n2~ I) n3~ (-1 + n3~ + n1~ + 2 I n1~ n2~ - n2~ )
[2 ---------------------------------------------------------- ,
[ %4 %3 %2 %1 (n1~ - n2~ I)

2 2 2 2 ]
(n1~ + n2~ I) (1 + n3~ + n1~ + 2 I n1~ n2~ - n2~ )]
2 -----------------------------------------------------]
%4 %3 %2 %1 ]

%1 := n1~ + I + n2~ I + n3~ I

%2 := n1~ + I - n3~ I + n2~ I

%3 := n1~ - I + n3~ I + n2~ I

%4 := n1~ - I + n2~ I - n3~ I
% Hmm this is not going well. In the words of Dirac,
% it does not have mathematical beauty!
sqrt(ev1(1)^2+ev1(2)^2); pretty(ans)

/ 2 \1/2
| (1 + n3~) |
|-------------- + 1|
| 2 |
\(n1~ + n2~ I) /
% Is this equal to one already?
% I think I need to take a fresh approach to this. I'm not getting anywhere yet
% Signing off...
diary off
% Is this on?
diary off



[ Next Thread | Previous Thread | Next Message | Previous Message ]


Replies:

  • what the fuck is a blog? n/t -- Roger, 19:17:59 02/27/03 Thu
  • blog -- will, 00:38:55 02/28/03 Fri
    [ Contact Forum Admin ]


    Forum timezone: GMT+0
    VF Version: 3.00b, ConfDB:
    Before posting please read our privacy policy.
    VoyForums(tm) is a Free Service from Voyager Info-Systems.
    Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.