(* Input *)
(*kin = 20.;*)
mass= 939.;
range = 3;

Integrate[((Sin[x])^2),x]
Integrate[Sin[x a]Sin[x b],x]
D[((Sin[a x])/(a x)),x]
D[((Cos[a x])/(a x)),x]

sps={{Dashing[None],RGBColor[0,0,0]}, {Dashing[Large],RGBColor[1,0,0]},{Dashing[Medium],RGBColor[0,0,1]},{Dashing[None],RGBColor[0,1,0]},{Dashing[None],RGBColor[0,1,1]}};

kOut[e_] := ((Sqrt[2*mass*e])/197.327)

kIn[e_,U0_] := ((Sqrt[2 mass (e- U0)])/197.327)

ang = 0;
Plot[{e*SphericalBesselJ[ang,e],Sin[e-ang*(Pi/2)],Sqrt[((Pi e)/2)]BesselJ[ang+0.5,e]},{e,0,50},PlotStyle->sps]

Plot[{-e*SphericalBesselY[ang,e],Cos[e-ang*(Pi/2)],-Sqrt[((Pi e)/2)]BesselY[ang+0.5,e]},{e,0,50},PlotStyle->sps]

(*δ[e_,ang_,r_,u0_]:= ArcCot[(SphericalBesselY[ang,kOut[e] r]D[SphericalBesselJ[ang,kIn[e,u0]r],r] - SphericalBesselJ[ang,kIn[e,u0]r]D[SphericalBesselY[ang,kOut[e] r],r])/(SphericalBesselJ[ang,kOut[e]r]D[SphericalBesselJ[ang,kIn[e,u0]r],r] - SphericalBesselJ[ang,kIn[e,u0]r]D[SphericalBesselJ[ang,kOut[e]r],r]) ]*)
δ[pIn_,pOut_,ang_,r_,u0_]:= ArcCot[(SphericalBesselY[ang,pOut r]D[SphericalBesselJ[ang,pIn r],r] - SphericalBesselJ[ang,pIn r]D[SphericalBesselY[ang,pOut r],r])/(SphericalBesselJ[ang,pOut r]D[SphericalBesselJ[ang,pIn r],r] - SphericalBesselJ[ang,pIn r]D[SphericalBesselJ[ang,pOut r],r]) ]

(*myDelta[e_,ang_,u0_]:= Simplify[δ[e,ang,r,u0]/.r->range]*)
myDelta[pIn_,pOut_,ang_,u0_]:= Simplify[δ[pIn,pOut,ang,r,u0]/.r->range]

myU = -20;
myAng = 0;
Plot[{myDelta[kIn[e,-2],kOut[e],myAng,-2],myDelta[kIn[e,-5],kOut[e],myAng,-5],myDelta[kIn[e,-10],kOut[e],myAng,-10]},{e,0,40},PlotRange->All,PlotStyle->sps]

CS[pIn_,pOut_,ang_,u0_]:=(1/100)((4 π )/(pOut^2)) (2ang +1) (((Sin[myDelta[pIn,pOut,ang,u0]]))^2)

csAng = 1;
Plot[{CS[kIn[ee,-5],kOut[ee],csAng,-5],CS[kIn[ee,-10],kOut[ee],csAng,-10],CS[kIn[ee,-15],kOut[ee],csAng,-15],CS[kIn[ee,-20],kOut[ee],csAng,-20]},{ee,0,40},PlotRange->All,PlotStyle->sps]

(*A[e_,ang_,u0_]:=((kOut[e] SphericalBesselJ[ang,kOut[e]range]Cos[myDelta[e,ang,u0]] -kOut[e] SphericalBesselY[ang,kOut[e] range]Sin[myDelta[e,ang,u0]])/(kIn[e,u0]SphericalBesselJ[ang,kIn[e,u0]range]))*)
A[pIn_,pOut_,ang_,u0_]:=(1/(pIn SphericalBesselJ[ang,pIn range]))(pOut SphericalBesselJ[ang,pOut range]Cos[myDelta[pIn,pOut,ang,u0]] -pOut SphericalBesselY[ang,pOut range]Sin[myDelta[pIn,pOut,ang,u0]])

