(* wzor Rodriguesa 
http://mathworld.wolfram.com/RodriguesRotationFormula.html
*)

omegam[w1_,w2_,w3_]:={{0,-w3,w2},{w3,0,-w1},{-w2,w1,0}}

MatrixForm[omegam[w1,w2,w3]]

MatrixForm[omegam[w1,w2,w3].omegam[w1,w2,w3]]

Simplify[  
MatrixForm[omegam[w1,w2,w3].omegam[w1,w2,w3]],Element[w1,Reals]&&Element[w2,Reals]&&Element[w3,Reals]&&Element[phi,Reals]&&(w1*w1+w2*w2+w3*w3==1)]

R[w1_,w2_,w3_,phi_]:=IdentityMatrix[3]+Sin[phi]*omegam[w1,w2,w3]+(1-Cos[phi])*omegam[w1,w2,w3].omegam[w1,w2,w3]

FullSimplify[MatrixForm[R[w1,w2,w3,phi]],Element[w1,Reals]&&Element[w2,Reals]&&Element[w3,Reals]&&Element[phi,Reals]&&(w1*w1+w2*w2+w3*w3==1)]

MatrixForm[R[0,0,1,phi]]

FullSimplify[R[0,0,1,phi].R[0,0,1,-phi]]

FullSimplify[R[0,0,1,phi].R[0,0,-1,phi]]

FullSimplify[R[w1,w2,w3,phi].R[-w1,-w2,-w3,phi],Element[w1,Reals]&&Element[w2,Reals]&&Element[w3,Reals]&&Element[phi,Reals]&&(w1*w1+w2*w2+w3*w3==1)]

FullSimplify[R[w1,w2,w3,phi].R[w1,w2,w3,-phi],Element[w1,Reals]&&Element[w2,Reals]&&Element[w3,Reals]&&Element[phi,Reals]&&(w1*w1+w2*w2+w3*w3==1)]

FullSimplify[Det[R[w1,w2,w3,phi]],Element[w1,Reals]&&Element[w2,Reals]&&Element[w3,Reals]&&Element[phi,Reals]&&(w1*w1+w2*w2+w3*w3==1)]

(* R3 *)

R3=FullSimplify[R[0,0,1,phi]]

MatrixForm[R3]

minusiX3=FullSimplify[D[R[0,0,1,phi],phi]]/.phi->0

MatrixForm[minusiX3]

(* R1 *)

R1=FullSimplify[R[1,0,0,phi]]

MatrixForm[R1]

minusiX1=FullSimplify[D[R[1,0,0,phi],phi]]/.phi->0

MatrixForm[minusiX1]

(* R2 *)

R2=FullSimplify[R[0,1,0,phi]]

MatrixForm[R2]

minusiX2=FullSimplify[D[R[0,1,0,phi],phi]]/.phi->0

MatrixForm[minusiX2]

X1=I*minusiX1

X2=I*minusiX2

X3=I*minusiX3

(* Tworze wektor generatorow *)

Xm={X1,X2,X3}

(* Definiuje sam symbol Levi-Civity. Pewnie jest zdefiniowany w Mathematice, ale nie chce mi sie go szukac *)Epsilonm=Array[Epsilon,{3,3,3}];
Do[Epsilon[i,j,k]=0,{i,1,3},{j,1,3},{k,1,3}];
Epsilon[1,2,3]=1;
Epsilon[3,1,2]=1;
Epsilon[2,3,1]=1;
Epsilon[2,1,3]=-1;
Epsilon[3,2,1]=-1;
Epsilon[1,3,2]=-1;

MatrixForm[Xm[[1]]]

MatrixForm[Xm[[2]]]

MatrixForm[Xm[[3]]]

(* 
 Sprawdzenie relacji komutacji:   Czy [Xk,Xj]= sum_{l} i*Epsilon[k,j,l]*Xl ? 
 Interesujace przypadki ze wzgledu na antysymetrie i cyklicznosc to (i=1,j=2), (i=3,j=1),(i=2,j=3)
 *)

