MATH529 L07
Wave equation

Separation of variables

Try u(x,t)=X(x)T(t) in (Subscript[u, t t])-(a^2) (Subscript[u, xx])=0, homogeneous PDE

PDE = (∂_(t,t))u[x,t]==(a^2) (∂_(x,x))u[x,t]; vPDE = (∂_(t,t))v[x,t]==(a^2) (∂_(x,x))v[x,t];
u[x_,t_]=X[x] T[t];
sPDE=Assuming[{u[x,t]≠0,a≠0},DivideSides[PDE,u[x,t] (a^2)]]

tDE = sPDE[[1]] == -λ; xDE = sPDE[[2]] == -λ; {tDE,xDE}

ODE solutions depend on sign of λ, consider each possible case

Case   λ=0

xDE0 = xDE /. λ->0; tDE0 = tDE /. λ->0;
{xDE0,tDE0}

xsol0=DSolve[xDE0,X[x],x][[1,1]]; tsol0=DSolve[tDE0,T[t],t][[1,1]] /. {(C[1])->(C[3]),(C[2])->(C[4])} ;
sol0={xsol0,tsol0}

u0[x_,y_] = X[x] T[t] /. sol0

Verify solution

v[x_,y_] = u0[x,y];
vPDE

Clear[v]; vPDE

Case   λ<0

xDEn = xDE /. λ->-(α^2); tDEn = tDE /. λ->-(α^2);
{xDEn,tDEn}

xsoln=DSolve[xDEn,X[x],x][[1,1]]/. {(C[1])->(C[5]),(C[2])->(C[6])}; tsoln=DSolve[tDEn,T[t],t][[1,1]] /.{(C[1])->(C[7]),(C[2])->(C[8])}; 
soln={xsoln,tsoln}

un[x_,t_] = X[x] T[t] /. soln

Verify solution

v[x_,y_] = un[x,y];
Simplify[vPDE ]

Clear[v]; vPDE

Case   λ>0

xDEp = xDE /. λ->(α^2); tDEp = tDE /. λ->(α^2);
{xDEp,tDEp} (∂_(x,x))v[x,y]==4 (∂_y)v[x,y];

xsolp=DSolve[xDEp,X[x],x][[1,1]]/. {(C[1])->(C[9]),(C[2])->(C[10])}; tsolp=DSolve[tDEp,T[t],t][[1,1]] /.{(C[1])->(C[11]),(C[2])->(C[12])};
solp={xsolp,tsolp}

up[x_,t_] = X[x] T[t] /. solp

Verify solution

v[x_,y_] = up[x,y];
Simplify[vPDE ]

Clear[v]; vPDE

Superposition of solutions

v[x_,t_]= a0 u0[x,t] + ap up[x,t] + an un[x,t]

Simplify[vPDE ]

Only physical solution is from  (Subscript[u, p])

Example

(Subscript[u, t t]) = (a^2) (Subscript[u, x x]), u(0,t)=0, u(L,t)=0, u(x,0)=(1/4)x (L-x), (Subscript[u, t])(x,0)=0

f[x_,L_] =(1/4) x (L-x); 
A[n_,L_]:=Assuming[n∈Integers,Integrate[f[x,L] If[x<L/4,x,1/3(L-x)]Sin[((n π)/L) x],{x,0,L}]]

u[x_,t_,L_,a_,nT_]:=Sum[ A[n,L] Sin[ ((n π)/L) x ] Cos[a ((n π)/L) t] ,{n,1,nT}]

Vibration visualization

g[x_,t_]=u[x,t,1,880.0,5]

Animate[Plot[g[x,t],{x,0,1},PlotRange->{{0,1},{-0.01,0.01}},GridLines->Automatic,Frame->True,FrameLabel->{"x","u"}],{t,0,0.02}]

Vibration sound

ω[a_,n_,L_]=a ((n π)/L); ν[a_,n_,L_]=a (n/(2L));
Afreq = 440.0; Solve[  ν[a,1,1]==Afreq,a]

Play[Sin[440 2 Pi t],{t,0,1}]

Sound[SoundNote["A",2,"Violin"]]

Play[g[0.5,t],{t,0,2}]