(*fIn[e_,r_,ang_,u0_]:=A[e,ang,u0]kIn[e,u0]r SphericalBesselJ[ang,kIn[e,u0]r]*)
fIn[pIn_,pOut_,r_,ang_,u0_]:=A[pIn,pOut,ang,u0]pIn r SphericalBesselJ[ang,pIn r]

(*fOut[e_,r_,ang_,u0_]:=kOut[e]r SphericalBesselJ[ang,kOut[e]r]Cos[myDelta[e,ang,u0]] - kOut[e]r SphericalBesselY[ang,kOut[e]r]Sin[myDelta[e,ang,u0]]*)
fOut[pIn_,pOut_,r_,ang_,u0_]:=pOut r SphericalBesselJ[ang,pOut r]Cos[myDelta[pIn,pOut,ang,u0]] - pOut r SphericalBesselY[ang,pOut r]Sin[myDelta[pIn,pOut,ang,u0]]

myE = 30;
myU = -20;
myAng = 1;
Plot[{fIn[kIn[myE,myU],kOut[myE],rr,myAng,myU],fOut[kIn[myE,myU],kOut[myE],rr,myAng,myU]},{rr,0.1,15},PlotRange->All,PlotStyle->sps]

myR = 15;
myU = -15;
myAng = 1;
Plot[{fIn[kIn[ee,myU],kOut[ee],myR,myAng,myU],fOut[kIn[ee,myU],kOut[ee],myR,myAng,myU]},{ee,0.1,40},PlotRange->All,PlotStyle->sps]

(*fOut1[e_,r_,ang_]:=kOut[e] r  SphericalBesselJ[ang,kOut[e]r]*)
fOut1[pIn_,pOut_,r_,ang_,u0_]:=pOut r SphericalBesselJ[ang,pOut r]

(*TMatriX[e_,u_,ang_]:=(1/(kIn[e,u]kOut[e]))NIntegrate[ u fIn[e,rr,ang,u]fOut1[e,rr,ang] ,{rr,0,range}]*)
TMatriX[pIn_,pOut_,ang_,u0_]:=(u0/(pIn pOut))Integrate[ fIn[pIn,pOut,rr,ang,u0]fOut[pIn,pOut,rr,ang,u0] ,{rr,0,range}]

intT0[pIn_,pOut_,rr_,u0_]:=Integrate[Sin[pIn rr]Sin[pOut rr],rr]
Print[intT0[pIn,pOut,rr,u0]]

TElastic[q_,u_,r_]:= ((u 197.327)/(2(q^2))) (1-197.327 ((Sin[((2q r)/197.327)])/(2q )))

Plot[((mass^2)/(4 (Pi^2)(197.327^2)))((TElastic[q,-20,3])^2),{q,0,150}]

Clear[TMatriX0]
(* L=0 *)
TMatriX0[pIn_,pOut_]:=((20 A[pIn,pOut,0,-20])/(2 pIn pOut))(((Sin[(((pIn-pOut) 3)/197.327)])/(pIn-pOut))-((Sin[(((pIn+pOut) 3)/197.327)])/(pIn+pOut)))
(*Print[Simplify[TMatriX0[pIn,pOut,rr,u0]]]*)

ContourPlot[((TMatriX0[p1,p2])^2),{p1,0.1,10},{p2,0.1,10},PlotPoints->20]

(* L=1 *)

TMatriX1[e_,aa_,bb_]:=Integrate[(((Sin[aa rr])/(aa rr)) - Cos[aa rr])(((Sin[bb rr])/(bb rr)) - Cos[bb rr]),rr]

Print[Simplify[TMatriX1[e,aa,bb]]]

tmpT1[e_,u_,aa_,bb_,rr_]:= ((u A[e,0,u])/(aa bb  ))(((aa^2) bb rr Cos[bb rr] Sin[aa rr]-(aa (bb^2) rr Cos[aa rr]+((aa^2)-(bb^2)) Sin[aa rr]) Sin[bb rr])/(bb ((aa^3)-aa (bb^2)) rr))

u0 = -20;
T1[e_]:= tmpT1[e,u0,kIn[e,u0],kOut[e],3]-tmpT1[e,u0,kIn[e,u0],kOut[e],0.0001]

Plot[((T1[e])^2),{e,0,50}]