Do[
{chk1=Xm[[i]].Xm[[j]]-Xm[[j]].Xm[[i]];
chk2=Sum[I*Epsilon[i,j,l]*Xm[[l]],{l,1,3}];
res=0;
Do[If[chk2==chk1,res=k],{k,1,3}];
Print["Xm[",i,"].Xm[",j,"] - Xm[",j,"].Xm[",i,"]= ",MatrixForm[chk1],"= Sum[I*Epsilon[",i,",",j,",",l,"]*Xm[",l,"],{",l,",1,3}]=",MatrixForm[chk2]]
},{i,1,3},{j,1,3}]

(* Tworzymy reprezentacje SO(3) o wymiarze 2*j+1 *)

j=1/2;

XXMINUSm=Array[XXMINUS,{2*j+1,2*j+1}]

XXPLUSm=Array[XXPLUS,{2*j+1,2*j+1}]

XXZEROm=Array[XXZERO,{2*j+1,2*j+1}]

Do[XXZERO[j-m+1,j-mp+1]=m*KroneckerDelta[mp,m],{m,-j,j,1},{mp,-j,j,1}]

MatrixForm[XXZEROm]

Do[XXPLUS[j-m+1,j-mp+1]=Sqrt[(j-mp)*(j+mp+1)]*KroneckerDelta[mp+1,m],{m,-j,j,1},{mp,-j,j,1}]

Do[XXMINUS[j-m+1,j-mp+1]=Sqrt[(j+mp)*(j-mp+1)]*KroneckerDelta[mp-1,m],{m,-j,j,1},{mp,-j,j,1}]

XX1m=Array[XX1,{2*j+1,2*j+1}]

XX2m=Array[XX2,{2*j+1,2*j+1}]

XX3m=Array[XX3,{2*j+1,2*j+1}]

XX1m=(XXPLUSm+XXMINUSm)/2

XX2m=(XXPLUSm-XXMINUSm)/(2*I)

XX3m=XXZEROm

XXm={XX1m,XX2m,XX3m}

XXm[[1]]

MatrixForm[XXm[[1]]]

MatrixForm[XXm[[2]]]

MatrixForm[XXm[[3]]]

MatrixForm[Simplify[XXm[[1]].XXm[[1]]  + XXm[[2]].XXm[[2]]   + XXm[[3]].XXm[[3]]]]

Do[
{chk1=XXm[[i]].XXm[[j]]-XXm[[j]].XXm[[i]];
chk2=Sum[I*Epsilon[i,j,l]*XXm[[l]],{l,1,3}];
If[chk2==chk1,Print["XXm[",i,"].XXm[",j,"] - XXm[",j,"].XXm[",i,"]= ",MatrixForm[chk1],"= Sum[I*Epsilon[",i,",",j,",",l,"]*XXm[",l,"],{",l,",1,3}]=",MatrixForm[chk2]]]
},{i,1,3},{j,1,3}]

Clear[j,XXMINUS,XXMINUSm,XXPLUS,XXPLUSm,XXZERO,XXZEROm,XX1m,XX2m,XX3m,XXm]

(* Tworzymy reprezentacje SO(3) o wymiarze 2*j+1 *)

j=1;

XXMINUSm=Array[XXMINUS,{2*j+1,2*j+1}]

XXPLUSm=Array[XXPLUS,{2*j+1,2*j+1}]

XXZEROm=Array[XXZERO,{2*j+1,2*j+1}]

Do[XXZERO[j-m+1,j-mp+1]=m*KroneckerDelta[mp,m],{m,-j,j,1},{mp,-j,j,1}]

MatrixForm[XXZEROm]

Do[XXPLUS[j-m+1,j-mp+1]=Sqrt[(j-mp)*(j+mp+1)]*KroneckerDelta[mp+1,m],{m,-j,j,1},{mp,-j,j,1}]

