Reflection and Transmission Coefficients with damping on left
JT 25 Jan 2010  REVISED M GRAHAM 2017
CMD-shift-F gives help on selection (same as apple-shift-F)
Mathematica needs esc(ii) esc to recognize "i" as sqrt(-1). Capital I aslo works.  This shows as a black i.  If it is the variable i, it is blue.
To define a function, need f[x_,y_] :=, not just =.  Another way is f=Function[{x,y},x+y] and then ask for  f[1,2] or f[x,y].
Suko says look at Limit function as a way to factor. eg Limit[f[b,a], b/a->r]

There may be trouble in this worksheet with two sets of equations being solved.  Sometimes gets confused, so you have to "Quit Kernel" and start again.

Two ropes joined at x = 0
Define wavefunction ϕ on the left and ψ on the right

ϕ[x_,t_]:=Exp[-β*x]*Exp[I*(ω*t-kL*x)]+R*Exp[-β*(-x)]*Exp[I*(ω*t+kL*(x))]
ψ[x_,t_]:=T*Exp[I*(ω*t-kR*x)]

D[ϕ[x,t],x]
D[ψ[x,t],x]

ϕ'=D[ϕ[x,t],x]/.{x->0,t->0}
ψ'=D[ψ[x,t],x]/.{x->0,t->0}

solA=Solve[{ϕ[0,0]== ψ[0,0],ϕ'== ψ'},{R,T}]

Rplot=R/.solA/.{ω->1,kL->1,β->.11}
Tplot=T/.solA/.{ω->1,kL->1,β->.11}

"

ComplexExpand[Re[ϕ[x,t]/.solA/.{ω->1,kL->1,kR->2}]]
ComplexExpand[Re[ψ[x,t]/.solA/.{ω->1,kL->1,kR->2}]]

Animate[Plot[Piecewise[{{Re[ϕ[x,t]/.solA/.{ω->1,kL->1,kR->2,β->.1}],x<0},{Re[ψ[x,t]/.solA/.{ω->1,kL->1,kR->2,β->.1}],x>0}}],{x,-15,5},AxesLabel->{x,"ψ"},PlotRange->4, PlotStyle->{Red,Thick}],{t,0,2*π}]

Manipulate[Plot[Piecewise[{{Re[ϕ[x,t]/.solA/.{ω->1,kL->1,kR->kvar,β->b}],x<0},{Re[ψ[x,t]/.solA/.{ω->1,kL->1,kR->kvar,β->.1}],x>0}}],{x,-15,5},AxesLabel->{x,"ψ"},PlotRange->4, PlotStyle->{Red,Thick}],{{t,0,time},0,2*π},{{kvar,2,impedance on right},0,10},{{b,0.1,damping},0,0.15}]

Plot[{Abs[Rplot],Abs[Tplot]},{kR,0,10},AxesLabel->{kR,"Abs[R(red) or T(blue)]"}, PlotRange->2,PlotStyle->{{Red,Thick},{Blue,Thick}}]
Plot[{Arg[Rplot],Arg[Tplot]},{kR,0,10},AxesLabel->{kR,"Phase[R(red) or T(blue)]"}, PlotRange->π,PlotStyle->{{Red,Thick},{Blue,Thick}}]