| Author |
Comment/Response |
Eric Burling
|
08/20/04 11:22am
I want to find the cosine of the angle A between 2 complex vectors, u = {c1,c2} and v = {c3,c4} using the formula :- cosA = <u|v> /||u||*||v||
I created 3 functions to insert into the above as follows :-
i) innerP[c1_,c2_,c3_,c4_]:=ComplexExpand[{Conjugate[c1],Conjugate[c2]}.{c3,c4}]
to calculate <u|v>
ii) normU[c1_,c2_]:=(ComplexExpand[{Conjugate[c1],Conjugate[c2]}.{c1,c2}])^1/2
and
iii) normV[c3_,c4_]:=(ComplexExpand[{Conjugate[c3],Conjugate[c4]}.{c3,c4}])^1/2
to calculate the norms ||u|| and||v||
Using the values c1=I; c2=1; c3=1/2-1/2*I; c4=1/2+1/2*I and the formula :-
cosA=innerP[c1,c2,c3,c4]/(normU[c1,c2]*normV[c3,c4])
I obtained non-real results which I could not interpret. Is this because the formula does'nt work with complex vectors or is my syntax flawed somewhere? Any help would be greatly appreciated.
URL: , |
|