Do[XXMINUS[j-m+1,j-mp+1]=Sqrt[(j+mp)*(j-mp+1)]*KroneckerDelta[mp-1,m],{m,-j,j,1},{mp,-j,j,1}]

XX1m=Array[XX1,{2*j+1,2*j+1}]

XX2m=Array[XX2,{2*j+1,2*j+1}]

XX3m=Array[XX3,{2*j+1,2*j+1}]

XX1m=(XXPLUSm+XXMINUSm)/2

XX2m=(XXPLUSm-XXMINUSm)/(2*I)

XX3m=XXZEROm

XXm={XX1m,XX2m,XX3m}

XXm[[1]]

MatrixForm[XXm[[1]]]

MatrixForm[XXm[[2]]]

MatrixForm[XXm[[3]]]

MatrixForm[Simplify[XXm[[1]].XXm[[1]]  + XXm[[2]].XXm[[2]]   + XXm[[3]].XXm[[3]]]]

Do[
{chk1=XXm[[i]].XXm[[j]]-XXm[[j]].XXm[[i]];
chk2=Sum[I*Epsilon[i,j,l]*XXm[[l]],{l,1,3}];
If[chk2==chk1,Print["XXm[",i,"].XXm[",j,"] - XXm[",j,"].XXm[",i,"]= ",MatrixForm[chk1],"= Sum[I*Epsilon[",i,",",j,",",l,"]*XXm[",l,"],{",l,",1,3}]=",MatrixForm[chk2]]]
},{i,1,3},{j,1,3}]

Clear[j,XXMINUS,XXMINUSm,XXPLUS,XXPLUSm,XXZERO,XXZEROm,XX1m,XX2m,XX3m,XXm]

(* Tworzymy reprezentacje SO(3) o wymiarze 2*j+1 *)

j=3/2;

XXMINUSm=Array[XXMINUS,{2*j+1,2*j+1}]

XXPLUSm=Array[XXPLUS,{2*j+1,2*j+1}]

XXZEROm=Array[XXZERO,{2*j+1,2*j+1}]

Do[XXZERO[j-m+1,j-mp+1]=m*KroneckerDelta[mp,m],{m,-j,j,1},{mp,-j,j,1}]

MatrixForm[XXZEROm]

Do[XXPLUS[j-m+1,j-mp+1]=Sqrt[(j-mp)*(j+mp+1)]*KroneckerDelta[mp+1,m],{m,-j,j,1},{mp,-j,j,1}]

Do[XXMINUS[j-m+1,j-mp+1]=Sqrt[(j+mp)*(j-mp+1)]*KroneckerDelta[mp-1,m],{m,-j,j,1},{mp,-j,j,1}]

XX1m=Array[XX1,{2*j+1,2*j+1}]

XX2m=Array[XX2,{2*j+1,2*j+1}]

XX3m=Array[XX3,{2*j+1,2*j+1}]

XX1m=(XXPLUSm+XXMINUSm)/2

XX2m=(XXPLUSm-XXMINUSm)/(2*I)

XX3m=XXZEROm

XXm={XX1m,XX2m,XX3m}

XXm[[1]]

MatrixForm[XXm[[1]]]

MatrixForm[XXm[[2]]]

MatrixForm[XXm[[3]]]

MatrixForm[Simplify[XXm[[1]].XXm[[1]]  + XXm[[2]].XXm[[2]]   + XXm[[3]].XXm[[3]]]]

Do[
{chk1=XXm[[i]].XXm[[j]]-XXm[[j]].XXm[[i]];
chk2=Sum[I*Epsilon[i,j,l]*XXm[[l]],{l,1,3}];
If[chk2==chk1,Print["XXm[",i,"].XXm[",j,"] - XXm[",j,"].XXm[",i,"]= ",MatrixForm[chk1],"= Sum[I*Epsilon[",i,",",j,",",l,"]*XXm[",l,"],{",l,",1,3}]=",MatrixForm[chk2]]]
},{i,1,3},{j,1,3}]

