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

Clear[kIn]

kIn[ee1_] := (Sqrt[2*mass*ee1])

Clear[kOut]

kOut[ee1_] := (Sqrt[2 mass (ee1- U0)])

momenta[energy_]:= ((Sqrt[ energy*energy + 2*mass*energy])/197.327);

(* создаю функции *)

phiIn[q_,r_,A1_,angMom_] := A1*SphericalBesselJ[angMom,q*r] q r

phiOut[k_,r_,delta_,angMom_]:= k r SphericalBesselJ[angMom,k*r] Cos[delta] + k r SphericalBesselY[angMom,k*r] Sin[delta]

(* и их производные *)

phiIn1[q_,r_,A1_,angMom_] := Simplify[D[phiIn[q,r,A1,angMom],r]]

Print[phiIn1[q,r,A1,angMom]]

phiOut1[k_,r_,delta_,angMom_] := Simplify[D[phiOut[k,r,delta,angMom],r]]

Print[phiOut1[k,r,delta,angMom]]

(* Подставляю данные *)

(*fIn[A1_,angMom_] := phiIn[(kIn/197.327),range,A1,angMom]*)
Clear[fIn]
fIn[ee_,A1_,angMom_] := phiIn[kIn[ee],range,A1,angMom]

Print[fIn[ee,A1,angMom]]

Clear[fOut]

(*fOut[delta_,angMom_] := phiOut[(kOut/197.327),range,delta,angMom]*)

fOut[ee_,delta_,angMom_] := phiOut[kOut[ee],range,delta,angMom]

Print[fOut[ee,delta,angMom]]

(*fIn1[A1_,angMom_] :=phiIn1[(kIn/197.327),range,A1,angMom]*)
Clear[fIn1]
fIn1[A1_,angMom_,ee_,r_] := Simplify[(1/2) A1  kIn[ee] (kIn[ee]*r* SphericalBesselJ[-1+angMom,kIn[ee] r]+SphericalBesselJ[angMom,kIn[ee] r]-kIn[ee] r* SphericalBesselJ[1+angMom,kIn[ee] r])]

Print[fIn1[A1,angMom,ee,range]]

(*fOut1[delta_,angMom_] :=phiOut1[(kOut/197.327),range,delta,angMom]*)
Clear[fOut1]
fOut1[delta_,angMom_,ee_,r_] := Simplify[(1/2) kOut[ee] (kOut[ee] r Cos[delta] SphericalBesselJ[-1+angMom,kOut[ee] r]+Cos[delta] SphericalBesselJ[angMom,kOut[ee] r]-kOut[ee] r Cos[delta] SphericalBesselJ[1+angMom,kOut[ee] r]+kOut[ee] r Sin[delta] SphericalBesselY[-1+angMom,kOut[ee] r]+Sin[delta] SphericalBesselY[angMom,kOut[ee] r]-kOut[ee] r Sin[delta] SphericalBesselY[1+angMom,kOut[ee] r])]

Print[fOut1[delta,angMom,ee,range]]

NSolve[{fIn[ee,aa,1]==fOut[ee,dd,1],fIn1[aa,1,ee,range]==fOut1[dd,1,ee,range]},{aa,dd}]

phase[ee_]:=

sMatrix[ee_] := Exp[2*I*phase[ee]]