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

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 = 1;
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]

(*δ[q_,ang_,r_,u0_]:= ArcTan[(D[SphericalBesselJ[ang,Sqrt[(q^2)-((2mass u0)/(t^2))] r],r]SphericalBesselJ[ang,q r] - D[SphericalBesselJ[ang,q r],r]SphericalBesselJ[ang,Sqrt[(q^2)-((2mass u0)/(t^2))] r])/(SphericalBesselY[ang,q r]D[SphericalBesselJ[ang,Sqrt[(q^2)-((2mass u0)/(t^2))] r],r] - SphericalBesselJ[ang,Sqrt[(q^2)-((2mass u0)/(t^2))] r]D[SphericalBesselY[ang,q r],r]) ]*)
δ[q_,ang_,r_,u0_]:= ArcTan[(SphericalBesselY[ang,q r]D[SphericalBesselJ[ang,Sqrt[(q^2)-((2mass u0)/(t^2))] r],r] - SphericalBesselJ[ang,Sqrt[(q^2)-((2mass u0)/(t^2))] r]D[SphericalBesselY[ang,q r],r]) ]

myDelta[q_,ang_,u0_]:= Simplify[δ[q,ang,r,u0]/.r->range]

myAng = 1;
Plot[{myDelta[(q/t),myAng,-17],myDelta[(q/t),myAng,-17.052],myDelta[(q/t),myAng,-20]},{q,0,250},PlotRange->All,PlotStyle->sps]

CS[q_,ang_,u0_]:=(1/100)((4 π )/(q^2)) (2ang +1) (((Sin[myDelta[q,ang,u0]]))^2)
(*-22.737*)

csAng = 1;
Plot[{CS[(q/t),csAng,-15],CS[(q/t),csAng,-17.052]},{q,0,150},PlotRange->All,PlotStyle->sps]

A[q_,ang_,u0_]:=(1/(Sqrt[(q^2)-((2mass u0)/(t^2))] SphericalBesselJ[ang,Sqrt[(q^2)-((2mass u0)/(t^2))] range]))(q SphericalBesselJ[ang,q range]Cos[myDelta[q,ang,u0]] -q SphericalBesselY[ang,q range]Sin[myDelta[q,ang,u0]])

fIn[q_,r_,ang_,u0_]:=A[q,ang,u0]Sqrt[(q^2)-((2mass u0)/(t^2))] r SphericalBesselJ[ang,Sqrt[(q^2)-((2mass u0)/(t^2))] r]

fOut[q_,r_,ang_,u0_]:=q r SphericalBesselJ[ang,q r]Cos[myDelta[q,ang,u0]] - q r SphericalBesselY[ang,q r]Sin[myDelta[q,ang,u0]]

myQ = 0.01;
(*myU = -5.6842;*)
myU = -22.737;
myAng = 1;
Plot[{fIn[(myQ/t),rr,myAng,myU],fOut[(myQ/t),rr,myAng,myU]},{rr,0.1,20},PlotRange->All,PlotStyle->sps]

myR = 3;
myU =  -16;
myAng = 0;
Plot[{fIn[(q/t),myR,myAng,myU],fOut[(q/t),myR,myAng,myU]},{q,0.1,500},PlotRange->All,PlotStyle->sps]

(*l=0*)
δ0[q_,r_,u0_]:= ArcTan[(D[((Sin[Sqrt[(q^2)-((2mass u0)/(t^2))]r])/(Sqrt[(q^2)-((2mass u0)/(t^2))]r)),r]((Sin[q r])/(q r)) - D[((Sin[q r])/(q r)),r]((Sin[Sqrt[(q^2)-((2mass u0)/(t^2))]r])/(Sqrt[(q^2)-((2mass u0)/(t^2))]r)))/(-((Cos[q r])/(q r)) D[((Sin[Sqrt[(q^2)-((2mass u0)/(t^2))]r])/(Sqrt[(q^2)-((2mass u0)/(t^2))]r)),r] + ((Sin[Sqrt[(q^2)-((2mass u0)/(t^2))]r])/(Sqrt[(q^2)-((2mass u0)/(t^2))]r))D[((Cos[q r])/(q r)),r]) ]

myDelta0[q_,u0_]:= Simplify[δ0[q,r,u0]/.r->range]

Plot[{myDelta0[((Sqrt[2*mass*e])/t),-2],myDelta0[((Sqrt[2*mass*e])/t),-4],myDelta0[((Sqrt[2*mass*e])/t),-6]},{e,0,50},PlotRange->All,PlotStyle->sps]

A0[q_,u0_]:=((Sin[q range]Cos[myDelta0[q,u0]] + Cos[q range] Sin[myDelta0[q,u0]])/(Sin[Sqrt[(q^2)-((2mass u0)/(t^2))] range]))

Plot[{((A0[q,-5.6842])/q),((A[q,0,-5.6842])/q)},{q,0,0.000001},PlotStyle->sps]

TMatrix0[q_,u0_]:= ((u0 A0[q,u0])/(197.327 q q))(((Sin[(q-Sqrt[(q^2)-((2mass u0)/(t^2))]) range])/(2 (q-Sqrt[(q^2)-((2mass u0)/(t^2))])))-((Sin[(Sqrt[(q^2)-((2mass u0)/(t^2))]+q) range])/(2 (Sqrt[(q^2)-((2mass u0)/(t^2))]+q))))

CS0[q_,u0_]:=(1/100)((mass^2)/((197.327^2)  ))(4^2) Pi ((Abs[TMatrix0[q,u0]])^2)

Plot[{CS0[(q/t),-16.],CS[(q/t),0,-16.]},{q,0,5},PlotRange->All,PlotStyle->sps]

TMatrix0[q_,k_,u0_]:= (1/100)((mass^2)/((197.327^2)  ))(4^2) Pi((Abs[((u0 A0[q,u0])/(197.327 q q))(((Sin[(q-k) range])/(2 (q-k)))-((Sin[(k+q) range])/(2 (k+q))))])^2)

ContourPlot[((TMatrix0[q,k,-5.6842])^2),{q,0.1,20},{k,0.1,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}]