Clear[j,XXMINUS,XXMINUSm,XXPLUS,XXPLUSm,XXZERO,XXZEROm,XX1m,XX2m,XX3m,XXm]

(* Tworzymy reprezentacje SO(3) o wymiarze 2*j+1 *)

j=2;

XXMINUSm=Array[XXMINUS,{2*j+1,2*j+1}]

XXPLUSm=Array[XXPLUS,{2*j+1,2*j+1}]

XXZEROm=Array[XXZERO,{2*j+1,2*j+1}]

Do[XXZERO[j-m+1,j-mp+1]=m*KroneckerDelta[mp,m],{m,-j,j,1},{mp,-j,j,1}]

MatrixForm[XXZEROm]

Do[XXPLUS[j-m+1,j-mp+1]=Sqrt[(j-mp)*(j+mp+1)]*KroneckerDelta[mp+1,m],{m,-j,j,1},{mp,-j,j,1}]

Do[XXMINUS[j-m+1,j-mp+1]=Sqrt[(j+mp)*(j-mp+1)]*KroneckerDelta[mp-1,m],{m,-j,j,1},{mp,-j,j,1}]

XX1m=Array[XX1,{2*j+1,2*j+1}]

XX2m=Array[XX2,{2*j+1,2*j+1}]

XX3m=Array[XX3,{2*j+1,2*j+1}]

XX1m=(XXPLUSm+XXMINUSm)/2

XX2m=(XXPLUSm-XXMINUSm)/(2*I)

XX3m=XXZEROm

XXm={XX1m,XX2m,XX3m}

XXm[[1]]

MatrixForm[XXm[[1]]]

MatrixForm[XXm[[2]]]

MatrixForm[XXm[[3]]]

MatrixForm[Simplify[XXm[[1]].XXm[[1]]  + XXm[[2]].XXm[[2]]   + XXm[[3]].XXm[[3]]]]

Do[
{chk1=XXm[[i]].XXm[[j]]-XXm[[j]].XXm[[i]];
chk2=Sum[I*Epsilon[i,j,l]*XXm[[l]],{l,1,3}];
If[chk2==chk1,Print["XXm[",i,"].XXm[",j,"] - XXm[",j,"].XXm[",i,"]= ",MatrixForm[chk1],"= Sum[I*Epsilon[",i,",",j,",",l,"]*XXm[",l,"],{",l,",1,3}]=",MatrixForm[chk2]]]
},{i,1,3},{j,1,3}]

Clear[j,XXMINUS,XXMINUSm,XXPLUS,XXPLUSm,XXZERO,XXZEROm,XX1m,XX2m,XX3m,XXm]

(* Tworzymy reprezentacje SO(3) o wymiarze 2*j+1 *)

j=5/2;

XXMINUSm=Array[XXMINUS,{2*j+1,2*j+1}]

XXPLUSm=Array[XXPLUS,{2*j+1,2*j+1}]

XXZEROm=Array[XXZERO,{2*j+1,2*j+1}]

Do[XXZERO[j-m+1,j-mp+1]=m*KroneckerDelta[mp,m],{m,-j,j,1},{mp,-j,j,1}]

MatrixForm[XXZEROm]

Do[XXPLUS[j-m+1,j-mp+1]=Sqrt[(j-mp)*(j+mp+1)]*KroneckerDelta[mp+1,m],{m,-j,j,1},{mp,-j,j,1}]

Do[XXMINUS[j-m+1,j-mp+1]=Sqrt[(j+mp)*(j-mp+1)]*KroneckerDelta[mp-1,m],{m,-j,j,1},{mp,-j,j,1}]

XX1m=Array[XX1,{2*j+1,2*j+1}]

XX2m=Array[XX2,{2*j+1,2*j+1}]

XX3m=Array[XX3,{2*j+1,2*j+1}]

XX1m=(XXPLUSm+XXMINUSm)/2

XX2m=(XXPLUSm-XXMINUSm)/(2*I)

XX3m=XXZEROm

XXm={XX1m,XX2m,XX3m}

XXm[[1]]

MatrixForm[XXm[[1]]]

MatrixForm[XXm[[2]]]

MatrixForm[XXm[[3]]]

MatrixForm[Simplify[XXm[[1]].XXm[[1]]  + XXm[[2]].XXm[[2]]   + XXm[[3]].XXm[[3]]]]

Do[
{chk1=XXm[[i]].XXm[[j]]-XXm[[j]].XXm[[i]];
chk2=Sum[I*Epsilon[i,j,l]*XXm[[l]],{l,1,3}];
If[chk2==chk1,Print["XXm[",i,"].XXm[",j,"] - XXm[",j,"].XXm[",i,"]= ",MatrixForm[chk1],"= Sum[I*Epsilon[",i,",",j,",",l,"]*XXm[",l,"],{",l,",1,3}]=",MatrixForm[chk2]]]
},{i,1,3},{j,1,3}]

Clear[j,XXMINUS,XXMINUSm,XXPLUS,XXPLUSm,XXZERO,XXZEROm,XX1m,XX2m,XX3m,XXm]

(* Tworzymy reprezentacje SO(3) o wymiarze 2*j+1 *)

j=3;

XXMINUSm=Array[XXMINUS,{2*j+1,2*j+1}]

XXPLUSm=Array[XXPLUS,{2*j+1,2*j+1}]

XXZEROm=Array[XXZERO,{2*j+1,2*j+1}]

Do[XXZERO[j-m+1,j-mp+1]=m*KroneckerDelta[mp,m],{m,-j,j,1},{mp,-j,j,1}]

MatrixForm[XXZEROm]

Do[XXPLUS[j-m+1,j-mp+1]=Sqrt[(j-mp)*(j+mp+1)]*KroneckerDelta[mp+1,m],{m,-j,j,1},{mp,-j,j,1}]

Do[XXMINUS[j-m+1,j-mp+1]=Sqrt[(j+mp)*(j-mp+1)]*KroneckerDelta[mp-1,m],{m,-j,j,1},{mp,-j,j,1}]

XX1m=Array[XX1,{2*j+1,2*j+1}]

XX2m=Array[XX2,{2*j+1,2*j+1}]

XX3m=Array[XX3,{2*j+1,2*j+1}]

XX1m=(XXPLUSm+XXMINUSm)/2

XX2m=(XXPLUSm-XXMINUSm)/(2*I)

XX3m=XXZEROm

XXm={XX1m,XX2m,XX3m}

XXm[[1]]

MatrixForm[XXm[[1]]]

MatrixForm[XXm[[2]]]

MatrixForm[XXm[[3]]]

MatrixForm[Simplify[XXm[[1]].XXm[[1]]  + XXm[[2]].XXm[[2]]   + XXm[[3]].XXm[[3]]]]

Do[
{chk1=XXm[[i]].XXm[[j]]-XXm[[j]].XXm[[i]];
chk2=Sum[I*Epsilon[i,j,l]*XXm[[l]],{l,1,3}];
If[chk2==chk1,Print["XXm[",i,"].XXm[",j,"] - XXm[",j,"].XXm[",i,"]= ",MatrixForm[chk1],"= Sum[I*Epsilon[",i,",",j,",",l,"]*XXm[",l,"],{",l,",1,3}]=",MatrixForm[chk2]]]
},{i,1,3},{j,1,3}]

Clear[j,XXMINUS,XXMINUSm,XXPLUS,XXPLUSm,XXZERO,XXZEROm,XX1m,XX2m,XX3m,XXm]